Skip to content

How to sync two videos on separated dbus on a RPi4 #212

@SandroMiccoli

Description

@SandroMiccoli

Issue Report

Description

I'm upgrading a video controller system I've developed to be able to play two different videos for each HDMI output of a RaspberryPi4 (issue #194 helped with that). My issue now is getting these two videos to play in sync. Ideally synced at the exact same frame.

Looking at the docs I found a play_sync() function but not sure how to make one process to be synced with the other.

Problem reproduction

I had to increase my GPU memory on the RPi to 256MB to be able to play two FHD (1920x1080) for each monitor output (thanks to this).

This is how I'm starting the omxplayer process for each video output:

from omxplayer.player import OMXPlayer
player0 = OMXPlayer('videos/video0.mp4', dbus_name='org.mpris.MediaPlayer2.omxplayer1', args=['--no-osd','--no-keys','-b','--loop','--display=2','-o','local'])
player1 = OMXPlayer('videos/video1.mp4', dbus_name='org.mpris.MediaPlayer2.omxplayer2', args=['--no-osd','--no-keys','-b','--loop','--display=7',])

And when I pause/play the video, they also react in different moments. Parts of that code:

if msg.topic == "pause":
        player0.play_pause()
        player1.play_pause()

Should I use a python library like multiprocessing to run both processes in parallel or are there some settings for omxplayer that could take care of this?

Environment details

  • OS (lsb_release -a):
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
Software Version
python-omxplayer-wrapper (pip show omxplayer-wrapper) 0.3.3
python-dbus (dpkg -s python-dbus) 1.2.8-3
python (python --version) 2.7.16
omxplayer (omxplayer --version) f543a0d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions