In the docs for ffmpeg concat it states:
Using intermediate files
If you have MP4 files, these could be losslessly concatenated by first transcoding them to MPEG-2 transport streams. With H.264 video and AAC audio, the following can be used:
ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
When I try this for lossless copy, the first frame of input2 freezes for time enough to notice. If I check it with ffprobe, it shows the first frame pts time, at the merge point has suddenly gone to twice as long as it should be causing the stutter there.
Is this a bug or am I doing or understanding it wrong?
+ Reply to Thread
Results 1 to 2 of 2
This may put you on the right track. I'm not sure.
My mp4 videos come out of my camera.
So I wrote a little batch file to concatenate them.
for %%a in (*.mp4) do echo file '%%a' >> list.txt ffmpeg -safe 0 -f concat -i list.txt -vcodec copy -acodec copy OutputVideo.mp4 del list.txt
Alter one of the parameters and I have to convert all videos to a ts first. So I don't.
Maybe the video stream and audio stream of one of the ts files are of different lengths.
MediaInfo might pick this up.