I use the Intel Media SDK to encode an h264 file. I then want to wrap the data into an MOV. To do this I have to parse the stream and extract the PPS and SPS informations.
I already have an algorithm that can do that.
I tried to use this algorithm with the file generated with your SDK but it doesn't work. The reason is because we expect the encoded stream to use the Byte strem NAL unit syntax. (see ITU-TAdvance video coding for generic audiovisual services specification Annex B).
It looks like the Intel Media SDK encoder is using the Byte stream syntax.
Is there any option to generate an h264 file using the Byte strean NAL unit syntax?
The output of the Intel Media SDK encoder is compliant with the Annex B syntax. Its possible the parsing algorithm you are using is not able to properly parse 3-byte start codes of elementary stream (and assuming 4-byte) that is common in 'muxed' streams.
Adding this tho the stream would be the (optional) role of the muxer.
I was hoping that the Intel Media SDK had an option to specify the value of the start code (3-byte or 4-bytes). I will do some modifications to my algorithm to parse 00 00 01 or 00 00 00 01 according to annex B.
There is no need to implement your own SPS/PPS extraction algorithm. Media SDK has support for SPS/PPS extraction after encode Init using the mfxExtCodingOptionSPSPPS extended buffer. Chapter 4.14 in the Media SDK Developers Guide provides details on how to do this.
If you need to make adjustments to SPS/PPS coding scheme or items after extracting the data then you will have to make these adjustments manually.
I discover that my problem is more complicated than extract PPS and SPS. To wrap the compressed data into a MOV, I need to extract the PPS SPS and put the length of each NAL before the data (see spec ISO/IEC 14496-15 5.2.3). The length field can be configured to be 1,2, or 4 bytes but no 3 bytes. What wrapper are able to do is parsing all the compressed data and replaced the 0x 00 00 00 01 field by the size of the NAL unit.
Is there any option to generate h264 stream with 4-bytes start code instead of 3? This can be really useful for developers who wrap their stream in an MOV otherwise the compressed stream need to be rework to have 4-bytes header.
We have no current plans for changing the NAL structure. From your description it seems quite straightforward to search for NALs starts then modify them for you needs.
I suspect that some existing 3rd party muxing packages (such as FFmpeg) that support MOV, and these may also support the required NAL adjustments?