Testing Custom Video Geometry with MPV in the Yocto Project
In this article, we will discuss how to test custom video geometry with the MPV media player in the Yocto Project. The Yocto Project is an open-source collaboration project that provides templates, tools, and methods to help create custom Linux-based systems for embedded devices.
Prerequisites
Before we begin, make sure you have the following:
- A working Yocto Project environment
- MPV media player installed
- Basic knowledge of the Yocto Project and BitBake build system
Introduction
MPV is a popular media player that supports a wide range of video and audio formats. In the Yocto Project, MPV can be integrated into your custom image to provide media playback capabilities. One of the features of MPV is the ability to customize video geometry, which allows you to specify the width, height, and position of the video on the screen.
Testing Custom Video Geometry
To test custom video geometry with MPV in the Yocto Project, you can write a script that plays a video at a specific width, height, and position on the screen. The following is an example script that demonstrates how to do this:
#!/bin/bash
# Set the video geometry
geometry="640x480+100+100"
# Start MPV with the custom geometry
mpv --geometry=$geometry /path/to/video.mp4In this example, the video will be played at a width of 640 pixels, a height of 480 pixels, and a position of 100 pixels from the top and 100 pixels from the left of the screen. You can modify these values to suit your needs.
Building the MPV Image
To build the MPV image in the Yocto Project, you can use the following BitBake recipe:
inherit autotools gettext
DESCRIPTION = "MPV media player"
HOMEPAGE = ""
SECTION = "video"
LICENSE = "MIT"
DEPENDS = "libdrm mesa-dri-swrast"
SRC_URI = "https://github.com/mpv-player/mpv/archive/v0.33.0.tar.gz"
S = "${WORKDIR}/mpv-0.33.0"
do_configure() {
./bootstrap
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--enable-shared \
--disable-static \
--enable-gpl \
--enable-libass \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libxcb \
--enable-libxml2 \
--enable-zlib \
--disable-gl \
--disable-sdl \
--disable-x11 \
--disable-wayland \
--disable-alsa \
--disable-pulse \
--disable-jack \
--disable-oss \
--disable-ffmpeg \
--disable-libbluray \
--disable-dvdnav \
--disable-dvdread \
--disable-libass \
--disable-libfreetype \
--disable-libfontconfig \
--disable-libmp3lame \
--disable-libopus \
--disable-libtheora \
--disable-libvorbis \
--disable-libvpx \
--disable-libx264 \
--disable-libx265 \
--disable-libxcb \
--disable-libxml2 \
--disable-zlib \
--disable-debug \
--disable-optimizations
}
do_compile() {
${MAKE}
}
do_install() {
${MAKE} DESTDIR=${D} install
} This recipe will build the MPV media player with the minimum set of dependencies required for media playback. Note that we have disabled several features, such as OpenGL, SDL, ALSA, PulseAudio, and FFmpeg, to reduce the size of the image. You can modify this recipe to suit your needs.
In this article, we have discussed how to test custom video geometry with MPV in the Yocto Project. By writing a script that plays a video at a specific width, height, and position on the screen, you can test and verify that the custom video geometry is working as expected. With the Yocto Project and MPV, you can create custom Linux-based systems for embedded devices with media playback capabilities.