Started working with avconv to stream video & audio to RTMP server but am completely new to this and don't understand how this is put together.
I've been given this command, please could someone explain why there are multiple -f, -i parameters, for example? How much does the order of the parameters play a part?
avconv -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental RTMP_URL
Thanks in advance.
Anything before -i
applies to the next input, anything after applies to the output
first input
-re
Process in real time (read 1 second of media every second)
-ar 44100
The input audio rate is 44100 samples per second
-ac 2
The input audio is in stereo
-acodec pcm_s16le
the input audio is encoded using signed 16 bit little endian vales per sample
-f s16le
The input audios container is raw
-ac 2
The input audio is in stereo (You specifies this twice its only needed once)
-i /dev/zero
Read a infinitely long stream of zeros to use as the raw audio source
second input
-f h264
The input video source is raw h264 (annex b) stream
-i -
The input video should be read from stdin
output
-vcodec copy
Copy the video from input to output without transcoding
-acodec aac
Transcode the audio from whatever format it is in, to acc
-ab 128k
the resulting audio should be encoded to 128kbps
-g 50
The video encoder should create a keyframe ever 50 frames. Note: this does nothing because you are using -vcodec copy
since there is no video encoder in use
-strict experimental
some ffmpeg feature are experimental and should not be used. This will allow those features to be used. This can be set anywhere in the command.
RTMP_URL
The format and location to send the result of the output.
You probably also need to add -f flv
to the output for ramp to work correctly.