Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krokodilerian/abb8209d666edb54eaebb73ebd3ef13a to your computer and use it in GitHub Desktop.
Save krokodilerian/abb8209d666edb54eaebb73ebd3ef13a to your computer and use it in GitHub Desktop.
#!/bin/sh
confdir="`dirname "$0"`/../"
. $confdir/default-config.sh
if [ -f $confdir/config.sh ]; then
. $confdir/config.sh
fi
# should come from config
URL=udp://227.0.0.2:9000
#tunables
#10sec timeout on reading, 8m buffer for reading
URLPARAMS='?timeout=10000000&buffer_size=81921024&fifo_size=178481'
# note the setdar and setsar, these are needed if for some reason your
# input is not exactly 1280x720 and rescaling it fucks up the aspect
# or pixel dimensions.
ffmpeg -y -nostdin \
-i "${URL}${URLPARAMS}" \
-ac 2 \
-filter_complex "
[0:v] scale=$WIDTH:$HEIGHT,fps=$FRAMERATE,setdar=16/9,setsar=1 [v] ;
[0:a] aresample=$AUDIORATE [a]
" \
-map "[v]" -map "[a]" \
-pix_fmt yuv420p \
-c:v rawvideo \
-c:a pcm_s16le \
-f matroska \
tcp://localhost:10000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment