0

I have an IP surveillance camera that is oriented vertically (corridor mode) and the camera has been configured for this orientation. When I decode the SPS within the SDP response it shows the frame size correctly as a width of 1080 and height of 1920. My software reads in the RTSP/RTP video stream then feeds it to the Microsoft H.264 MFT decoder and displays it through DX9. My software works great with normal horizontal video feeds but when I try it with vertical cameras the display is corrupted. Here's a screen shot of what it looks like. One possibility is that I need to rotate the frame but it seems that having the camera settings already done and the frame sizes in the SPS format seem to confirm this. Plus when I view the video in the camera's web interface and VLC it displays correctly. Does anyone have any idea why this happens and how I can correct it? Thank you.

enter image description here

Gary G.
  • 318
  • 3
  • 12

1 Answers1

1

The effect is specific to width of the video, not to the orientation exactly. Frame buffers might be effectively larger (wider) than the frames and you are supposedly ignoring this at some step of your processing. The video is 1080 pixels wide and video buffers, per alignment requirements of the video hardware, might be e.g. 1152 or 1536 pixels wide. You are supposed to copy the data taking such alignment into consideration, row by row, into left top corner of the larger buffer.

The question does not have code or detail to guess where the problem takes place exactly. It might be a step that uploads data to a texture, for example. DirectX 9 and other versions, DirectShow, Media Foundation - all APIs this or another way support the concept of the extended strides since this is a typical layout requirements for data in video memory (also for SIMD processing).

FYI a few other questions with a similar effect discussed:

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • I found that the stride to the destination surface was incorrect. Not sure why yet. Thank you Roman for guiding me in the right direction! – Gary G. Apr 28 '18 at 04:49