[FFmpeg-user] problem using FFMPEG -ss to extract segment of h264 video

Lou lou at lrcd.com
Wed Nov 2 19:57:17 CET 2011


On Wed, 2 Nov 2011 09:45:39 -0500
Hongfeng Wang <Hongfeng at Mesa-Engr.com> wrote:

> Hi, guys:
> 
> I got a 10min video is generated by DM368-DVSDK4.02's encode program.
> The 264 file could be played by Ubuntu movie player.
> 
> If I convert the whole clip to mp4 using ffmpeg, it works without any
> problem. But if I try to extract a fraction of the video, it always
> run into "missing picture in access unit" problem, and only generates
> a 1 second clip, which is the end of whole video.
> 
> ffmpeg -r 20.2 -ss 300 -i 20111101_153000.264 -t 10 -vcodec copy
> 201101153500.mp4
> 
> FFmpeg version SVN-r0.5.4-4:0.5.4-1, Copyright (c) 2000-2009 Fabrice
> Bellard, et al. configuration: --extra-version=4:0.5.4-1
> --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau
> --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg
> --enable-libschroedinger --enable-libspeex --enable-libtheora
> --enable-libvorbis --enable-pthreads --enable-zlib
> --disable-stripping --disable-vhook --enable-runtime-cpudetect
> --extra-cflags=-marm -fPIC -DPIC --enable-gpl --enable-postproc
> --enable-swscale --enable-x11grab --enable-libfaad --enable-libdc1394
> --enable-shared --disable-static libavutil     49.15. 0 / 49.15. 0
> libavcodec    52.20. 1 / 52.20. 1 libavformat   52.31. 0 / 52.31. 0
> libavdevice   52. 1. 0 / 52. 1. 0 libavfilter    0. 4. 0 /  0. 4. 0
> libswscale     0. 7. 1 /  0. 7. 1 libpostproc   51. 2. 0 / 51. 2. 0
> built on Sep 18 2011 15:55:02, gcc: 4.4.5 [NULL @ 0x49170]missing
> picture in access unit
> 
> Seems stream 0 codec frame rate differs from container frame rate:
> 40.40 (202/5) -> 20.20 (202/10) Input #0, h264, from
> '20111101_153000.264': Duration: N/A, bitrate: N/A
>     Stream #0.0: Video: h264, yuv420p, 1920x1080, 20.20 tbr, 1200k
> tbn, 40.40 tbc Output #0, mp4, to '201101153500.mp4':
>     Stream #0.0: Video: 0x0000, yuv420p, 1920x1080, q=2-31, 90k tbn,
> 20.20 tbc Stream mapping:
>   Stream #0.0 -> #0.0
> Press [q] to stop encoding
> [NULL @ 0x49170]missing picture in access unit
> frame=   20 fps=  0 q=-1.0 Lsize=     280kB time=0.99
> bitrate=2313.3kbits/s video:279kB audio:0kB global headers:0kB muxing
> overhead 0.314991%
> 
> 
> the FFMPEG I used is FFmpeg version SVN-r0.5.4-4:0.5.4-1 from Debain
> ARMEL packages. I also tried  FFMPEG0.7.2-4 on my Ubuntu machine,
> which has the same result. I tried different values for -ss option,
> from 5 to 300, all the same. The video has an IDR frame for every 20
> frames.
> 
> Thanks!
> 
> Hongfeng Wang

Try moving -ss after -i 20111101_153000.264 so it is applied as an
output option. This changes the behavior of -ss:

* -ss after -i will decode until your -ss value. This method is
  slower but is usually more accurate.

* -ss before -i will seek before decoding, but will potentially not be
  frame-accurate depending on your input formats(s).

Also, FFmpeg release 0.5 is quite old and is no longer supported by
FFmpeg.


More information about the ffmpeg-user mailing list