Created
March 27, 2017 12:59
-
-
Save voor/b274f8f3043f42a0e4fb1a3a57f04c96 to your computer and use it in GitHub Desktop.
Over the weekend I wanted to add a silly Noooo from Darth Vader in the prequels to a clip from Rogue One. I couldn't find any good tutorials on how to do it, so I figured it out for myself.
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
#!/usr/bin/env sh | |
# Extract audio from the Video File into a file. | |
ffmpeg -i video.mp4 -map 0 -vn -acodec -copy video_audio.m4a | |
# Create 11 seconds of silence | |
ffmpeg -f lavfi -i aevalsrc=0:0::duration=11 -ab 320k silence.mp3 | |
# Prepend the silence to the audio track you downloaded | |
ffmpeg -i concat:"silence.mp3|commentary_audio.mp3" -codec copy silence_commentary_audio.mp3 | |
# Merge the commentary track with the video_audio into a single file | |
ffmpeg -i silence_commentary_audio.mp3 -i video_audio.m4a -filter_complex amerge -ac 2 -c:a libfdk_aac -vbr 4 merged_audio.m4a | |
# REPLACE the original audio with the newly merged audio | |
ffmpeg -i video.mp4 -i merged_audio.m4a -map 0:v -map 1:a -c copy -shortest new_video.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment