0

I want to decode an h.264 coded stream in an .mp4 container and in order to to that I have to decontainerize the elementary stream. The data I posess now is the one retrieved with AVCodecContext:

extradata 0x16125e0 "\001M@\037\377" extradata_size 35

How should I interpret these parameter in order to get the elementary stream and which function should I use in order to read from the stream (where is the stream stored in the structure?)?

1 Answers1

0

The stream isn’t sorted in the structure, it’s still on the disk. You and read the stream by calling av_read_packet. The extra data format is documented here: Possible Locations for Sequence/Picture Parameter Set(s) for H.264 Stream

szatmary
  • 29,969
  • 8
  • 44
  • 57
  • Thank you! I understand that the extradata is AVCC data. But is this related (the number 35 in the extradata_size) to the first NALU or to the entire stream? Should I use AVCodec Parser parse_nal_units for this? You mean av_read_frame instead of av_read_packet which is deprecated? –  Aug 17 '19 at 08:49
  • 35 is the size of the extradata. It’s 35 bytes. – szatmary Aug 17 '19 at 10:05