Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run 2 videos consecutively #185

Open
alexis85120 opened this issue Aug 1, 2019 · 4 comments
Open

Run 2 videos consecutively #185

alexis85120 opened this issue Aug 1, 2019 · 4 comments

Comments

@alexis85120
Copy link

Hi Will,

I would like to run 2 videos in loop at the same time and decide which one I want to appear on my screen. I want a very quick transition in order to be as real video. You'll understand with this code, I really simplified that :

if a=1
player1.pause() #Show only the video 2
player2=OMXPLAYER(Video2) #LOOP
else
player2.pause #Show only the video 1
player1=OMXPLAYER(Video1) #LOOP

@sighmon
Copy link

sighmon commented Aug 6, 2019

@alexis85120 I've been using the exitEvent callback to start a second video, but unfortunately there's ~1 second between the two, which is causing my screen to flash. So I'm keen to see how you solve it. Here's my sample code:

def omxplayer_exit_event_callback(self, player, exit_status):
    start_media_player()
end

omxplayer = OMXPlayer(video_file), args=' '.join(player_args), dbus_name=dbus_name)
omxplayer.exitEvent = omxplayer_exit_event_callback

@alexis85120
Copy link
Author

Hi @sighmon, I tried to use that too but it does not interest me because between the 2 videos I can't have more than 0.1 second, because it must be fluid. So, I did some researches and I found something. First, you have to assembly the 2 videos (the first from 0 to 30 and second to 30 to 50 for example). WIth that you can use player.seek(n) and player.set_position(n) to jump in the videos where ever you want. n is in seconds. player.seek will add n seconds to the videos ( For example if the videos is at 7 seconds and you put n=5 you'll have the videos to 13s. set.position() enable you to choose exactly a second from 0, no add. I hope I have been clear for you, you can look at this for more information : https://buildmedia.readthedocs.org/media/pdf/python-omxplayer-wrapper/latest/python-omxplayer-wrapper.pdf.
Actually it works for me but it is not very precise, i will update if I find something perfect.

@alexis85120
Copy link
Author

If someone know how to use player.set_position(), Ill appreciate it. For me it does not work.

@alexis85120
Copy link
Author

@willprice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants