Skip to content

Instantly share code, notes, and snippets.

@mpujari
Created January 28, 2016 13:39
Show Gist options
  • Save mpujari/cf0407fd021a327fdad1 to your computer and use it in GitHub Desktop.
Save mpujari/cf0407fd021a327fdad1 to your computer and use it in GitHub Desktop.
Merging 2 or more mp4 files into merged mp4 format (inputs from avconv, we can't merge mp4 directly, we need to intermediatly convert each into mpeg and then merge them back to mp4).
-i specifies input file
-ss position to start from
-t duration
avconv -ss 00:00:10.000 -i TomAndJerry1950.mp4 -t 00:00:10.000 -vcodec libx264 -acodec aac -f mpegts -bsf h264_mp4toannexb -qscale 1 -strict experimental -y file1.ts
avconv -ss 00:00:10.000 -i LaurelAndHardy.mp4 -t 00:00:10.000 -vcodec libx264 -acodec aac -f mpegts -bsf h264_mp4toannexb -qscale 1 -strict experimental -y file2.ts
avconv -i concat:"file1.ts|file2.ts" -c copy -bsf:a aac_adtstoasc -y full.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment