I split this (http://www.auby.no/files/video_tests/h264_720p_mp_3.1_3mbps_aac_shrinkage.mp4) video using mp4box command "MP4Box -split 1 shrinking.mp4" into slices of 1 second each. I have following questions:

I got different sizes of the video although I sliced it evenly at 1 second. Not sure how this happened?

When I try to dump the information about the video slice file, I get the below message with an error. Can someone please help me understand what it is, and how possibly I can modify the command above to get rid of it? This error occurs for every video slide generated. This error comes only on the sliced videos.

Thanks, /anil.

anilj@desk1:~/workspace/testprogs/shellscripts$ ffmpeg -i invideo/shrinking_01.mp4
ffmpeg version N-36083-g2501f93-xuggle-5.5 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun  3 2014 13:43:04 with gcc 4.6.4
  configuration: --prefix=/home/anilj/workspace/xugglehome --extra-version=xuggle-5.5 --extra-cflags=-I/home/anilj/workspace/xuggle-xuggler/build/native/x86_64-unknown-linux-gnu/captive/stage/home/anilj/workspace/xugglehome/include --extra-ldflags=-L/home/anilj/workspace/xuggle-xuggler/build/native/x86_64-unknown-linux-gnu/captive/stage/home/anilj/workspace/xugglehome/lib --disable-shared --enable-pic --enable-gpl --enable-nonfree --enable-libx264 --enable-version3 --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libvo-aacenc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-openssl --enable-zlib --enable-libvpx
  libavutil      51. 46.100 / 51. 46.100
  libavcodec     54. 14.101 / 54. 14.101
  libavformat    54.  3.100 / 54.  3.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 67.101 /  2. 67.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 10.100 /  0. 10.100
  libpostproc    52.  0.100 / 52.  0.100
[h264 @ 0x1ddeac0] Missing reference picture
[h264 @ 0x1ddeac0] decode_slice_header error
[h264 @ 0x1ddeac0] Missing reference picture
[h264 @ 0x1ddeac0] decode_slice_header error
[h264 @ 0x1ddeac0] Missing reference picture
[h264 @ 0x1ddeac0] decode_slice_header error
[h264 @ 0x1ddeac0] Missing reference picture
[h264 @ 0x1ddeac0] decode_slice_header error
[h264 @ 0x1ddeac0] concealing 3600 DC, 3600 AC, 3600 MV errors
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'invideo/shrinking_01.mp4':
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    creation_time   : 2014-06-19 20:21:02
  Duration: 00:00:00.90, start: 0.000000, bitrate: 38 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 30 kb/s, 29.96 fps, 29.96 tbr, 29956 tbn, 59.92 tbc
      creation_time   : 2011-05-05 18:09:35
      handler_name    : ?Apple Video Media Handler
At least one output file must be specified

I am not familiar with the use of MP4Box but I can explain a little of what is going on behind the scenes.

In order to decode video, you first need an entry point, a picture to reference if you will. This reference picture is built by Intra-referencing so it is independent of the other frames. Other frames will reference this frame and other previously built frames in order to be recreated at the time of decoding. It is worth noting that these pictures may sometimes not share the same location in the coding order as they do in the presentation order.

Okay, you are telling me that you wanted videos of 1 second long but I say unless there are I-frames at least at every second marker then this is not possible. Well, it is possible but it is like me saying I can cook without concern over whether my food is edible. You may have cut at one second intervals but the video is not decode-able until it hits a reference frame.

Solutions: ffmpeg has a segmenter that can do this for you but the results will not be perfectly 1 second long (This is imperfect as it cannot truly handle certain coding order/pts issues, a small portion of cases). What happens when a frame in the coding order occurs is behind the stopping I-frame (start of next segment) but in front of it in the presentation order? The same thing that you are seeing at the start of your video except at the end.

You could decode to a raw format and then slice. You could do a lot of juggling with I-Frame detection and buffered cutting (fun).

There are a lot of ways to do this and depending on memory/computation limitations you'll get to pick your flavor.

I hope this explains the errors you are seeing and provides possible solutions for you.

  • Since I am using MP4Box, I would like to stick to the MP4Box command line options. However, what ffmpeg command should I be using to achieve same segmentation? I am fine with not so close 1 sec segments. Do you think I am missing anything on MP4Box? Anyone knows about it? – AnilJ Jun 25 '14 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.