You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

287 lines
9.9KB

  1. \input texinfo @c -*- texinfo -*-
  2. @settitle ffserver Documentation
  3. @titlepage
  4. @center @titlefont{ffserver Documentation}
  5. @end titlepage
  6. @top
  7. @contents
  8. @chapter Synopsys
  9. The generic syntax is:
  10. @example
  11. @c man begin SYNOPSIS
  12. ffserver [options]
  13. @c man end
  14. @end example
  15. @chapter Description
  16. @c man begin DESCRIPTION
  17. ffserver is a streaming server for both audio and video. It supports
  18. several live feeds, streaming from files and time shifting on live feeds
  19. (you can seek to positions in the past on each live feed, provided you
  20. specify a big enough feed storage in ffserver.conf).
  21. This documentation covers only the streaming aspects of ffserver /
  22. ffmpeg. All questions about parameters for ffmpeg, codec questions,
  23. etc. are not covered here. Read @file{ffmpeg.html} for more
  24. information.
  25. @section How does it work?
  26. ffserver receives prerecorded files or FFM streams from some ffmpeg
  27. instance as input, then streams them over RTP/RTSP/HTTP.
  28. An ffserver instance will listen on some port as specified in the
  29. configuration file. You can launch one or more instances of ffmpeg and
  30. send one or more FFM streams to the port where ffserver is expecting
  31. to receive them. Alternately, you can make ffserver launch such ffmpeg
  32. instances at startup.
  33. Input streams are called feeds, and each one is specified by a <Feed>
  34. section in the configuration file.
  35. For each feed you can have different output streams in various
  36. formats, each one specified by a <Stream> section in the configuration
  37. file.
  38. @section Status stream
  39. ffserver supports an HTTP interface which exposes the current status
  40. of the server.
  41. Simply point your browser to the address of the special status stream
  42. specified in the configuration file.
  43. For example if you have:
  44. @example
  45. <Stream status.html>
  46. Format status
  47. # Only allow local people to get the status
  48. ACL allow localhost
  49. ACL allow 192.168.0.0 192.168.255.255
  50. </Stream>
  51. @end example
  52. then the server will post a page with the status information when
  53. the special stream @file{status.html} is requested.
  54. @section What can this do?
  55. When properly configured and running, you can capture video and audio in real
  56. time from a suitable capture card, and stream it out over the Internet to
  57. either Windows Media Player or RealAudio player (with some restrictions).
  58. It can also stream from files, though that is currently broken. Very often, a
  59. web server can be used to serve up the files just as well.
  60. It can stream prerecorded video from .ffm files, though it is somewhat tricky
  61. to make it work correctly.
  62. @section What do I need?
  63. I use Linux on a 900 MHz Duron with a cheapo Bt848 based TV capture card. I'm
  64. using stock Linux 2.4.17 with the stock drivers. [Actually that isn't true,
  65. I needed some special drivers for my motherboard-based sound card.]
  66. I understand that FreeBSD systems work just fine as well.
  67. @section How do I make it work?
  68. First, build the kit. It *really* helps to have installed LAME first. Then when
  69. you run the ffserver ./configure, make sure that you have the
  70. @code{--enable-libmp3lame} flag turned on.
  71. LAME is important as it allows for streaming audio to Windows Media Player.
  72. Don't ask why the other audio types do not work.
  73. As a simple test, just run the following two command lines where INPUTFILE
  74. is some file which you can decode with ffmpeg:
  75. @example
  76. ffserver -f doc/ffserver.conf &
  77. ffmpeg -i INPUTFILE http://localhost:8090/feed1.ffm
  78. @end example
  79. At this point you should be able to go to your Windows machine and fire up
  80. Windows Media Player (WMP). Go to Open URL and enter
  81. @example
  82. http://<linuxbox>:8090/test.asf
  83. @end example
  84. You should (after a short delay) see video and hear audio.
  85. WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to
  86. transfer the entire file before starting to play.
  87. The same is true of AVI files.
  88. @section What happens next?
  89. You should edit the ffserver.conf file to suit your needs (in terms of
  90. frame rates etc). Then install ffserver and ffmpeg, write a script to start
  91. them up, and off you go.
  92. @section Troubleshooting
  93. @subsection I don't hear any audio, but video is fine.
  94. Maybe you didn't install LAME, or got your ./configure statement wrong. Check
  95. the ffmpeg output to see if a line referring to MP3 is present. If not, then
  96. your configuration was incorrect. If it is, then maybe your wiring is not
  97. set up correctly. Maybe the sound card is not getting data from the right
  98. input source. Maybe you have a really awful audio interface (like I do)
  99. that only captures in stereo and also requires that one channel be flipped.
  100. If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before
  101. starting ffmpeg.
  102. @subsection The audio and video lose sync after a while.
  103. Yes, they do.
  104. @subsection After a long while, the video update rate goes way down in WMP.
  105. Yes, it does. Who knows why?
  106. @subsection WMP 6.4 behaves differently to WMP 7.
  107. Yes, it does. Any thoughts on this would be gratefully received. These
  108. differences extend to embedding WMP into a web page. [There are two
  109. object IDs that you can use: The old one, which does not play well, and
  110. the new one, which does (both tested on the same system). However,
  111. I suspect that the new one is not available unless you have installed WMP 7].
  112. @section What else can it do?
  113. You can replay video from .ffm files that was recorded earlier.
  114. However, there are a number of caveats, including the fact that the
  115. ffserver parameters must match the original parameters used to record the
  116. file. If they do not, then ffserver deletes the file before recording into it.
  117. (Now that I write this, it seems broken).
  118. You can fiddle with many of the codec choices and encoding parameters, and
  119. there are a bunch more parameters that you cannot control. Post a message
  120. to the mailing list if there are some 'must have' parameters. Look in
  121. ffserver.conf for a list of the currently available controls.
  122. It will automatically generate the ASX or RAM files that are often used
  123. in browsers. These files are actually redirections to the underlying ASF
  124. or RM file. The reason for this is that the browser often fetches the
  125. entire file before starting up the external viewer. The redirection files
  126. are very small and can be transferred quickly. [The stream itself is
  127. often 'infinite' and thus the browser tries to download it and never
  128. finishes.]
  129. @section Tips
  130. * When you connect to a live stream, most players (WMP, RA, etc) want to
  131. buffer a certain number of seconds of material so that they can display the
  132. signal continuously. However, ffserver (by default) starts sending data
  133. in realtime. This means that there is a pause of a few seconds while the
  134. buffering is being done by the player. The good news is that this can be
  135. cured by adding a '?buffer=5' to the end of the URL. This means that the
  136. stream should start 5 seconds in the past -- and so the first 5 seconds
  137. of the stream are sent as fast as the network will allow. It will then
  138. slow down to real time. This noticeably improves the startup experience.
  139. You can also add a 'Preroll 15' statement into the ffserver.conf that will
  140. add the 15 second prebuffering on all requests that do not otherwise
  141. specify a time. In addition, ffserver will skip frames until a key_frame
  142. is found. This further reduces the startup delay by not transferring data
  143. that will be discarded.
  144. * You may want to adjust the MaxBandwidth in the ffserver.conf to limit
  145. the amount of bandwidth consumed by live streams.
  146. @section Why does the ?buffer / Preroll stop working after a time?
  147. It turns out that (on my machine at least) the number of frames successfully
  148. grabbed is marginally less than the number that ought to be grabbed. This
  149. means that the timestamp in the encoded data stream gets behind realtime.
  150. This means that if you say 'Preroll 10', then when the stream gets 10
  151. or more seconds behind, there is no Preroll left.
  152. Fixing this requires a change in the internals of how timestamps are
  153. handled.
  154. @section Does the @code{?date=} stuff work.
  155. Yes (subject to the limitation outlined above). Also note that whenever you
  156. start ffserver, it deletes the ffm file (if any parameters have changed),
  157. thus wiping out what you had recorded before.
  158. The format of the @code{?date=xxxxxx} is fairly flexible. You should use one
  159. of the following formats (the 'T' is literal):
  160. @example
  161. * YYYY-MM-DDTHH:MM:SS (localtime)
  162. * YYYY-MM-DDTHH:MM:SSZ (UTC)
  163. @end example
  164. You can omit the YYYY-MM-DD, and then it refers to the current day. However
  165. note that @samp{?date=16:00:00} refers to 16:00 on the current day -- this
  166. may be in the future and so is unlikely to be useful.
  167. You use this by adding the ?date= to the end of the URL for the stream.
  168. For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}.
  169. @c man end
  170. @section What is FFM, FFM2
  171. FFM and FFM2 are formats used by ffserver. They allow storing a wide varity of
  172. video and audio streams and encoding options, and can store a moving time segment
  173. of an infinite movie or a whole movie.
  174. FFM is version specific, and there is limited compatibility of FFM files
  175. generated by one version of ffmpeg/ffserver and another version of
  176. ffmpeg/ffserver. It may work but its not guaranteed to work.
  177. FFM2 is extensible while maintaining compatibility and should work between
  178. differing versions of tools. FFM2 is the default.
  179. @chapter Options
  180. @c man begin OPTIONS
  181. @include avtools-common-opts.texi
  182. @section Main options
  183. @table @option
  184. @item -f @var{configfile}
  185. Use @file{configfile} instead of @file{/etc/ffserver.conf}.
  186. @item -n
  187. Enable no-launch mode. This option disables all the Launch directives
  188. within the various <Stream> sections. Since ffserver will not launch
  189. any ffmpeg instances, you will have to launch them manually.
  190. @item -d
  191. Enable debug mode. This option increases log verbosity, directs log
  192. messages to stdout.
  193. @end table
  194. @c man end
  195. @ignore
  196. @setfilename ffserver
  197. @settitle ffserver video server
  198. @c man begin SEEALSO
  199. ffmpeg(1), ffplay(1), ffprobe(1), the @file{ffserver.conf}
  200. example and the FFmpeg HTML documentation
  201. @c man end
  202. @c man begin AUTHORS
  203. The FFmpeg developers
  204. @c man end
  205. @end ignore
  206. @bye