[MPlayer-users] cutting mp4 causes damaged files

Marc MERLIN marc_mplayer at merlins.org
Mon Sep 14 00:11:17 CEST 2015


On Sun, Sep 13, 2015 at 03:08:24PM -0700, Marc MERLIN wrote:
> 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?

Forgot to include info on a cut video:

MPlayer SVN-r37232 (C) 2000-2013 MPlayer Team
CPU vendor name: GenuineIntel  max cpuid level: 13
CPU: Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz (Family: 6, Model: 60, Stepping: 3)
extended cpuid-level: 8
extended cache-info: 16801856
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNowExt: 0 SSE: 1 SSE2: 1 SSE3: 1 SSSE3: 1 SSE4: 1 SSE4.2: 1 AVX: 1
Compiled with runtime CPU detection.
get_path('codecs.conf') -> '/home/merlin/.mplayer/codecs.conf'
Reading optional codecs config file /home/merlin/.mplayer/codecs.conf: No such file or directory
Reading optional codecs config file /etc/mplayer/codecs.conf: No such file or directory
Using built-in default codecs.conf.
init_freetype
Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
get_path('fonts') -> '/home/merlin/.mplayer/fonts'
Configuration: --prefix=/usr --confdir=/etc/mplayer --datadir=/usr/share/mplayer --enable-xmga --enable-mga --enable-joystick --enable-libopencore_amrnb --enable-libopencore_amrwb --disable-openal --disable-decoder=amrnb --language=all --enable-menu --disable-libdvdcss-internal --disable-dvdread-internal --enable-radio --enable-radio-capture --extra-libs=-ldl -lvorbisenc -lvorbis --enable-xvmc --with-xvmclib=XvMCW --enable-tdfxfb --enable-s3fb --enable-runtime-cpudetection --disable-gui
CommandLine: '-v' 'bm2015_f3_front.avi'
Using nanosleep() timing
get_path('input.conf') -> '/home/merlin/.mplayer/input.conf'
Reading optional input config file /home/merlin/.mplayer/input.conf: No such file or directory
Parsing input config file /etc/mplayer/input.conf
Input config file /etc/mplayer/input.conf parsed: 92 binds
Setting up LIRC support...
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
get_path('bm2015_f3_front.avi.conf') -> '/home/merlin/.mplayer/bm2015_f3_front.avi.conf'

Playing bm2015_f3_front.avi.
get_path('sub/') -> '/home/merlin/.mplayer/sub/'
[file] File size is 488664294 bytes
STREAM: [file] bm2015_f3_front.avi
STREAM: Description: File
STREAM: Author: Albeu
STREAM: Comment: based on the code from ??? (probably Arpi)
libavformat version 55.44.100 (internal)
Configuration: --enable-gpl --enable-postproc
LAVF_check: AVI (Audio Video Interleaved)
AVI file format detected.
list_end=0x192
======= AVI Header =======
us/frame: 33333  (fps=30.000)
max bytes/sec: 0
padding: 0
MainAVIHeader.dwFlags: (2320) HAS_INDEX IS_INTERLEAVED TRUST_CKTYPE
frames  total: 14434   initial: 0
streams: 2
Suggested BufferSize: 0
Size:  1920 x 1080
==========================
list_end=0x120
==> Found video stream: 0
[aviheader] Video stream found, -vid 0
====== STREAM Header =====
Type: vids   FCC: h264 (34363268)
Flags: 0
Priority: 0   Language: 0
InitialFrames: 0
Rate: 30/1 = 30.000
Start: 0   Len: 14434
Suggested BufferSize: 258128
Quality 0
Sample size: 0
==========================
Found 'bih', 40 bytes of 40
======= VIDEO Format ======
  biSize 40
  biWidth 1920
  biHeight 1080
  biPlanes 1
  biBitCount 24
  biCompression 875967080='h264'
  biSizeImage 6220800
===========================
======= Video Properties Header =======
Format: 0  VideoStandard: 0
VRefresh: 30  HTotal: 1920  VTotal: 1080
FrameAspect: 16:9  Framewidth: 1920  Frameheight: 1080
Fields: 1
  == Field 0 description ==
  CompressedBMHeight: 1080  CompressedBMWidth: 1920
  ValidBMHeight: 1080  ValidBMWidth: 1920
  ValidBMXOffset: 0  ValidBMYOffset: 0
  VideoXOffsetInT: 0  VideoYValidStartLine: 0
