Play two (video) panels on one frame

43 views
Skip to first unread message

Marcos del Amo

unread,
Nov 13, 2015, 11:58:42 AM11/13/15
to wxPython-users
Okey, I'm fairly new to wxPython, so I want to know if there is something missing or I have to get into multithreading. I'm using the example of wxvlc.py from the vlc team, on Windows, and using python 2.7 and Wxpython3.0.

I want to display two videos on the same frame, the code attached allows me to display the video on the rigth or in the left panel but I'm unable to play the same video  (or a diferent one) on both panels at once.
I guess there must be a way to create a child function that sends the movie to play while the parent controls the gui and the input from keyboard?

Since I'm here I guess I'll just ask another questionn, is there anyway to start playing a movie at a certain time?
The funcion set_time only allow me to change the time of a playing movie, for now I'm just starting the movie and then going to the part where I wanna go, but it's not very nice since you see the first image of the movie before going to the part where you wanna go.
I have tried to freeze the player, send the video, set the time and unfreeze the video, but it hasn't worked out.
Now I wanted to try to create some video on the background and bring it to the foreground with the updated time, but in order to do that i have to get the simoultaneous videos part right.

Thakns for the help!
VLC_2player.py

David Woods

unread,
Nov 13, 2015, 12:31:59 PM11/13/15
to wxpytho...@googlegroups.com
Hi Marcos,

I've done this with wxMediaCtrl but not with wxvlc.  I have had up to 4 media files playing simultaneously (as long as the files are low-enough resolution and bitrate), though I had to add some extra code to keep them well synchronized. 

Take a look at http://www.transana.org/support/screencasts_Overview.htm starting at about 6:50 for a demo of multiple simultaneous videos.  My code is at https://github.com/DKWoods/Transana .  You'll want to focus on the VideoWindow.py and video_player.py modules.  (The VideoWindow houses and controls multiple video_players.)

I use the wxMediaPlayer.Seek() method to set the media file position.  I'd be surprised if wxvlc didn't offer something equivalent.

Good luck.

David
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Scholes

unread,
Nov 13, 2015, 2:02:14 PM11/13/15
to wxpytho...@googlegroups.com
Marcos del Amo wrote:
> I want to display two videos on the same frame, the code attached allows
> me to display the video on the rigth or in the left panel but I'm unable
> to play the same video (or a diferent one) on both panels at once.

First of all, your sample does not run, because it has a fair few syntax
errors. Added to that, it is full of path and file names that are very
specific to your computer, so we don't have a hope of running it. For
instance:

player.playFile("151109_F15_EXT_4k_Prueba1_30fps - 50-70.mp4",0,'true')

Finally, purely out of interest, I've just gone through your code and
removed every single line that didn't do anything, because it was
commented out, or because it was an event handler for code that was
commented out in the main GUI creation section. That includes a number
of TTS-related functions which were enclosed in tripple quotes.

By doing this, I have trimmed it down from 918 lines to 517, a reduction
of 401 lines that were not relevant to the sample.

If you require help, your sample should be brief, readable and runnable.
If you don't expect us to run it but want us to read through it to see
where you're going wrong, please clean it up and get rid of anything
that only makes sense to you, such as code that you tried and found to
not work. 401 lines is an incredible amount of code to get lost in.

Good luck with your project.
--
James Scholes
http://twitter.com/JamesScholes

Marcos del Amo

unread,
Nov 16, 2015, 4:57:12 AM11/16/15
to wxPython-users, ja...@jls-radio.com
Thank you for your answers, I'm ashamed to acknowledge that the error as usual was the programmer's fault and not a lack of the technology. I was trying to play two videos with only one instance of vlc (and obviously it couldn't), David's code made me realize that.

@James, you are right, I'm sorry I posted my code in hopes that it could be of help to someone else.
In order to play a video you have just to change my video for one of your own, I was not expecting people to go trough my messy code in order to help me, I was just asking for some advice or way to go.

It was my first submission to this grop, and from now on I'll try to upload simple and easy to read files.

Regarding the second question, set_time(self, i_time) allows the video to jump to a certain time, but it doesn't allow to start at certain given time: https://www.olivieraubert.net/vlc/python-ctypes/doc/vlc.MediaPlayer-class.html#set_time
Has anyone any idea of how to proceed? I was thinking about making another videoplayer in background and put it in the foreground but I think it's an overly complicated solution, there has to be a simpler way.
I've tried to start the video and go to the expected time, but you see a frame out of order before going to the time, it's not really great....

time = self.player.get_time() #get time of the ol video
self.playFile("video.mp4",time,True) #play new video
self.player.set_time(time)  #go to time

Thanks a lot.
Reply all
Reply to author
Forward
0 new messages