What resize method is used when displaying stream

This forum is about all development around libVLC.
badgeror
Blank Cone
Blank Cone
Posts: 22
Joined: 15 Oct 2014 15:31
Operating System: Windows
Location: Sophia-Antipolis - FRANCE

What resize method is used when displaying stream

Postby badgeror » 04 Nov 2015 17:08

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

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: What resize method is used when displaying stream

Postby Rémi Denis-Courmont » 04 Nov 2015 18:26

VLC pads the size to whatever the decoder requests. Some decoders want two lines of padding at the bottom and that's that.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

badgeror
Blank Cone
Blank Cone
Posts: 22
Joined: 15 Oct 2014 15:31
Operating System: Windows
Location: Sophia-Antipolis - FRANCE

Re: What resize method is used when displaying stream

Postby badgeror » 05 Nov 2015 09:09

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?

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: What resize method is used when displaying stream

Postby Rémi Denis-Courmont » 05 Nov 2015 11:27

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.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

badgeror
Blank Cone
Blank Cone
Posts: 22
Joined: 15 Oct 2014 15:31
Operating System: Windows
Location: Sophia-Antipolis - FRANCE

Re: What resize method is used when displaying stream

Postby badgeror » 05 Nov 2015 11:38

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


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 10 guests