[FFmpeg-user] ffmpeg drops frames when decoding corrupted H264 bitstream

Michael Niedermayer michaelni at gmx.at
Wed Jan 2 18:59:12 CET 2013


On Wed, Jan 02, 2013 at 10:29:30AM +0100, Jernej Trnkoczy wrote:
> Hi Carl,
> The original (not corrupted) sample file can be found here -
> http://dl.dropbox.com/u/12694214/ballroom_0.h264 . I investigated the
> bitstream - thre results are here:
> http://dl.dropbox.com/u/12694214/ballroom_0_parsedNALs.txt . If I decode
> this file with ffmpeg command "ffmpeg -f h264 -i ./ballroom_0.h264
> ./ballroom_0_decoded.yuv" I get uncompressed .yuv file with 250 frames.
> 
> Then I delete the 6th, 18th, 30th and last NAL unit (three B-frame-NALs and
> one P-frame-NAL) from the original .h264 file and get the corrupted file
> which can be found here -
> http://dl.dropbox.com/u/12694214/ballroom_0-corrupted.h264. The analysis of
> the bitstream shows that these four NALs are indeed missing -
> http://dl.dropbox.com/u/12694214/ballroom_0-corrupted_parsedNALs.txt . If I
> decode this corrupted file with ffmpeg command "ffmpeg -f h264 -i
> ./ballroom_0-corrupted.h264 ./ballroom_0-corrupted_decoded.yuv" I get
> uncompressed .yuv file with 246 frames. The frames that correspond to
> individual missing NAL units were obviously dropped. The console output
> does not report any errors:
> 
> jernejt at jernejt-ThinkStation-E30:~/Poizkusi/AVCkodiranjeZffmpeg$ ffmpeg -f
> h264 -i ./ballroom_0-corrupted.h264
> ./ballroom_0-corrupted_decoded.yuvffmpeg version git-2012-12-27-b3f3fe3
> Copyright (c) 2000-2012 the FFmpeg developers
>   built on Dec 27 2012 14:15:25 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>   configuration: --enable-gpl --enable-libass --enable-libfaac
> --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb
> --enable-libopencore-amrwb --enable-librtmp --enable-libtheora
> --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264
> --enable-nonfree --enable-version3
>   libavutil      52. 12.100 / 52. 12.100
>   libavcodec     54. 81.100 / 54. 81.100
>   libavformat    54. 50.102 / 54. 50.102
>   libavdevice    54.  3.102 / 54.  3.102
>   libavfilter     3. 30.101 /  3. 30.101
>   libswscale      2.  1.103 /  2.  1.103
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  2.100 / 52.  2.100
> [h264 @ 0xaf39fe0] max_analyze_duration 5000000 reached at 5000000
> [h264 @ 0xaf39fe0] Estimating duration from bitrate, this may be inaccurate
> Input #0, h264, from './ballroom_0-corrupted.h264':
>   Duration: N/A, bitrate: N/A
>     Stream #0:0: Video: h264 (High), yuv420p, 640x480, 25 fps, 25 tbr,
> 1200k tbn, 50 tbc
> Output #0, rawvideo, to './ballroom_0-corrupted_decoded.yuv':
>   Metadata:
>     encoder         : Lavf54.50.102
>     Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480,
> q=2-31, 200 kb/s, 90k tbn, 25 tbc
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 -> rawvideo)
> Press [q] to stop, [?] for help
> frame=  221 fps=0.0 q=0.0 size=   99450kB time=00:00:08.84
> bitrate=92160.0kbits/frame=  246 fps=0.0 q=0.0 Lsize=  110700kB
> time=00:00:09.84 bitrate=92160.0kbits/s
> video:110700kB audio:0kB subtitle:0 global headers:0kB muxing overhead
> 0.000000%
> jernejt at jernejt-ThinkStation-E30:~/Poizkusi/AVCkodiranjeZffmpeg$
> 
> 
> 
> I think that normally decoder should conceal the missing frames - but
> ffmpeg just drops them. Can you please help with this issue!

you can use -vf fps or -vsync X to duplicate the previous frame
if you need constant fps output, this requires of course that your
input contains sufficient information for such gaps to be detected.

If you want to implement some motion based frame interpolation
instead of the pure duplicationm that would be welcome btw!

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20130102/c308a104/attachment.asc>


More information about the ffmpeg-user mailing list