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?
Thank you
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 2 of 2
Thread
-
-
This may put you on the right track. I'm not sure.
My mp4 videos come out of my camera.
Same:
DAR
PAR
Video bitrate
FPS
Audio bitrate
etc.
So I wrote a little batch file to concatenate them.
Code: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.
Cheers.
Similar Threads
-
please help me to encode a conCAT of mp4 input files?
By marcorocchini in forum Newbie / General discussionsReplies: 4Last Post: 29th May 2019, 03:10 -
FFMPEG why I cannot -f concat this 2 video files?
By marcorocchini in forum Newbie / General discussionsReplies: 38Last Post: 3rd Aug 2017, 15:48 -
FFMPEG -F Concat Video, Audio Sync Issue
By Shohag_ifas in forum EditingReplies: 2Last Post: 30th Nov 2016, 01:31 -
ffmpeg trim + concat = Non-monotonous DTS errors
By TorBru in forum Video ConversionReplies: 9Last Post: 27th Dec 2015, 05:33