Skip to content

Instantly share code, notes, and snippets.

@antonva
Created June 19, 2015 22:16
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 antonva/df7d9f114c7d8346487a to your computer and use it in GitHub Desktop.
Save antonva/df7d9f114c7d8346487a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
FPS=30 # Stream FPS.
GOP=48 # GOP Should be double of FPS.
THREADS=4 # How many threads.
DEADLINE=realtime # Speed preset, realtime is fastest.
FRAMELAG=16 # How many frames to seek ahead (max 25)
QMAX=52 #
QMIN=10 # Less = more quality.
VBITRATE=1M # Target Bitrate.
BITRATE=1000k # Bitrate.
AUDIBR=48k # Audio Bitrate.
SERVER=162.243.108.188:8090/feed1.ffm # Server stream endpoint.
LOGLEVEL=48 # Logging verbosity level.
#SOUNDTRACK=0 # using 0 as default sound track
#SUBTITLE=0 # Using 0 as default subtitle track
for f in "$@"
do
#INFO_STRING=$(ffmpeg -i "$OPTARG" 2>/dev/null | grep -A2 Stream | tr '\n' '|' | sed "s/Stream/\\`echo -e '\n\Stream'`/g")
#readarray -s 1 -t STREAMS <<< "$INFO_STRING"
ffmpeg -re -i "$f"\
-metadata TITLE="$f"\
-g $GOP -loglevel $LOGLEVEL\
-c:v libvpx -threads $THREADS -b:v $BITRATE -vb $VBITRATE -bufsize $BITRATE\
-qmax $QMAX -qmin $QMIN -deadline $DEADLINE -lag-in-frames $FRAMELAG\
-c:a libvorbis -b:a $AUDIBR -ar 22k\
"http://$SERVER"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment