I am new to H.264 and have a problem to implemnt slice coding... any idea how to do it, because so far i have only managed to implement coding for fixed number of macroblocks but i need fixed slice sizes... I think I have a problem making the slices independent of each other
Now in the case where I have filled up my last slice but have NOT compressed all MBs, I would just reset the output bitstream, increase the quant and re-encode the frame again (the rate control functionality does this already if the encoded frame is larger than it should be). Once I have encoded all MBs, I then return with several slices whose payload is no larger than the maximum I set.
Does this help? Any questions?
The first paragraph is exactly like I tried to do it ... i start encoding mb's and once limit is exceeded I remove the last mb from bitstream such that next time I can start encoding from the address of this mb.
For me the number of slices actually obtained is not a probelm, a frame can take as many slices as required so long as the individual slice size does not exceed my limit so I was not taking care of adjusting the quant so as to be able to fit in more mb's in the slice.
Using the method described above however the stream still does not decode, basically it manages to decode only the first frame and then an error occurs. I think I have a problem because the slices generated are not being independent of each other i.e. i think that intra coding continues from one slice to the next so long as the slices belong to the same frame and this is not something i want...
any suggestions why this may be so?
core_enc->m_pCurrentFrame->m_mbinfo.mbs[uMB].slice_id = slice_num;
If you do not set the slice id as I did above, the MBs will have the slice id that it should assuming fixed slices. I had similar problems when if I did not set the slice id. Hopefully that will fix your decoding issues.
"I would like to know how to split the video into different frames"
Maybe you can have some explanation on this. The encoder is encoding the video frame by frame.