.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "AVSERVER 1" .TH AVSERVER 1 "2016-03-02" " " " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" avserver \- avserver video server .SH "SYNOPSIS" .IX Header "SYNOPSIS" avserver [options] .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\s-1WARNING:\s0 avserver is unmaintained, largely broken and in need of a complete rewrite. It probably won't work for you. Use at your own risk. .PP avserver is a streaming server for both audio and video. It supports several live feeds, streaming from files and time shifting on live feeds (you can seek to positions in the past on each live feed, provided you specify a big enough feed storage in avserver.conf). .PP avserver runs in daemon mode by default; that is, it puts itself in the background and detaches from its \s-1TTY\s0, unless it is launched in debug mode or a NoDaemon option is specified in the configuration file. .PP This documentation covers only the streaming aspects of avserver / avconv. All questions about parameters for avconv, codec questions, etc. are not covered here. Read \fIavconv.html\fR for more information. .SS "How does it work?" .IX Subsection "How does it work?" avserver receives prerecorded files or \s-1FFM\s0 streams from some avconv instance as input, then streams them over \s-1RTP/RTSP/HTTP\s0. .PP An avserver instance will listen on some port as specified in the configuration file. You can launch one or more instances of avconv and send one or more \s-1FFM\s0 streams to the port where avserver is expecting to receive them. Alternately, you can make avserver launch such avconv instances at startup. .PP Input streams are called feeds, and each one is specified by a section in the configuration file. .PP For each feed you can have different output streams in various formats, each one specified by a section in the configuration file. .SS "Status stream" .IX Subsection "Status stream" avserver supports an \s-1HTTP\s0 interface which exposes the current status of the server. .PP Simply point your browser to the address of the special status stream specified in the configuration file. .PP For example if you have: .PP .Vb 2 \& \& Format status \& \& # Only allow local people to get the status \& ACL allow localhost \& ACL allow 192.168.0.0 192.168.255.255 \& .Ve .PP then the server will post a page with the status information when the special stream \fIstatus.html\fR is requested. .SS "What can this do?" .IX Subsection "What can this do?" When properly configured and running, you can capture video and audio in real time from a suitable capture card, and stream it out over the Internet to either Windows Media Player or RealAudio player (with some restrictions). .PP It can also stream from files, though that is currently broken. Very often, a web server can be used to serve up the files just as well. .PP It can stream prerecorded video from .ffm files, though it is somewhat tricky to make it work correctly. .SS "What do I need?" .IX Subsection "What do I need?" I use Linux on a 900 MHz Duron with a cheapo Bt848 based \s-1TV\s0 capture card. I'm using stock Linux 2.4.17 with the stock drivers. [Actually that isn't true, I needed some special drivers for my motherboard-based sound card.] .PP I understand that FreeBSD systems work just fine as well. .SS "How do I make it work?" .IX Subsection "How do I make it work?" First, build the kit. It *really* helps to have installed \s-1LAME\s0 first. Then when you run the avserver ./configure, make sure that you have the \&\f(CW\*(C`\-\-enable\-libmp3lame\*(C'\fR flag turned on. .PP \&\s-1LAME\s0 is important as it allows for streaming audio to Windows Media Player. Don't ask why the other audio types do not work. .PP As a simple test, just run the following two command lines where \s-1INPUTFILE\s0 is some file which you can decode with avconv: .PP .Vb 2 \& ./avserver \-f doc/avserver.conf & \& ./avconv \-i INPUTFILE http://localhost:8090/feed1.ffm .Ve .PP At this point you should be able to go to your Windows machine and fire up Windows Media Player (\s-1WMP\s0). Go to Open \s-1URL\s0 and enter .PP .Vb 1 \& http://:8090/test.asf .Ve .PP You should (after a short delay) see video and hear audio. .PP \&\s-1WARNING:\s0 trying to stream test1.mpg doesn't work with \s-1WMP\s0 as it tries to transfer the entire file before starting to play. The same is true of \s-1AVI\s0 files. .SS "What happens next?" .IX Subsection "What happens next?" You should edit the avserver.conf file to suit your needs (in terms of frame rates etc). Then install avserver and avconv, write a script to start them up, and off you go. .SS "Troubleshooting" .IX Subsection "Troubleshooting" \fII don't hear any audio, but video is fine.\fR .IX Subsection "I don't hear any audio, but video is fine." .PP Maybe you didn't install \s-1LAME\s0, or got your ./configure statement wrong. Check the avconv output to see if a line referring to \s-1MP3\s0 is present. If not, then your configuration was incorrect. If it is, then maybe your wiring is not set up correctly. Maybe the sound card is not getting data from the right input source. Maybe you have a really awful audio interface (like I do) that only captures in stereo and also requires that one channel be flipped. If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before starting avconv. .PP \fIThe audio and video lose sync after a while.\fR .IX Subsection "The audio and video lose sync after a while." .PP Yes, they do. .PP \fIAfter a long while, the video update rate goes way down in \s-1WMP\s0.\fR .IX Subsection "After a long while, the video update rate goes way down in WMP." .PP Yes, it does. Who knows why? .PP \fI\s-1WMP\s0 6.4 behaves differently to \s-1WMP\s0 7.\fR .IX Subsection "WMP 6.4 behaves differently to WMP 7." .PP Yes, it does. Any thoughts on this would be gratefully received. These differences extend to embedding \s-1WMP\s0 into a web page. [There are two object IDs that you can use: The old one, which does not play well, and the new one, which does (both tested on the same system). However, I suspect that the new one is not available unless you have installed \s-1WMP\s0 7]. .SS "What else can it do?" .IX Subsection "What else can it do?" You can replay video from .ffm files that was recorded earlier. However, there are a number of caveats, including the fact that the avserver parameters must match the original parameters used to record the file. If they do not, then avserver deletes the file before recording into it. (Now that I write this, it seems broken). .PP You can fiddle with many of the codec choices and encoding parameters, and there are a bunch more parameters that you cannot control. Post a message to the mailing list if there are some 'must have' parameters. Look in avserver.conf for a list of the currently available controls. .PP It will automatically generate the \s-1ASX\s0 or \s-1RAM\s0 files that are often used in browsers. These files are actually redirections to the underlying \s-1ASF\s0 or \s-1RM\s0 file. The reason for this is that the browser often fetches the entire file before starting up the external viewer. The redirection files are very small and can be transferred quickly. [The stream itself is often 'infinite' and thus the browser tries to download it and never finishes.] .SS "Tips" .IX Subsection "Tips" * When you connect to a live stream, most players (\s-1WMP\s0, \s-1RA\s0, etc) want to buffer a certain number of seconds of material so that they can display the signal continuously. However, avserver (by default) starts sending data in realtime. This means that there is a pause of a few seconds while the buffering is being done by the player. The good news is that this can be cured by adding a '?buffer=5' to the end of the \s-1URL\s0. This means that the stream should start 5 seconds in the past \*(-- and so the first 5 seconds of the stream are sent as fast as the network will allow. It will then slow down to real time. This noticeably improves the startup experience. .PP You can also add a 'Preroll 15' statement into the avserver.conf that will add the 15 second prebuffering on all requests that do not otherwise specify a time. In addition, avserver will skip frames until a key_frame is found. This further reduces the startup delay by not transferring data that will be discarded. .PP * You may want to adjust the MaxBandwidth in the avserver.conf to limit the amount of bandwidth consumed by live streams. .SS "Why does the ?buffer / Preroll stop working after a time?" .IX Subsection "Why does the ?buffer / Preroll stop working after a time?" It turns out that (on my machine at least) the number of frames successfully grabbed is marginally less than the number that ought to be grabbed. This means that the timestamp in the encoded data stream gets behind realtime. This means that if you say 'Preroll 10', then when the stream gets 10 or more seconds behind, there is no Preroll left. .PP Fixing this requires a change in the internals of how timestamps are handled. .ie n .SS "Does the ""?date="" stuff work." .el .SS "Does the \f(CW?date=\fP stuff work." .IX Subsection "Does the ?date= stuff work." Yes (subject to the limitation outlined above). Also note that whenever you start avserver, it deletes the ffm file (if any parameters have changed), thus wiping out what you had recorded before. .PP The format of the \f(CW\*(C`?date=xxxxxx\*(C'\fR is fairly flexible. You should use one of the following formats (the 'T' is literal): .PP .Vb 2 \& * YYYY\-MM\-DDTHH:MM:SS (localtime) \& * YYYY\-MM\-DDTHH:MM:SSZ (UTC) .Ve .PP You can omit the YYYY-MM-DD, and then it refers to the current day. However note that \fB?date=16:00:00\fR refers to 16:00 on the current day \*(-- this may be in the future and so is unlikely to be useful. .PP You use this by adding the ?date= to the end of the \s-1URL\s0 for the stream. For example: \fBhttp://localhost:8080/test.asf?date=2002\-07\-26T23:05:00\fR. .SH "OPTIONS" .IX Header "OPTIONS" All the numerical options, if not specified otherwise, accept in input a string representing a number, which may contain one of the International System number postfixes, for example 'K', 'M', 'G'. If 'i' is appended after the postfix, powers of 2 are used instead of powers of 10. The 'B' postfix multiplies the value for 8, and can be appended after another postfix or used alone. This allows using for example '\s-1KB\s0', 'MiB', 'G' and 'B' as postfix. .PP Options which do not take arguments are boolean options, and set the corresponding value to true. They can be set to false by prefixing with \*(L"no\*(R" the option name, for example using \*(L"\-nofoo\*(R" in the command line will set to false the boolean option with name \*(L"foo\*(R". .SS "Stream specifiers" .IX Subsection "Stream specifiers" Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers are used to precisely specify which stream(s) does a given option belong to. .PP A stream specifier is a string generally appended to the option name and separated from it by a colon. E.g. \f(CW\*(C`\-codec:a:1 ac3\*(C'\fR option contains \&\f(CW\*(C`a:1\*(C'\fR stream specifer, which matches the second audio stream. Therefore it would select the ac3 codec for the second audio stream. .PP A stream specifier can match several stream, the option is then applied to all of them. E.g. the stream specifier in \f(CW\*(C`\-b:a 128k\*(C'\fR matches all audio streams. .PP An empty stream specifier matches all streams, for example \f(CW\*(C`\-codec copy\*(C'\fR or \f(CW\*(C`\-codec: copy\*(C'\fR would copy all the streams without reencoding. .PP Possible forms of stream specifiers are: .IP "\fIstream_index\fR" 4 .IX Item "stream_index" Matches the stream with this index. E.g. \f(CW\*(C`\-threads:1 4\*(C'\fR would set the thread count for the second stream to 4. .IP "\fIstream_type\fR\fB[:\fR\fIstream_index\fR\fB]\fR" 4 .IX Item "stream_type[:stream_index]" \&\fIstream_type\fR is one of: 'v' for video, 'a' for audio, 's' for subtitle, \&'d' for data and 't' for attachments. If \fIstream_index\fR is given, then matches stream number \fIstream_index\fR of this type. Otherwise matches all streams of this type. .IP "\fBp:\fR\fIprogram_id\fR\fB[:\fR\fIstream_index\fR\fB]\fR" 4 .IX Item "p:program_id[:stream_index]" If \fIstream_index\fR is given, then matches stream number \fIstream_index\fR in program with id \fIprogram_id\fR. Otherwise matches all streams in this program. .SS "Generic options" .IX Subsection "Generic options" These options are shared amongst the av* tools. .IP "\fB\-L\fR" 4 .IX Item "-L" Show license. .IP "\fB\-h, \-?, \-help, \-\-help\fR" 4 .IX Item "-h, -?, -help, --help" Show help. .IP "\fB\-version\fR" 4 .IX Item "-version" Show version. .IP "\fB\-formats\fR" 4 .IX Item "-formats" Show available formats. .Sp The fields preceding the format names have the following meanings: .RS 4 .IP "\fBD\fR" 4 .IX Item "D" Decoding available .IP "\fBE\fR" 4 .IX Item "E" Encoding available .RE .RS 4 .RE .IP "\fB\-codecs\fR" 4 .IX Item "-codecs" Show available codecs. .Sp The fields preceding the codec names have the following meanings: .RS 4 .IP "\fBD\fR" 4 .IX Item "D" Decoding available .IP "\fBE\fR" 4 .IX Item "E" Encoding available .IP "\fBV/A/S\fR" 4 .IX Item "V/A/S" Video/audio/subtitle codec .IP "\fBS\fR" 4 .IX Item "S" Codec supports slices .IP "\fBD\fR" 4 .IX Item "D" Codec supports direct rendering .IP "\fBT\fR" 4 .IX Item "T" Codec can handle input truncated at random locations instead of only at frame boundaries .RE .RS 4 .RE .IP "\fB\-bsfs\fR" 4 .IX Item "-bsfs" Show available bitstream filters. .IP "\fB\-protocols\fR" 4 .IX Item "-protocols" Show available protocols. .IP "\fB\-filters\fR" 4 .IX Item "-filters" Show available libavfilter filters. .IP "\fB\-pix_fmts\fR" 4 .IX Item "-pix_fmts" Show available pixel formats. .IP "\fB\-sample_fmts\fR" 4 .IX Item "-sample_fmts" Show available sample formats. .IP "\fB\-loglevel\fR \fIloglevel\fR \fB| \-v\fR \fIloglevel\fR" 4 .IX Item "-loglevel loglevel | -v loglevel" Set the logging level used by the library. \&\fIloglevel\fR is a number or a string containing one of the following values: .RS 4 .IP "\fBquiet\fR" 4 .IX Item "quiet" .PD 0 .IP "\fBpanic\fR" 4 .IX Item "panic" .IP "\fBfatal\fR" 4 .IX Item "fatal" .IP "\fBerror\fR" 4 .IX Item "error" .IP "\fBwarning\fR" 4 .IX Item "warning" .IP "\fBinfo\fR" 4 .IX Item "info" .IP "\fBverbose\fR" 4 .IX Item "verbose" .IP "\fBdebug\fR" 4 .IX Item "debug" .RE .RS 4 .PD .Sp By default the program logs to stderr, if coloring is supported by the terminal, colors are used to mark errors and warnings. Log coloring can be disabled setting the environment variable \&\fB\s-1AV_LOG_FORCE_NOCOLOR\s0\fR or \fB\s-1NO_COLOR\s0\fR, or can be forced setting the environment variable \fB\s-1AV_LOG_FORCE_COLOR\s0\fR. The use of the environment variable \fB\s-1NO_COLOR\s0\fR is deprecated and will be dropped in a following Libav version. .RE .SS "AVOptions" .IX Subsection "AVOptions" These options are provided directly by the libavformat, libavdevice and libavcodec libraries. To see the list of available AVOptions, use the \&\fB\-help\fR option. They are separated into two categories: .IP "\fBgeneric\fR" 4 .IX Item "generic" These options can be set for any container, codec or device. Generic options are listed under AVFormatContext options for containers/devices and under AVCodecContext options for codecs. .IP "\fBprivate\fR" 4 .IX Item "private" These options are specific to the given container, device or codec. Private options are listed under their corresponding containers/devices/codecs. .PP For example to write an ID3v2.3 header instead of a default ID3v2.4 to an \s-1MP3\s0 file, use the \fBid3v2_version\fR private option of the \s-1MP3\s0 muxer: .PP .Vb 1 \& avconv \-i input.flac \-id3v2_version 3 out.mp3 .Ve .PP All codec AVOptions are obviously per-stream, so the chapter on stream specifiers applies to them .PP Note \fB\-nooption\fR syntax cannot be used for boolean AVOptions, use \fB\-option 0\fR/\fB\-option 1\fR. .PP Note2 old undocumented way of specifying per-stream AVOptions by prepending v/a/s to the options name is now obsolete and will be removed soon. .SS "Main options" .IX Subsection "Main options" .IP "\fB\-f\fR \fIconfigfile\fR" 4 .IX Item "-f configfile" Use \fIconfigfile\fR instead of \fI/etc/avserver.conf\fR. .IP "\fB\-n\fR" 4 .IX Item "-n" Enable no-launch mode. This option disables all the Launch directives within the various sections. Since avserver will not launch any avconv instances, you will have to launch them manually. .IP "\fB\-d\fR" 4 .IX Item "-d" Enable debug mode. This option increases log verbosity, directs log messages to stdout and causes avserver to run in the foreground rather than as a daemon. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIavconv\fR\|(1), \fIavplay\fR\|(1), \fIavprobe\fR\|(1), the \fIavserver.conf\fR example and the Libav \s-1HTML\s0 documentation .SH "AUTHORS" .IX Header "AUTHORS" The Libav developers