Streaming from FFmpeg
FFmpeg is a powerful open-source multimedia framework that can decode, encode, transcode, mux, demux, stream, filter, and play almost anything that humans and machines have created. It does not have a graphical user interface like OBS or Wirecast. However, it is extremely powerful and flexible, making it a popular choice for advanced users and developers.
FFmpeg examples
To stream to Vindral Live using FFmpeg and RTMP, you can use the following command (make sure to replace <STREAM_KEY>
with your actual stream key):
ffmpeg -re -f lavfi -i "testsrc=size=1280x720:rate=25" -f lavfi -i "sine=frequency=440:sample_rate=48000, aformat=channel_layouts=stereo" -vcodec libx264 -preset veryfast -tune zerolatency -profile:v baseline -pix_fmt yuv420p -g 25 -acodec aac -b:a 64k -f flv rtmps://rtmp.global.cdn.vindral.com/publish/<STREAM_KEY>
This command generates a test video and audio stream using FFmpeg's built-in testsrc
and sine
filters, encodes the video with H.264 and the audio with AAC, and streams it to the specified RTMP URL.
Test easily by using docker:
docker run --rm -it jrottenberg/ffmpeg -re -f lavfi -i "testsrc=size=1280x720:rate=25" -f lavfi -i "sine=frequency=440:sample_rate=48000, aformat=channel_layouts=stereo" -vcodec libx264 -preset veryfast -tune zerolatency -profile:v baseline -pix_fmt yuv420p -g 25 -acodec aac -b:a 64k -f flv rtmps://rtmp.global.cdn.vindral.com/publish/<STREAM_KEY>
Docker example using SRT:
docker run --rm -it jrottenberg/ffmpeg:4.4-centos -re -f lavfi -i "testsrc=size=1280x720:rate=25" -f lavfi -i "sine=frequency=440:sample_rate=48000, aformat=channel_layouts=stereo" -vcodec libx264 -preset veryfast -tune zerolatency -profile:v baseline -pix_fmt yuv420p -g 25 -acodec aac -b:a 64k -f mpegts 'srt://srt.global.cdn.vindral.com:3333?streamid=#!::r=<STREAM_KEY>'