Page 1 of 1

What resize method is used when displaying stream

Posted: 04 Nov 2015 17:08
by badgeror
Hi
Following my play with libvlc_video_set_format_callbacks I was pretty happy with getting video size on first image with libvlc_video_get_size and using this as output
Well that works perfectly unless the source video received (from an RTSP camera) is not 16 pixels aligned... So here's my case:
I've got a 1080x1920 video incoming
format callback gives me a buffer 1088x1922
video_get_size returns 1080x1920

If I try to use the buffer as a 1080x1920 image then I've got a scrambled image, If I use the full buffer as image everything is fine except that my source video is 1080x1920 and I now have a 1088x1922 image to process... Taking a sub image crops image contents which appear to be resized to fit the buffer image size


Questions:
- What is going on internally for vlc to resize incoming image to this non standard resolution rather than zero padding to be 16 pixels aligned??
- How do you go back to 1080x1920 resolution having full image contents? Just as VLC client is doing.
- Are we forced to perform another CPU intensive resize?

Best regards

Sebastien Wybo

Re: What resize method is used when displaying stream

Posted: 04 Nov 2015 18:26
by Rémi Denis-Courmont
VLC pads the size to whatever the decoder requests. Some decoders want two lines of padding at the bottom and that's that.

Re: What resize method is used when displaying stream

Posted: 05 Nov 2015 09:09
by badgeror
Ok I get it but here I'm getting increased width as well and image is not padded but extended... I'd expect padding to be done with random/fixed contents not by extending the image. Am I missing something here?

The real question is how does VLC display the full image at the correct resolution? Is there a resize done?

Re: What resize method is used when displaying stream

Posted: 05 Nov 2015 11:27
by Rémi Denis-Courmont
VLC does not use the format callbacks. It uses proper video output plugins, as you would get if you provided a window handle to render to.

Re: What resize method is used when displaying stream

Posted: 05 Nov 2015 11:38
by badgeror
Ok I get that, but in my case I'm doing processing on the image received so I'm taking images straight out of the libvlc_video_set_callbacks mechanism
At that point a 1088x1922 image is generated with the scaled contents of the original 1080x1920 image
calling libvlc_video_get_size in the call back returns 1080x1920 (I'm using 2.2.2 here) as expected but the image contents are actually taking the full 1088x1922 pixels available in the buffers => a resize has been made or am I missing something?

I just want to know if this resize can be avoided and/or what reverse resize is performed to display the full image contents at 1080x1920 resolution that VLC GUI client displays eventually