On 2/23/14 5:38 PM, Stanislav Smida wrote:
Hi everyone,

I believe the problem will be trivial for experienced lib users, but I’m 
desperate (I’ve never used ffmpeg before). I have raw H.264 bitstream (NALUs as 
(const void *)bytes) and I need to determine which NALU is access unit (first 
NALU of the next frame). Can someone give me a hint how to do that?

In <libavcodec/h264.h> I’ve found `H264Context` struct and its fields like 
`got_first` and `ref_count[]` but I don’t have an idea how to initialize this context 
and flow particular NALUs through this context.

Thanks, best,
Stano

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

The answer depends on the bitstream that you have, but as far as I can tell, you likely have a bitstream that ships frames in one of two ways. Those ways are outlined here:
http://en.wikipedia.org/wiki/Network_Abstraction_Layer#Access_Units
This section and the section right after should help you figure out

The second section might be a little obtuse at the moment, but what it describes is that (I think), if you find an IDR nalu, the decoder should be able to use the whole nalu for decoding one picture, and that subsequent i-frames will not refer to i-frames prior to the idr in front of them, as in (I think), one picture gets shipped as (idr)(non-idr)(non-idr)(non-idr) ... (idr) <-this begins a new whole picture. For one complete self-contained frame, you may obviously need the sps and pps. So far, IDR, non IDR, and the units listed in the first section of the wiki link area all nalu types, refer to any google search for the values, or go download the spec.

--
Joshua Kordani
LSA Autonomy

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to