Skip to content

Instantly share code, notes, and snippets.

@nickferrando
Created March 2, 2021 18:22
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nickferrando/6d572b044a205a507201e2fc69423a3e to your computer and use it in GitHub Desktop.
Save nickferrando/6d572b044a205a507201e2fc69423a3e to your computer and use it in GitHub Desktop.
Generate SMPTE Color Bars/1kHz Test Tone with FFMPEG
#Display Custom Message on STMPE Bars and Server's Local Time
ffmpeg -re -f lavfi -i "smptehdbars=rate=30:size=1920x1080" \
-f lavfi -i "sine=frequency=1000:sample_rate=48000" \
-vf drawtext="text='YOUR MESSAGE %{localtime\:%X}':rate=30:x=(w-tw)/2:y=(h-lh)/2:fontsize=48:fontcolor=white:box=1:boxcolor=black" \
-f flv -c:v h264 -profile:v baseline -pix_fmt yuv420p -preset ultrafast -tune zerolatency -crf 28 -g 60 -c:a aac \
"rtmp://your_server_address/stream_key"
#Display Custom Message on STMPE Bars and Time (HH:MM:MS)
ffmpeg -re -f lavfi -i "smptehdbars=rate=30:size=1920x1080" \
-f lavfi -i "sine=frequency=1000:sample_rate=48000" \
-vf drawtext="text='YOUR MESSAGE %{pts\:hms}':rate=30:x=(w-tw)/2:y=(h-lh)/2:fontsize=48:fontcolor=white:box=1:boxcolor=black" \
-f flv -c:v h264 -profile:v baseline -pix_fmt yuv420p -preset ultrafast -tune zerolatency -crf 28 -g 60 -c:a aac \
"rtmp://your_server_address/stream_key"
#Display Custom Message on STMPE Bars and 30FPS Timecode (HH:MM:Frames)
ffmpeg -re -f lavfi -i "smptehdbars=rate=30:size=1920x1080" \
-f lavfi -i "sine=frequency=1000:sample_rate=48000" \
-vf drawtext="text='YOUR MESSAGE:timecode=01\:00\:00\:00':rate=30:x=(w-tw)/2:y=(h-lh)/2:fontsize=48:fontcolor=white:box=1:boxcolor=black" \
-f flv -c:v h264 -profile:v baseline -pix_fmt yuv420p -preset ultrafast -tune zerolatency -crf 28 -g 60 -c:a aac \
"rtmp://your_server_address/stream_key"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment