[FFmpeg-devel] H.264: passing 2 fields at once to avcodec_decode_video() gives errors

Ivan Schreter schreter
Wed Apr 8 08:45:48 CEST 2009


Reinhard Nissl wrote:
> Hi,
> once again, I have some trouble using ffmpeg through xine-lib.
> When I pass field data in separate calls to
> avcodec_decode_video(), everything is fine. Some debug output shows:
> [...]
> When I pass almost (see below for details) the same data from
> above of two fields in a single call to avcodec_decode_video(),
> the output looks like that:
> [...]
> I wonder why I get a totally different behavior in the second
> case. As I only get a picture after passing two fields of the
> picture I do not see why it shouldn't work to pass both fields
> into a single call. And I don't think that the 0 byte issue
> matters as it yields the same NAL lengths.
If I understand you correctly, you are trying to stuff two H.264 field 
pictures in one buffer and pass it to the decoder.

AFAIK, H.264 still decoder doesn't support handling more than one 
picture (field or frame) in one call, as it doesn't process NAL AUD 
properly. Furthermore, NAL AUD might be missing completely, so in that 
case, one has to make quite complicated logic to detect start of the 
next picture. I was trying to implement that once, but then gave it up, 
since to my problem, there was another, cleaner solution. I don't think 
anybody else implemented it in the meantime. Unfortunately, I deleted 
the patch already, so I cannot send you my version as a starting point...

Effectively, you'd need to build a loop around the code in decoder 
function, detect the AUD (including the implicit ones), terminate NAL 
processing upon detecting the AUD, let the rest of the decoder function 
run and then restart processing with the remainder of the buffer.



More information about the ffmpeg-devel mailing list