Can't get omxplayer to output video over HDMI, only audio is working

I have a project, part of which involves playing a video using omxplayer, but when I trigger the video I can hear the audio but the screen just stays showing the BalenaCloud logo.

I’ve tried stripping everything back so that it’s as simple as possible. I now have a container that installs omxplayer and then runs omxplayer --display=5 /home/pi/videos/default.mp4, but I still just hear the audio and see the BalenaCloud logo.

To check the container can reach the screen I’ve tried displaying an image with feh test.jpeg and that worked fine, I’m at a loss as what to try next.

Hey @s.ince welcome to the forums! Could you let us know what device and what OS version you’re using?

Hey @chrisys,

The device is a raspberry pi 3b+

And the OS version is v2.41.0+rev3

Thank you!

Thanks for getting back to me - is there any chance you can share your Dockerfile as well, then we can try to reproduce this and work out what’s happening.

My project is a copy of the simple-server-python repo, I’ve added the install of omxplayer, and I have a folder in my project called ./videos that gets but into /home/pi/videos:

# base-image for python on any machine using a template variable,
# see more about dockerfile templates here: https://www.balena.io/docs/learn/develop/dockerfile/
FROM balenalib/%%BALENA_MACHINE_NAME%%-python:3-stretch-run

# use `install_packages` if you need to install dependencies,
# for instance if you need git, just uncomment the line below.
RUN install_packages git omxplayer

COPY ./videos /home/pi/videos

# Set our working directory
WORKDIR /usr/src/app

# Copy requirements.txt first for better cache on later pushes
COPY requirements.txt requirements.txt

# pip install python deps from requirements.txt on the resin.io build server
RUN pip install -r requirements.txt

# This will copy all files in our root to the working  directory in the container
COPY . ./

# Enable udevd so that plugged dynamic hardware devices show up in our container.
ENV UDEV=1

# main.py will run when container starts up on the device
CMD ["python","-u","src/main.py"]

To test if omxplayer works I then ssh in and run omxplayer --display=5 /home/pi/videos/default.mp4.

Hello, I didn’t get a chance to try your Dockerfile, but did you happen to test this on balenaOS 2.38.0 instead of 2.41.0? Could you give it a shot?

@dfunckt I’ll try that now.

@dfunckt Things seem worse on 2.38.0. Now, omxplayer won’t do anything, it just hangs with no output at all. I ran it with --genlog and the only line in the logfile is DEBUG: DllBcm: Using omx system library.

On 2.41.0 omxplayer runs with no errors and exits as expected, the audio is played over HDMI but the screen just shows the Balena logo.

What output do you get from oxmplayer under 2.41.0? Did you try with --genlog enabled?

@wrboyce I’ve just switched back to 2.41.0 and things have gone back to as before.

I ran omxplayer --display=5 --genlog /home/pi/videos/default.mp4 and then used transfer.sh to pull the log file, which I have attached.omxplayer.log (141.2 KB)

Thanks, I’m taking a look at those logs now and I’ve just built a quick test app using omxplayer which I’m building too. I’ll let you know if I find anything.

Thank you @wrboyce, I thought it could be helpful to share the stdout from omxplayer, it exits as if everything went ok:

root@dcb0d00:/usr/src/app# omxplayer --display=5 --genlog /home/pi/videos/default.mp4
Video codec omx-h264 width 1080 height 1920 profile 77 fps 25.000000
Audio codec aac channels 2 samplerate 48000 bitspersample 16 
Subtitle count: 0, state: off, index: 1, delay: 0
V:PortSettingsChanged: 1080x1920@25.00 interlace:0 deinterlace:0 anaglyph:0 par:1.00 display:5 
layer:0 alpha:255 aspectMode:0
have a nice day ;)
root@dcb0d00:/usr/src/app#

Thanks, I’ve got my test app built and am seeing exactly as you describe. I will dig around for a bit locally and see if I can work anything out. At least you know it isn’t just you :slight_smile:

Okay, got there in the end. If you set RESIN_HOST_CONFIG_dtoverlay to "vc4-fkms-v3d" then it will work as expected (or you can set dtoverlay in config.txt if you wish).

Hi @wrboyce, incredible, it works!

Thank you so much for your help, I don’t think I’d have ever figured that out on my own.

RESIN_HOST_CONFIG_dtoverlay was already set, but to "vc4-kms-v3d" by default.

Can I ask what RESIN_HOST_CONFIG_dtoverlay does and how setting it to "vc4-fkms-v3d" helped? Also, how did you figure this out?

Awesome, glad it worked! If I’m honest I’m not sure why the overlay has been set to that by default, but I did see the same on my side.

As for how I worked it out… I’d love to tell you a tale of hardcore debugging but the truth of the matter is I asked my colleagues who were already aware of a similar issue and suggested I give the alternative dtoverlay a try. I do know we’ve been having issues with the latest BalenaOS builds due to Pi firmware changes, but that is a bit beyond my remit and I don’t have too many details I’m afraid. Happy to summon somebody from the devices team if you’d like an in depth explanation though?

@wrboyce I’ve just added a new device and now 2.41.0 isn’t an option, has this version been removed?!

I’ve used 2.38.0 but with this version omxplayer just hangs with no output of any kind. :disappointed:

Hi @s-ince, we’ve had to pull 2.41.0 as it was causing some issues but I believe your app should work with 2.38.0. Let me try my similar test app on 2.38.0 and see if I can work out what is going on. I’ll get back to you if I find anything interesting.

Thank you @wrboyce, the problem is a little difference with 2.38.0. Now running omxplayer --display=5 --genlog /home/pi/videos/default.mp4 results in no output at all, nothing from stdout nothing from the HDMI and nothing in the logfile, it’s really odd, it seems like omxplayer just freezes the second you try and run it.

1 Like

Hi @s.ince, I pinged Will about it and he’s still investigating it. He might reply if he finds a workaround. Then it’s probably best for you to wait for the next release – as we know that solves this issue.