ffmpeg split makes long file when not starting from beginning

1

Attempting to use ffmpeg to split a very long mp4.

ffmpeg -ss 00:00:00 -t 00:30:00 -i WorkingSession.mp4 -acodec copy -vcodec copy  WorkingSessionPart1.mp4

This provides about 89MB

Next I try this, notice the intentional time overlap

ffmpeg -ss 00:29:00 -t 00:30:00 -i WorkingSession.mp4 -acodec copy -vcodec copy  WorkingSessionPart2.mp4

This provides about 163MB even though it should just be the last minute of the previous half hour mp4

The clue I get is at the start, of the 2nd one I get:

[mp4 @ 0xf48fc0] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0xf48fc0] Codec for stream 1 does not use global headers but container format requires global headers

How do I bypass this, so as to split my mp4.

I have tried both -flags global_header, and -shortest:

ffmpeg -flags global_header -ss 00:29:00 -t 00:30:00 -i WorkingSession.mp4 -acodec copy -vcodec copy -shortest WorkingSessionPart2.mp4

but I still get the same error, and the much too long mp4 output file

Any suggestions?

John Diller

Posted 2018-02-16T19:26:02.320

Reputation: 11

Question was closed 2018-02-16T21:00:15.243

A common question. Cut on keyframes or re-encode by removing -acodec copy -vcodec copy. – llogan – 2018-02-16T20:59:01.410

Thank you. It took a while for me to see why the older question answered this one, but I'm good. Apparently I needed to use -ss twice, while the -t specified duration, hence the 2nd MP4 is something like. ffmpeg -ss 00:29:00 -t 00:30:00 -i WorkingSession.mp4 -acodec copy -vcodec copy -ss 00:29:00 WorkingSessionPart2.mp4 – John Diller – 2018-02-16T21:32:47.030

No answers