I use FFMpeg's api to encode images to H.264 stream, the code is like this encode code. When I called the function avcodec_encode_video2
I got one AVPacket's data, then I saved it to file. I use several images to get several files for test.
Based on the startcode 00 00 00 01
or 00 00 01
, I found that the 1st and 2nd files' data both contain several H.264 NAL Uints. But start from the third file, I can't found the startcode. Like followed image.
I feel confused. Base on the FFMpeg's code I think one AVPacket's data should contain at least one NAL Uint, but the result is unexpected. Is that means one NAL Uint may be divided to two AVPackets' data? What's the relationship between AVPacket and H.264 NAL Uint?
00 00 00 01 41.....
........00 00 01 41
....00 00 01 41......
.......
After I tested, except the beginners, the following NAL all separated by 00 00 01, and NAL type is same, too. So each AVPacket should include one NAL at least.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With