omxplayer, asplashscreen and vertical/portrait displays
-
Hello,
I have a few mini-arcade projects that use a vertical/portrait display so they can look more like the classic arcade vertical/portrait display games. I was playing with
omxplayer
andasplashscreen.sh
so that I could have a game video play while my Raspberry Pi boots up. I notice that vertical/portrait orientation does not seem to be well supported in omxplayer. Hoirzontal/landscape orientation seems to work fine. I think it boils down to omxplayer not having support for an aspect fit mode.Here's what I see with the available options for
--aspect-mode
:- Letterbox: In horizontal/portrait mode, this works as expected, letterboxing the video with bars on the top/bottom. On a vertical/portrait display though, the bars are on the left and the right of the content, like it is still performing a horizontal letterbox.
- Fill: In this mode, the content is zoomed to the fill the entire screen, but some areas of the content will get chopped off as the aspect ratio of the video is preserved. This seems to really be aspect-fill. That's fine, just not what I need.
- Stretch: This will stretch the video to fit the entire screen, ignoring the aspect ratio of the video. It's close to what I need, especially because my video is also in vertical/portrait mode, but the video aspect ratio and screen aspect ratio are slightly different, so I do see some stretching.
In order to get what I'm looking for, I modified asplashscreen.sh to calculate a window size with the correct aspect ratio based on the dimensions of the video and the dimensions of the screen. This requires a few steps:
- Use
tvservice
to get the dimensions of the display and detect with it is in vertical/portrait mode. If in horizontal/landscape mode, use omxplayer in the default manner. - Use
mediainfo
, which had to be installed, to get the dimensions of the video - Calculate the proper window size using
calc
, which also had to be installed (sudo apt install apcalc
). - Call
omxplayer
with--aspect-mode stretch --win "x1 y1 x2 y2"
parameters to produce the correct letterbox effect.
Is there a better way to do this that would be more straightforward? If not, any feedback on my creating a pull request to add this functionality to
asplashscreen.sh
in RetroPie?Thanks for the feedback.
- George
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.