Opened 2 weeks ago

Last modified 2 weeks ago

#7651 new defect

Corrupted start of mp4 file after "-ss 0 -to XXX -c copy"

Reported by: v0lt Owned by:
Priority: important Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
The beginning of the file is corrupted when copying data, even if "-ss 0" is specified. Any other value for "-ss" (indicating a keyframe, of course) can also give a problem.
It looks like #7644, but this is a bug.

How to reproduce:
ffmpeg version N-92868-g51b356eef8
I run the following commands.

ffplay "movie.mp4"
ffmpeg -hide_banner -i "movie.mp4" -ss 0.000 -to 603.480 -c copy "movie.1.mp4"
ffplay "movie.1.mp4"

"movie.mp4" plays without errors.
"movie.1.mp4" play with an error at the beginning of the playback.

[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000459900] Could not find codec parameters for
 stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720, 417 kb/s): unspecifi
ed pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options

MPC-HC and MPC-BE players have a black screen at the start of playback.


Change History (1)

comment:1 Changed 2 weeks ago by v0lt

Here is an example with a non-zero keyed keyframe.

ffmpeg -i "movie.mp4" -ss 603.480 -to 1207.840 -c copy "movie.2.mp4"
ffplay "movie.2.mp4"

I also noticed that frame 603.480 is in both files (movie.1.mp4 and movie.2.mp4), although the previous frame with time 603.440 is a P-frame. IMHO, it should be the last frame for the movie.1.mp4. I moved the range to "-ss 0.000 -to 603.470", but it did not change anything.

Note: See TracTickets for help on using tickets.