Blog / Using OBS Studio and ffmpeg to Record Games for YouTube
I bought a MacBook Pro with the M1 Pro chip in November and discovered that my existing Elgato Game Capture HD60 S didn’t work. In order to keep posting videos to my YouTube channel I had to buy a (deep breath) Elgato Game Capture HD60 S+.
That was the easy part. The hard part was simplifying my workflow to make posting videos less arduous.
Previously I used Elgato’s Game Capture HD software to capture video from my Xbox. I ran the audio tracks through Audacity to lower the volume of the game audio and implement ducking so my quiet voice could be heard. Then I combined the new audio with the existing video using ffmpeg. Finally, the new file went through Handbrake for encoding. The manual process took ages.
I switched to OBS Studio as it was the only app that would recognize the capture device. Then I spent hours fine-tuning one ffmpeg command that would lower the game audio, perform ducking (here called sidechain), and compress the video for the web.
In an effort to save others this headache, here’s the command I use and all my OBS settings.
ffmpeg
How to read this command:
ffmpeg -y (overwrite existing file) -i not-clickable.mkv (input file is not-clickable.mkv) -filter_complex (use this complex filter) [0:a:1]asplit=2[sc][mix] (from file 0, audio track #1 (index 0 (my commentary)), split it into two... somethings. I'm not sure how this works, but it shows up in every sidechain example, so here you go. The [sc][mix] at the end means store the output in a variable named that.) ; (semicolons delimit commands) [0:a:0] volume=0.6,aformat=cl=stereo [gameaudio] (take file 0 audio track 0 (game audio) and reduce the volume to 60% and store it in the [gameaudio] variable, also it's a stereo track) [gameaudio][sc]sidechaincompress=threshold=0.005:ratio=8:knee=4,aformat=cl=stereo [compressed] (take the [gameaudio] variable and use the [sc] audio to sidechaincompress it. Also it's a stereo track. I have special threshold and ratio numbers because I speak very quietly. Store the result in a [compressed] variable) [compressed][mix]amerge [a] (merge compressed and mix (dunno why this is here, again, it shows up in all sidechaincompress examples) and merge them into audio variable [a]) -map "0:v:0" (take file 0's video track 0) -c:v libx264 -preset slow -crf 22 (use a high quality h264 encoding on it) -map "[a]" (add the audio variable [a]) -c:a aac (use audio in AAC format) -b:a 320k (at 320kbps quality) "youtube.mp4" (and save it to this file)
ffmpeg \
-y \
-i not-clickable.mkv \
-filter_complex "[0:a:1]asplit=2[sc][mix] ; [0:a:0] volume=0.6,aformat=cl=stereo [gameaudio] ; [gameaudio][sc]sidechaincompress=threshold=0.005:ratio=8:knee=4,aformat=cl=stereo [compressed]; [compressed][mix]amerge [a]" \
-map "0:v:0" \
-c:v libx264 -preset slow -crf 22 \
-map "[a]" \
-c:a aac \
-b:a 320k \
"youtube.mp4"