=======================================
list_end=0x192
==> Found audio stream: 1
[aviheader] Audio stream found, -aid 1
====== STREAM Header =====
Type: auds   FCC: U (55)
Flags: 0
Priority: 0   Language: 0
InitialFrames: 14
Rate: 32000/1152 = 27.778
Start: 4   Len: 13369
Suggested BufferSize: 1008
Quality 0
Sample size: 0
==========================
Found 'wf', 30 bytes of 18
======= WAVE Format =======
Format Tag: 85 (0x55)
Channels: 1
Samplerate: 32000
avg byte/sec: 14621
Block align: 1152
bits/sample: 0
cbSize: 12
mp3.wID=1
mp3.fdwFlags=0x2
mp3.nBlockSize=1152
mp3.nFramesPerBlock=1
mp3.nCodecDelay=0
==========================================================================
list_end=0x1BA
hdr=Software  size=20
Software  : MEncoder SVN-r37465
list_end=0x1D19A32E
Found movie at 0x100C - 0x1D19A32E
Reading INDEX block, 27803 chunks for 14434 frames (fpos=488219446).
AVI index offset: 0x1008 (movi=0x100C idx0=0x4 idx1=0x9C)
Auto-selected AVI audio ID = 1
Auto-selected AVI video ID = 0
AVI: Searching for audio stream (id:1)
AVI video size=480948881 (14434) audio size=7036776 (13369)
VIDEO:  [h264]  1920x1080  24bpp  30.000 fps  7996.9 kbps (976.2 kbyte/s)
Auto-selected AVI video ID = 0
Auto-selected AVI audio ID = 1
[V] filefmt:3  fourcc:0x34363268  size:1920x1080  fps:30.000  ftime:=0.0333
Clip info:
 Software: MEncoder SVN-r37465
Load subtitles in ./
get_path('sub/') -> '/home/merlin/.mplayer/sub/'
X11 opening display: :0.0
vo: X11 color mask:  FFFFFF  (R:FF0000 G:FF00 B:FF)
vo: X11 running at 2880x1620 with depth 24 and 32 bpp (":0.0" => local display)
[x11] Detected wm supports NetWM.
[x11] Detected wm supports FULLSCREEN state.
[x11] Detected wm supports ABOVE state.
[x11] Detected wm supports BELOW state.
[x11] Current fstype setting doesn't honour any X atoms
[gl] GLX chose visual with ID 0x9d
[gl] Running on OpenGL 'Mesa DRI Intel(R) Haswell Mobile ' by 'Intel Open Source Technology Center', version '3.0 Mesa 10.6.3'
[gl] Settings after autodetection: ati-hack = 0, force-pbo = 0, rectangle = 0, yuv = 4, ycbcr = 0
[gl] using extended formats. Use -vo gl:nomanyfmts if playback fails.
[gl] Using 0 as slice height (0 means image height).
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 55.68.100 (internal)
Configuration: --enable-gpl --enable-postproc
INFO: libavcodec init OK!
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Forced audio codec: mad
Opening audio decoder: [libmad] libmad mpeg audio decoder
dec_audio: Allocating 4096 bytes for input buffer.
dec_audio: Allocating 9216 + 131072 = 140288 bytes for output buffer.
AUDIO: 32000 Hz, 1 ch, s16le, 117.0 kbit/22.84% (ratio: 14620->64000)
Selected audio codec: [mad] afm: libmad (libMAD MPEG layer 1-2-3)
==========================================================================
Building audio filter chain for 32000Hz/1ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter dummy 
[dummy] Was reinitialized: 32000Hz/1ch/s16le
[dummy] Was reinitialized: 32000Hz/1ch/s16le
Trying preferred audio driver 'pulse', options '[none]'
AO: [pulse] 32000Hz 1ch s16le (2 bytes per sample)
AO: Description: PulseAudio audio output
AO: Author: Lennart Poettering
Building audio filter chain for 32000Hz/1ch/s16le -> 32000Hz/1ch/s16le...
[dummy] Was reinitialized: 32000Hz/1ch/s16le
[dummy] Was reinitialized: 32000Hz/1ch/s16le
Starting playback...
XXX initial  v_pts=0.000  a_pos=7560 (0.517) 
Increasing filtered audio buffer size from 0 to 17024
[VD_FFMPEG] Trying pixfmt=0.
[ffmpeg] aspect_ratio: 0.000000
[VD_FFMPEG] Trying pixfmt=0.
[ffmpeg] aspect_ratio: 0.000000
[h264 @ 0x559b406a7900]no picture 
[h264 @ 0x559b406a7900]no picture 
[ffmpeg] aspect_ratio: 1.777778
VDec: vo config request - 1920 x 1080 (preferred colorspace: Planar YV12)
Trying filter chain: vo
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO Config (1920x1080->1920x1080,flags=4,'MPlayer',0x32315659)
VO: [gl] 1920x1080 => 1920x1080 Planar YV12  [zoom]
VO: Description: OpenGL
VO: Author: Reimar Doeffinger <Reimar.Doeffinger at gmx.de>
[gl] GLX chose visual with ID 0x9d
[gl] Running on OpenGL 'Mesa DRI Intel(R) Haswell Mobile ' by 'Intel Open Source Technology Center', version '3.0 Mesa 10.6.3'
[gl] Settings after autodetection: ati-hack = 0, force-pbo = 0, rectangle = 0, yuv = 4, ycbcr = 0
[gl] Creating 2048x2048 texture...
[gl] Resize: 1920x1080
*** [vo] Exporting mp_image_t, 1920x1080x12bpp YUV planar, 3110400 bytes
Unicode font: 5347 glyphs.
Unicode font: 5347 glyphs.
Uninit audio filters...
[libaf] Removing filter dummy 
Uninit audio: libmad
Uninit video: ffmpeg
Drawn 32 frames, 0 using DR, DR refused 0

Marc
-- 
"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