Playing with H264 format.
Wondering how to construct video with desired SPS and PPS? Could be just sample, 1 frame or so? I hope I used the correct term.
Is there any lib for that? To create a video with desired SPS and PPS?
Below is the data from example video:
0x01 is the configurationVersion
0x42 is AVCProfileIndication
0x00 is profile_compatibility
0x1F is AVCLevelIndication
0xFF is 6bit reserved and 2bit lengthSizeMinusOne
0xE1 is 3bit reserved and 5bit numOfSequenceParameterSets
0x00 0x09 is the length of sps is 9 bytes.
So the content of SPS is the next 9 bytes: 67 42 00 1f e9 02 c1 2c 80
Next: 01 is numOfPictureParameterSets
0x00 and 0x04 are pps with a length of 4 bytes.
So the content of PPS is the next 4 bytes: 68 ce 06 f2
The SPS length is: 9
The content of the SPS is: 67 42 00 1f e9 02 c1 2c 80
----------
The PPS length is: 4
The content of the PPS is: 68 ce 06 f2
----------
My question is what will happen if I change/modify in the video file the SPS or PPS parameters? Will it still be valid? It seems there is no Checksums on those?
For example if I change length of SPS or PPS?
The SPS/PPS encode data that the decoder needs. It encode things like Resolution, compression methods, color data, etc. Things that are only needed once per video not once per frame. If you modify it, the decoder will not be able to decode the video properly, resulting in corrupt or no output.
Will it still be valid?
Well, that depends on your definition of "valid". If it still manages to conform to the specification, Yes maybe, but actually no. The odds of making random changes that conform are very low.
Even if it doesn't conform, many decoders will still try to decode the video. But it will likely fail.
Instead of making random changes, I suggest you obtain a copy of ISO-14496-10 and read it. You will then understand what your changes will actually do.