[Libav-user] Yet another question about decoding h264

Joshua Kordani jkordani at lsa2.com
Tue Mar 4 00:50:44 CET 2014


All,

I have h264 nalus in memory.  I can successfully make h264 annex b files 
playable with ffplay.  I want to now decode them and work with the 
frames.  All the example code I've found involves standing up the proper 
datastructures starting with the container format of an input file 
(ffplay, or demuxing_decoding.c in examples), but I'll need to stand up 
the decoder by hand.

I've reviewed the avcodec.c in doc/examples and notice that if using the 
h264 output type in this program that decoding the test video and 
writing it to disk is skipped.  After modifying the code to setup the 
decoder as an h264 decoder instead of the mpeg1video, and calling the 
decode function, the decoder step fails with the following output on the 
console:

Decode video file test.h264 to test%02d.pgm
[h264 @ 0x7fd22ab5ba00] Missing reference picture, default is 0
[h264 @ 0x7fd22ab5ba00] decode_slice_header error
[h264 @ 0x7fd22ab5ba00] reference picture missing during reorder
[h264 @ 0x7fd22ab5ba00] Missing reference picture, default is 0
[h264 @ 0x7fd22ab5ba00] reference picture missing during reorder
[h264 @ 0x7fd22ab5ba00] Missing reference picture, default is 2
[h264 @ 0x7fd22ab5ba00] left block unavailable for requested intra mode 
at 0 13
[h264 @ 0x7fd22ab5ba00] error while decoding MB 0 13, bytestream (-4)
[h264 @ 0x7fd22ab5ba00] concealing 159 DC, 159 AC, 159 MV errors in P frame
[h264 @ 0x7fd22ab5ba00] reference picture missing during reorder
[h264 @ 0x7fd22ab5ba00] Missing reference picture, default is 65530
[h264 @ 0x7fd22ab5ba00] reference picture missing during reorder
[h264 @ 0x7fd22ab5ba00] Missing reference picture, default is 65532
[h264 @ 0x7fd22ab5ba00] Invalid mix of idr and non-idr slices
Error while decoding frame 0

Obviously, playing the generated .h264 file in ffplay works, and I 
imagine that decoding to h264 was left out for a reason.
I understand that I need to set up the decoder with the sps and pps nals 
before I can begin feeding it nals for the purposes of generating 
frames, but I only understand this conceptually.  I could use some 
pointers as to where I need to put the proper initialization data so 
that I can begin decoding.  Additionally, the doxygen for avcodec_open2 
suggests that a dictionary structure can be used to... pass in 
parameters (to the codec I guess?), but is also used to enumerate the 
list of parameters that were not found?? (what does this mean?)  Where 
can I find a list of parameters appropriate for the h264 codec, as 
something tells me this is what I would use to pass in the sps and pps nals?

I appreciate any pointers or documentation that would help me work out 
what to do, thanks!

-- 
Joshua Kordani
LSA Autonomy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140303/24740a83/attachment.html>


More information about the Libav-user mailing list