-
Notifications
You must be signed in to change notification settings - Fork 8
FFmpeg Consumer
The FFmpeg consumer forwards the output of a CasparCG channel to ffmpeg, to stream or record video.
If you are familiar with FFmpeg, you will feel somewhat at home with the commands; the consumer tries to mimic the command-line arguments used by FFmpeg, see [1] for more options.
Note: Caspar will only take arguments in the -[parameter]:[stream] syntax. Use -codec:v, not -vcodec. Arguments not passed on by caspar to FFmpeg will yield an "Unused option" log message.
The encoding will take advantage of multi-core CPUs.
Time code is currently not supported. To enable playback of a file as it is being recorded, you must use a multiplexer format which supports this. Examples include MXF, MPEG2-PS or MPEG2-TS.
The video and audio passed is from CasparCG to FFmpeg consumer as uncompressed, raw frames (BGRA(full) channel resolution and framerate) and samples (8ch 32bit 48kHz).
It is therefore often necessary to adapt the raw video to a format appropriate for encoding by use of an FFmpeg filter chain; eg. -filter:v format=yuv420p
.
Users have to take care of color mode, color space, range, picture format, picture size, aspect ratio, samplesize, samplerate, channel configuration (...) using a valid filter chain. Otherwise you may get unexpected results or somehow "broken files".
Note: The server returning "ADD OK" means only that the command has been received and a consumer has been created. It does not indicate that FFmpeg has actually successfully started. If you are experiencing problems, check the server log files. A quick way to check whether FFmpeg actually did start, is removing the stream. If you get "404 REMOVE FAILED" back, the consumer died on its own; check the logs for details.
For historical/compatibility reasons, STREAM and FILE are interchangeable.
This command will generate a MOV file with H.264/AAC, scaled to 1280x720p50 4:2:0.
ADD 1-1 FILE myfile.mov -codec:v libx264 -codec:a aac -filter:v scale=width=1280:height=720:out_matrix=bt709:out_range=full,format=yuv420p,fps=50
The container format will be deduced from the file extension, but can be manually specified using -format. See FFmpeg output format documentation for a list of output formats (muxers) and their arguments.
To stop the recording you simply type:
REMOVE 1-1 FILE
[1]: FFmpeg How-to