-
Use the
h264_mp4toannexb
bitstream filter to convert the mp4s (video steam only) into the AnnexB bitstream formatffmpeg -i input1.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part1.ts # repeat for up to inputN
-
Concat the files using cat
cat part1.ts part2.ts > parts.ts
-
Remux the files into a complete mp4
ffmpeg -y -i parts.ts -acodec copy -absf aac_adtstoasc parts.mp4
Created
September 20, 2012 17:50
-
-
Save abeluck/3757344 to your computer and use it in GitHub Desktop.
Concat MP4 files using AnnexB bitstream format
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
#!/bin/sh | |
FFMPEG=../ffmpeg-all | |
$FFMPEG -y -i input1.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part1.ts | |
$FFMPEG -y -i input2.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part2.ts | |
cat part1.ts part2.ts > parts.ts | |
$FFMPEG -y -i parts.ts -acodec copy -absf aac_adtstoasc parts.mp4 |
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
#!/bin/sh | |
FFMPEG=../ffmpeg-all | |
$FFMPEG -y -i input1.mp4 -f mpeg input1.mpg | |
$FFMPEG -y -i input2.mp4 -f mpeg input2.mpg | |
cat input1.mpg input2.mpg > full.mpg | |
$FFMPEG -y -i full.mpg -b:v 1500k -s 720x480 -vcodec libx264 -acodec aac -ac 2 -b:a 96k -f mp4 -strict experimental output.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
with android I had to add a -vcodec copy flag to the final command so it would not try to convert codec "h264" to "libx264"
$FFMPEG -y -i parts.ts -vcodec copy -acodec copy -absf aac_adtstoasc parts.mp4
it works and its very fast!!!