Skip to content

Instantly share code, notes, and snippets.

@adrienjoly
Last active July 13, 2021 16:13
Show Gist options
  • Save adrienjoly/e5b2db9c9a61f454ed08f56c32999f17 to your computer and use it in GitHub Desktop.
Save adrienjoly/e5b2db9c9a61f454ed08f56c32999f17 to your computer and use it in GitHub Desktop.
# use this command to add 5-seconds delay to the audio track of a video
#
ffmpeg -i input.mp4 -itsoffset 5 -i input.mp4 -map 0:v -map 1:a -vcodec copy -acodec copy delayed.mp4
# successfully tested on mac os' bash terminal
# if needed, you can download ffmpeg from http://www.ffmpeg.org/download.html
#
ffmpeg -f concat -safe 0 -i <(for f in ./*.mp4; do echo "file '$PWD/$f'"; done) -c copy output.mp4
@adrienjoly
Copy link
Author

or

find *.mp4 | sed -e "s/.*/file '&'/" >vidlist.txt 
ffmpeg -f concat -safe 0 -i vidlist.txt -c copy complete.mp4

(source: https://stackoverflow.com/a/49373401/592254)

@adrienjoly
Copy link
Author

adrienjoly commented Jul 24, 2018

For reference, on video recordings of Chapelle des Lombards:

  1. extract the audio with ffmpeg -i harissa.mp4 -vn -acodec copy harissa.audio.aac, or in pcm/wave format (for audacity): ffmpeg -i harissa.mp4 harissa.audio.wav,
  2. sync & mix extracted audio with audio from secondary recorder, using audacity (cf Sync-Locked Track Groups - Time Stretching - Audacity Development Manual and Syncing two tracks: methods, features and suggestions - Audacity Forum)
  3. re-mux the exported audio mix with the video, with an audio delay of 0.1 seconds: ffmpeg -i harissa.mp4 -itsoffset 0.1 -i harissa.mix.m4a -c:v copy -map 0:v:0 -map 1:a:0 harissa.mix.mp4
  4. I split into one video per song using https://github.com/mifi/lossless-cut, or:
ffmpeg -i harissa.mix.mp4 \
-vcodec copy -acodec copy -ss 00:03:57.701 -to 00:10:13.932 harissa-01.mp4 \
-vcodec copy -acodec copy -ss 00:10:13.932 -to 00:15:19.000 harissa-02.mp4 \
-vcodec copy -acodec copy -ss 00:15:19.000 -to 00:19:44.697 harissa-03.mp4 \
-vcodec copy -acodec copy -ss 00:19:44.697 -to 00:28:54.213 harissa-04.mp4 \
-vcodec copy -acodec copy -ss 00:28:54.213 -to 00:35:08.469 harissa-05.mp4 \
-vcodec copy -acodec copy -ss 00:35:08.469 -to 00:41:45.105 harissa-06.mp4 \
-vcodec copy -acodec copy -ss 00:41:45.105 -to 00:52:06.713 harissa-07.mp4 \
-vcodec copy -acodec copy -ss 00:52:06.713 -to 00:59:31.303 harissa-08.mp4 \
-vcodec copy -acodec copy -ss 00:59:31.303 -to 01:07:07.241 harissa-09.mp4 \
-vcodec copy -acodec copy -ss 01:07:07.241 -to 01:15:44.531 harissa-10.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment