[MPlayer-users] cutting mp4 causes damaged files

Marc MERLIN marc_mplayer at merlins.org
Mon Sep 14 00:08:24 CEST 2015

I use this script to slice h264 files without re-encoding them:
mencoder -forceidx -oac copy -ovc copy -edl ${2:-cuts} "$1" -o "$1"_cut.avi \
|| mencoder -forceidx -oac pcm -ovc copy -edl ${2:-cuts} "$1" -o "$1"_pcm.avi

It works, except that the output cannot be read by ffmpeg and others:
[h264 @ 0x7f5b70c99820] non-existing PPS 0 referenced
[h264 @ 0x7f5b70c99820] non-existing PPS 0 referenced
[h264 @ 0x7f5b70c99820] decode_slice_header error
[h264 @ 0x7f5b70c99820] no frame!
[avi @ 0x7f5b706c5640] Could not find codec parameters for stream 0 (Video: h264 (h264 / 0x34363268), none, 1920x1080, 7899 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Assertion desc failed at libswscale/swscale_internal.h:658

Also, if I play it with mplayer, and seek, it's not able to rebuild the
image from a keyframe and I end up with about 8 seconds of overlayed video
on top of the pre-seek frame until the whole frame is finally rewritten.

Is there a better way to cut videos from the command line without
re-encoding, or the fact that I'm not re-encoding is exactly what's causing
my problems and there is no fix?

"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/  

More information about the MPlayer-users mailing list