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

Jernej Trnkoczy jernej.trnko at gmail.com
Fri Dec 28 14:07:30 CET 2012


I am decoding a corrupted H.264 bitstream with ffmpeg. There are some NAL
units missing in this bitstream. I need to get the same number of frames in
the output (decoded) .yuv file in both cases: 1) when the bitstream is
corrupted and 2) when the bitstream is not corrupted. By decoding with
"ffmpeg -f h264 -i ./ballroom_corrupted.h264 ./ballroom_corrupted.yuv"
command this is not the case - the frames contained in the missing NAL
units are not written to output .yuv file.

The H.264 bitstream file was encoded so that each frame is represented by
one NAL unit. When I decode the bitstream the frames associated with the
missing NAL units are dropped by ffmpeg (and are not concealed and included
into output .yuv file as one might expect).  Is there an option (argument)
that can be set as to include the missing/dropped frames into the output
ballroom_corrupted.yuv file?

I assume that ffmpeg does conceal the missing NALunits/frames since B
frames that depend on these missing frames (through inter-prediction) are
decoded and included into output .yuv file (checked that). So decoder must
have some concealed picture of missing frame(s) and uses it to predict
other frames that depend on them. Why is this concealed picture not
included into the output .yuv file and how can I solve this?


More information about the ffmpeg-user mailing list