Display Qt Widgets Over VLC Video Output

This forum is about all development around libVLC.
juraj
Blank Cone
Blank Cone
Posts: 27
Joined: 05 Dec 2009 10:41

Display Qt Widgets Over VLC Video Output

Postby juraj » 05 Dec 2009 10:57

Hi,

I am new to VLC. I am working on a video player written in C++ with use of Qt Library and libVLC for video and audio playback. Is there any way, how I can display QWidget over the VLC video output. I want to display the control bar (play/pause button; fullscreen button etc.) over the video. This approach is used also in VLC player in fullscreen mode. I want to use it also in normal mode. It"ll be totally perfect if this QWidget can be semitransparent and the user can see the video through it. But I doubt it is possible. Although semitransparent images (snapshot previews) are laid over the video in VLC player when taking snapshot.

As I said I am beginner in VLC, so any help is greatly appreciated.

Thanks,
Juraj

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

Re: Display Qt Widgets Over VLC Video Output

Postby Rémi Denis-Courmont » 05 Dec 2009 11:59

Generally speaking, yes you can. However it might not work with some video drivers (e.g. OpenGL on Windows).

Compositing onto the video normally works, but it might cause performance degradation. Compositing the video itself is not possible (way too slow).
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

nimport nawak
New Cone
New Cone
Posts: 7
Joined: 07 Dec 2009 11:43

Re: Display Qt Widgets Over VLC Video Output

Postby nimport nawak » 14 Dec 2009 17:23

I just found the solution :

all is here :

http://gitorious.org/vmem-example/vmem- ... ees/master

By this way you can extract video frames to a pixmap and display them in a Qlabel with overlay support.
Some adjustment are needed to make mutex work properly but I succefully tested it without them (commented)

juraj
Blank Cone
Blank Cone
Posts: 27
Joined: 05 Dec 2009 10:41

Re: Display Qt Widgets Over VLC Video Output

Postby juraj » 16 Dec 2009 23:30

Wow. Your code looks very good at the first glance. I managed to display Qt widget over VLC video on my own - just normal qt approach to overlay 2 widgets (specifying parent without layout). But I cannot make the upper widget semitransparent to see the video thru it on WinXP. I used windowOpacity and also Transclucent widget for that but it works just on Vista and Windows7. I wasn't able to get it work on WinXP or Ubuntu. Moreover on WinXP the upper widget blinks and looks odd.

With your idea of displaying every single frame in QLabel as image, semitransparency could be achieved in my opinion. I'll try that. But doesn't this approach cause some synchronization problems with audio? Is VLC fast enough to generate e.g. 30fps and Qt fast enough to display these frames in QLabel? As Remi said
Compositing the video itself is not possible (way too slow)
- maybe he thought your approach.

Anyway I definitely give it a try, because it is very interesting and I wonder if it will be working without sync problems.

Juraj

nimport nawak
New Cone
New Cone
Posts: 7
Joined: 07 Dec 2009 11:43

Re: Display Qt Widgets Over VLC Video Output

Postby nimport nawak » 21 Dec 2009 10:47

Playing three videos at the same time, all with audio, on a perfrmance less computer (1,6Ghz , 800Mo Ram) I don't have any problems of synchronisation or frame rate.
It's definetly not the best solution but it's the easiest to use and it's cross plateform ( A perfect solution probably need to deal with directx or X11)

juraj
Blank Cone
Blank Cone
Posts: 27
Joined: 05 Dec 2009 10:41

Re: Display Qt Widgets Over VLC Video Output

Postby juraj » 23 Dec 2009 23:19

I took a look and found 2 problems:
1. I need to keep the aspect ratio of video, not to hardcode the width and height. I doubt, it is possible with vmem (viewtopic.php?f=2&t=51447&p=166848&hilit=vmem#p166848). Moreover video window can be scaled in my app even go to fullscreen, so I need to change the width & height in vmem on the fly.
2. I found the playback to be slow when I set large width and height in vmem (1280 x 544)

Anyway, it is good solution for small fix-sized playbacks. I wonder if phonon videowidget (http://doc.trolltech.com/4.5/phonon-vid ... ml#details) cannot be any help with problem 2. I'll take a look.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 2 guests