FFmpeg is a useful tool for working with video and audio. For making FFmpeg commands check out FFmpeg guide which turns the process into making graphs!
Test video source
ffmpeg -hide_banner -re \
-f lavfi \
-i "testsrc2=size=1920x1080:rate=25,format=yuv420p" \
-vf drawtext="fontfile=monofonto.ttf: fontsize=96: box=1: [email protected]: boxborderw=5: fontcolor=white: x=(w-text_w)/2: y=((h-text_h)/2)+((h-text_h)/4): text='%{localtime\:%X}'" \
${DESTINATION}
Test video and audio source
ffmpeg -hide_banner -re \
-f lavfi \
-i anullsrc=r=48000:cl=mono \
-f lavfi \
-i "testsrc2=size=1920x1080:rate=25,format=yuv420p" \
-vf drawtext="fontfile=monofonto.ttf: fontsize=96: box=1: [email protected]: boxborderw=5: fontcolor=white: x=(w-text_w)/2: y=((h-text_h)/2)+((h-text_h)/4): text='%{localtime\:%X}'" \
-c:a aac -ar 48000 \
${DESTINATION}
- Can be streamed to YouTube unlike the previous command due an audio track being required.
NDI to RIST
You will need a custom build of FFmpeg since NDI isn’t included in the default FFmpeg build. See this ticket for details.
ffmpeg -f libndi_newtek -i ${NDI_SOURCE_NAME} \
-pix_fmt yuv420p -async 2 -vsync cfr \
-c:v libx264 -b:v 4000 -bufsize 3840k \
-profile:v high -tune zerolatency -preset veryfast -g 50 \
-sc_threshold 0 -crf 23 -c:a aac -b:a 96k \
-f mpegts rist://${DEST_IP}:21935
Live source to growing MXF file
This command can take a like feed such as RTMP and spit out a growing MXF file. This allows live highlights to be made of a livestream through software such as Final Cut Pro. The quality is pretty decent at 1080p50@25Mbps.
ffmpeg -re -i ${LIVE_INPUT} \
-pix_fmt yuv422p -c:v mpeg2video -non_linear_quant 1 -flags +ildct+ilme -top 1 -dc 10 -intra_vlc 1 -qmax 6 -lmin "1*QP2LAMBDA" -rc_max_vbv_use 1 -rc_min_vbv_use 1 -b:v 25M -minrate 25M -maxrate 25M -bufsize 36408333 \
-c:a pcm_s16le -ar 48000 \
${DEST_FILE}.mxf
- Taken and modified from Stack Overflow.
- Implementation of Final Cut Pro documentation on growing files .
- Hasn’t been tested with long runtimes.