Skip to content

Instantly share code, notes, and snippets.

@rolandcrosby

rolandcrosby/ffmpeg.sh

Last active Oct 24, 2020
Embed
What would you like to do?
just so i have this next time i want to dub some audio with ffmpeg
# mix two audio streams together:
youtube-dl "https://www.youtube.com/watch?v=c38HJR-9vhU" -f best -o burnafterreading.mp4
youtube-dl "https://www.youtube.com/watch?v=Pqh63ca__mM" -f best -o chromatica.mp4
ffmpeg \
-ss 77.2 \ # skip first 77.2 seconds of first input
-i burnafterreading.mp4 \
-i chromatica.mp4 \
-filter_complex "[0:1][1:1] amix=inputs=2:weights=2 1" \ # mix track 1 (audio) of inputs 0 and 1, make audio 0 twice as loud as 1
-map 0:0 \ # use track 0 (video) from input 0
-c:a aac -strict -2 \ # don't think this is necessary, default encoder settings should be fine
-t 49 \ # trim output to 49 seconds long
output.mp4
# replace audio:
ffmpeg -i input.mp4 -i input.wav -c:v copy -map 0:v:0 -map 1:a:0 output.mp4 -c:a aac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment