Question

I get h264 stream from an ip camera using RTSP protocol. I parse h264 seq_parameter_data based on the answer [http://stackoverflow.com/questions/6394874/fetching-the-dimensions-of-a-h264video-stream], and for some ip cameras, the height value is exactly 8 pixels bigger than the real height.

Why it may happen? And how to fix it?

PS: In my search, i found that... Maybe this might be my problem.

"MPEG2 and MPEG4 require frame sizes to be multiples of 16 pixels because macroblocks are 16x16 pixels" Every MPEG2 video ever encoded as 1080 actually has 1088 lines encoded because 1080 is not evenly divided by 16. The industry standard is to set the last 8 lines of the frame to black. Then, the display device is expected to throw away the last 8 pixels and not display them" Answer 6

Was it helpful?

Solution

The frame height is likely to be indicated by amount of 16 px blocks (e.g. 1088 pixels) + frame_crop_*_offset values adjust it to correct height (e.g. 1080 pixels). And you are missing the cropping.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top