Skip to content

Instantly share code, notes, and snippets.

@m1tk4
Last active July 30, 2022 19:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save m1tk4/e91be6267a1199b1b93d3c15c2cf6c48 to your computer and use it in GitHub Desktop.
Save m1tk4/e91be6267a1199b1b93d3c15c2cf6c48 to your computer and use it in GitHub Desktop.
HEVC Test Pattern to UDP Multicast
@echo off
:: Set duration in seconds
set duration=10
:: Temporary loop TS file to create
set loopfile=loop.mkv
:: Target mpegts URL (ESCAPE &s with ^!!! and add double quotes)
:: see https://www.ffmpeg.org/ffmpeg-protocols.html#udp for full syntax
set "target=udp://239.0.0.1:1234?ttl=13^&pkt_size=1316"
echo %target%
::exit
:: Create the loop file
if not exist %loopfile% (
ffmpeg.exe ^
-f lavfi -i "smptehdbars=duration=%duration%:size=1280x720:rate=60000/1001" ^
-f lavfi -i "sine=frequency=220:beep_factor=5:sample_rate=48000:duration=%duration%" ^
-c:v libx265 -x265-params bframes=0 -b:v 100k -preset slow ^
-force_key_frames "expr:gte(t,n_forced*3)" ^
-c:a aac -b:a 16k ^
-y ^
%loopfile%
)
:: Play it
ffmpeg.exe ^
-threads 2 ^
-re -fflags +genpts -stream_loop -1 ^
-i %loopfile% -vcodec copy -acodec copy ^
-f mpegts %target%
:: Various options for encoding I tried
:: -c:v libx265 -b:v 50k -x265-params keyint=100:no-open-gop -preset slow ^
:: -c:v libx265 -x265-params bframes=0 -b:v 100k -preset slow ^
:: -f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=%duration%" ^
:: -c:v libx265 -x265-params bframes=0 -b:v 100k -preset slow ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment