Decode at same width and height that encoded video

This forum is about all development around libVLC.
jortola
New Cone
New Cone
Posts: 4
Joined: 29 Jul 2010 13:30

Decode at same width and height that encoded video

Postby jortola » 12 Aug 2010 16:21

Hi,
I've the following problem, when I open the media, and bind it to the player, I can't retrieve the media width and height values, so I can't get the same output as input. Is there any way to get this?
PD: I've tryed libvlc_video_get_size, but it's not working.
Thanks!

J.Ortola

Code: Select all

libvlc_instance_t* m_pVLCInstance; libvlc_media_player_t* m_pMediaPlayer; libvlc_media_t* m_pMedia; int w, h; ... m_pMedia = libvlc_media_new_path(m_pVLCInstance, pszMediaPathName); libvlc_media_player_set_media (m_pMediaPlayer, m_pMedia); libvlc_video_set_callbacks(m_pMediaPlayer, Lock, Unlock, Display, this); //libvlc_video_get_size(pMediaPlayer, 0, &w, &h); <-- Doesn't retrieve any value libvlc_video_set_format(m_pMediaPlayer, "RGBA", 640, 480, 640*4);

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

Re: Decode at same width and height that encoded video

Postby Rémi Denis-Courmont » 12 Aug 2010 18:12

It's a chicken and egg problem. You can't get the size until after the video track is initialized. And it's too late to use libvlc_set_format() then.

Currently, you need to implement your own video output plugin if you want to get the raw video frames.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

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

Re: Decode at same width and height that encoded video

Postby Rémi Denis-Courmont » 13 Aug 2010 16:56

...or to extend the LibVLC API.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

jortola
New Cone
New Cone
Posts: 4
Joined: 29 Jul 2010 13:30

Re: Decode at same width and height that encoded video

Postby jortola » 17 Aug 2010 15:29

How is this posible? (Extend vlc API)

xdenser
Blank Cone
Blank Cone
Posts: 23
Joined: 30 Aug 2010 23:39
Contact:

Re: Decode at same width and height that encoded video

Postby xdenser » 30 Aug 2010 23:46

I start video in two steps

1. I setup rendering to some small dummy buffer i.e. 10x10 pixels, i run it and call periodically libvlc_video_get_size until it returns 0 (success)
2. When I get size, I setup proper buffer and thats it.

d3x0r
Blank Cone
Blank Cone
Posts: 38
Joined: 01 Dec 2008 22:38

Re: Decode at same width and height that encoded video

Postby d3x0r » 16 Sep 2010 02:23

So, this is still an issue? Can't set the format after the play starts? Can't start the video paused? Can't make a media_list and get information? vlc is able to show information about videos in its playlist... Tried this libvlc_media_parse but that just hangs...

I used the event manager to hook to all known events, I get a libvlc_MediaPlayerLengthChanged - would think that it might have a clue about the size of the stream at that point, and it hasn't yet created the vout; so I would think setting the format here would be good...
but vlc.libvlc_video_get_size( pmyi->mp, 0, &x, &y ) still returns -1

Then after that the next event I would get is the frame lock; of which I get 3 locks and get another event ...

if I wait until libvlc_MediaPlayerPositionChanged, then I can get the size, but the size returned is the size I set in my format... which is not what the function indicates it should do.

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

Re: Decode at same width and height that encoded video

Postby Rémi Denis-Courmont » 16 Sep 2010 02:58

It's still an issue for the simple reason that nobody is working on this problem.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

d3x0r
Blank Cone
Blank Cone
Posts: 38
Joined: 01 Dec 2008 22:38

Re: Decode at same width and height that encoded video

Postby d3x0r » 16 Sep 2010 04:11

I've gotten as far as ...

**/

void InfoPanel::update( input_item_t *p_item)

{
.. fills the content of the info panel with stuff from p_item->pp_categories
}

I've tried to track back references to pp_categories, and found a list manager in input.c... but I can't find references to that to put the information in in the first place, so I still dont' know where the info under 'right click a playlist item'->Information [Codec Details]

fishstyc
Blank Cone
Blank Cone
Posts: 40
Joined: 19 Oct 2010 12:39

Re: Decode at same width and height that encoded video

Postby fishstyc » 19 Oct 2010 12:54

@xdenser

Could you explain a bit more how you do it?

Should you be able to use set_format multiple times? Do you call stop first, and play again after you have set the new format?

Or do you create a new media_player and use set_format on that one?

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

Re: Decode at same width and height that encoded video

Postby Rémi Denis-Courmont » 19 Oct 2010 19:49

The video format is whatever the last invocation of set_format set before the playback started.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

xdenser
Blank Cone
Blank Cone
Posts: 23
Joined: 30 Aug 2010 23:39
Contact:

Re: Decode at same width and height that encoded video

Postby xdenser » 19 Oct 2010 23:31

Or do you create a new media_player and use set_format on that one?
yes, new one

1. I create media_player
2. Setup dummy buffer
3. Setup single event handler for all events
4. Create Event Object and reset it
5. Start playing
6. Wait for Event Object with some reasonable timeout (i.e. 5 sec)
6. In event handler call get_video_size, when I got size I set Event
7. Stop and destroy old media player with relevant resources - buffer, event, etc.
(you also should avoid calling get_video_size when stoping player)
8. Start new media player with size got from first one

it works for udp MPEG2/MPEG4 TS streaming for me


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 25 guests