Last active
June 17, 2016 18:23
-
-
Save camwhite/09c58a5429e9871b92cfcbe5b0a8419d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INRES='1152x720' # For retina displays | |
OUTRES="1024x576" # Livecoding Output Resolution | |
FPS="15" # Frame per Seconds (Suggested 24, 25, 30 or 60) | |
THREADS="3" # Change this if you have a good CPU (Suggested 4 threads, Max 6 threads) | |
QUALITY="ultrafast" # ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo | |
CBR="800k" # Constant bitrate (CBR) Increase this to get a better pixel quality (1000k - 3000k for twitch) | |
GOP="30" # i-frame interval, should be double of FPS, | |
KEY_FRAME="2" # Livecoding says it MUST be 2, please do not change it unless you know what you are doing. | |
ffmpeg -loglevel 40 -thread_queue_size 2048 \ | |
-f avfoundation -framerate $FPS -video_size $INRES -i "1:none" \ | |
-thread_queue_size 2048 -f avfoundation -framerate 30 -video_size "320x240" -i "0:0" -r 10 \ | |
-i "doge.png" -filter_complex \ | |
"[0:v]scale=1024:576,setpts=PTS-STARTPTS[bg]; \ | |
[1:v]scale=-1:140,setpts=PTS-STARTPTS[fg]; \ | |
[bg][fg]overlay=W-w-10:10[bg2]; \ | |
[bg2][2:v]overlay=W-w-0:H-h-0,format=yuv420p[out]" \ | |
-aspect 16:9 -map "[out]" -map 1:a -vcodec libx264 -preset $QUALITY -tune fastdecode \ | |
-force_key_frames "expr:gte(t,n_forced*$KEY_FRAME)" -keyint_min $FPS -g $GOP -crf 27 -maxrate $CBR \ | |
-c:a libmp3lame -b:a 32k -ac 1 -ar 44100 -threads $THREADS -strict normal -bufsize $CBR \ | |
-f flv "rtmp://usmedia3.livecoding.tv:1935/livecodingtv/$API_KEY" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment