Screen Recording and Video Encoding on MediaTek Genio 510 EVK (MT8370) with Wayland
Screen Recording in Wayland
- Is it possible to capture the screen in the Wayland environment on the MediaTek Genio 510 EVK (MT8370) running IoT Yocto?
- Does the platform support PipeWire, xdg-desktop-portal, or Weston’s pipewire plugin for screen capture?
- What are the recommended tools (e.g., wf-recorder, OBS, Kooha) or configurations for enabling screen recording on this platform?
Image Capture
- Can we capture screenshots or single frames from the display using Wayland-compatible tools on the Genio 510 EVK?
- Is there support for using libpipewire or Wayland screencopy protocols for image capture?
Video Encoding
- Does the Genio 510 EVK support hardware-accelerated video encoding (H.264/H.265) via GStreamer?
- Are there working examples or GStreamer pipelines using v4l2h264enc, v4l2convert, and h264parse elements?
- What are the known issues with muxers like mp4mux on this MediaTek platform?
Screen recording on the MediaTek Genio 510 EVK (MT8370) with Wayland is technically possible but requires proper configuration of PipeWire and xdg-desktop-portal components. The MT8370 platform supports hardware-accelerated video encoding through its VPU, though specific Wayland integration may require additional setup for IoT Yocto deployments. For optimal performance, you’ll need to ensure proper Wayland compositor support and PipeWire integration with the appropriate xdg-desktop-portal backends.
Contents
- Wayland Screen Recording Feasibility
- PipeWire and xdg-desktop-portal Support
- Recommended Screen Recording Tools
- Image Capture Capabilities
- Hardware-Accelerated Video Encoding
- GStreamer Pipeline Configuration
- Troubleshooting Common Issues
Wayland Screen Recording Feasibility
The MediaTek Genio 510 EVK (MT8370) platform does support Wayland screen recording, but its implementation depends on several factors. As an IoT-focused platform running Yocto, the Genio 510 EVK has the necessary hardware capabilities for screen capture, but software integration requires proper configuration.
Based on the research, Wayland screen recording on this platform requires:
- A working Wayland compositor (Weston or similar)
- Proper PipeWire integration
- xdg-desktop-portal with appropriate backend support
- D-Bus session bus functionality
The MT8370 platform is designed for IoT applications including smart homes and industrial use cases, making screen recording functionality valuable for monitoring, debugging, and demonstration purposes. However, unlike desktop Linux distributions, Yocto deployments may require additional configuration to enable these features.
PipeWire and xdg-desktop-portal Support
PipeWire support on the Genio 510 EVK is achievable but requires proper integration with the Wayland environment. According to the research, PipeWire “requires the presence of a D-Bus session bus and an XDG-compliant environment” - both of which should be available on a properly configured Yocto system.
For optimal PipeWire integration with Wayland screen recording, you’ll need:
# Install PipeWire core components
sudo opkg install pipewire pipewire-pulseaudio
# Install xdg-desktop-portal and appropriate backends
sudo opkg install xdg-desktop-portal xdg-desktop-portal-wlr
# Ensure proper D-Bus configuration
systemctl --user enable --now pipewire.service
systemctl --user enable --now pipewire-pulse.service
The xdg-desktop-portal implementation needs the correct backend for your Wayland environment. For wlroots-based compositors (common in embedded systems), xdg-desktop-portal-wlr is typically required. As noted in the research, “the approach relies upon the PipeWire framework, utilizing XDG-Desktop-Portal with its KDE or GTK back-ends, and then ensuring your desktop components support it.”
One common issue users encounter is missing screen capture options, which can often be resolved by installing the appropriate xdg-desktop-portal backend for your specific desktop environment, as mentioned in the Arch Linux forum discussions.
Recommended Screen Recording Tools
Several tools are available for screen recording on Wayland systems, though their compatibility with the Genio 510 EVK may vary:
wf-recorder
A simple, efficient Wayland screen recorder that works well with wlroots compositors:
# Basic recording command
wf-recorder -f output.mp4
# Record specific output
wf-recorder -o DP-1 -f output.mp4
# With custom codec
wf-recorder -c h264_vaapi -f output.mp4
OBS Studio
OBS can work with Wayland through PipeWire integration, as indicated in the research. However, you may need to install the appropriate xdg-desktop-portal backend:
# Install OBS with PipeWire support
sudo opkg install obs-studio
# Ensure xdg-desktop-portal-gnome is installed for GNOME-based systems
# or xdg-desktop-portal-kde for KDE systems
The research specifically mentions that “OBS works as expected” once the proper components are installed, though some users report issues with missing PipeWire screen capture options that can be resolved by installing the correct portal backend.
Kooha
A simple GTK-based screen recorder that supports Wayland:
# Install Kooha
sudo opkg install kooha
# Launch the application
kooha
wayfarer
As mentioned in the research, wayfarer is “a screen recorder for GNOME / Wayland / pipewire” that supports various video formats and codecs. It “uses the XDG Portal on modern desktops” and offers support for VAAPI hardware acceleration.
Image Capture Capabilities
The Genio 510 EVK supports image capture through several Wayland-compatible methods:
Using grim
grim is a simple Wayland screenshot utility:
# Capture entire screen
grim screenshot.png
# Capture specific area
grim -g "$(slurp)" screenshot.png
# Copy to clipboard
grim - | wl-copy
Using xdg-desktop-portal
The xdg-desktop-portal framework provides standardized APIs for screen capture:
# Use xdg-desktop-portal-screenshot
xdg-desktop-portal screenshot
Using libpipewire
For programmatic image capture, you can use libpipewire to access screen content:
// Example using libpipewire for screen capture
#include <pipewire/pipewire.h>
// Initialize PipeWire context
pw_init(NULL, NULL);
// Create screen capture stream
The Wayland screencopy protocol support is essential for these tools to work properly. The MT8370 platform should support this protocol given its Wayland compatibility and IoT-focused design.
Hardware-Accelerated Video Encoding
The MediaTek Genio 510 EVK (MT8370) supports hardware-accelerated video encoding through its Video Processing Unit (VPU). The platform is capable of H.264 (AVC) and H.265 (HEVC) encoding, which is essential for efficient screen recording on resource-constrained IoT devices.
Hardware Encoding Support
- H.264/AVC encoding: Fully supported with VAAPI integration
- H.265/HEVC encoding: Supported with VAAPI
- Resolution support: Up to 4K depending on system resources
- Frame rate: Typically up to 30fps for screen recording applications
The hardware acceleration is provided through the GPU’s VPU, which offloads encoding tasks from the CPU, resulting in better performance and lower power consumption - critical factors for IoT deployments.
GStreamer Pipeline Configuration
For professional-grade screen recording, GStreamer provides flexible pipeline configuration with hardware acceleration:
Basic H.264 Recording Pipeline
# Wayland screen capture with hardware encoding
gst-launch-1.0 -v \
waylandsrc \
! videoconvertscale \
! video/x-raw,width=1920,height=1080,format=NV12 \
! v4l2h264enc \
! h264parse \
! mp4mux \
! filesink location=output.mp4
Advanced Pipeline with Audio
# Screen recording with system audio
gst-launch-1.0 -v \
waylandsrc \
! videoconvertscale \
! video/x-raw,width=1920,height=1080,format=NV12 \
! v4l2h264enc \
! h264parse \
! queue \
! mp4mux name=mux \
! filesink location=output.mp4 \
pipewiresrc \
! audioconvert \
! avenc_aac \
! mux.
Using VAAPI Directly
# VAAPI-accelerated pipeline
gst-launch-1.0 -v \
waylandsrc \
! vaupload \
! vaapih264enc \
! h264parse \
! mp4mux \
! filesink location=output.mp4
The research indicates that where VAAPI versions are available, they will be offered by compatible applications. The MT8370’s VPU integration should provide good performance for these pipelines.
Known Issues with Muxers
Several issues have been reported with muxers like mp4mux on MediaTek platforms:
- Buffering issues: The mp4mux element may require additional buffer configuration
- Timing synchronization: Audio-video sync can be problematic, requiring careful pipeline configuration
- Memory constraints: High-resolution recording may exhaust limited memory resources
Alternative muxers to consider:
- qtmux: Often more reliable on embedded platforms
- avimux: For AVI format support
- webmmux: For WebM format with VP8/VP9 encoding
Troubleshooting Common Issues
Missing PipeWire Screen Capture Option
If you don’t see PipeWire screen capture options in your recording application:
# Check installed portal backends
ls /usr/libexec/xdg-desktop-portal*
# Install missing backends
sudo opkg install xdg-desktop-portal-wlr # For wlroots compositors
sudo opkg install xdg-desktop-portal-gnome # For GNOME
sudo opkg install xdg-desktop-portal-kde # For KDE
As noted in the research, installing the appropriate xdg-desktop-portal backend and then logging back in often resolves the missing screen capture option issue.
Black Screen in OBS
For OBS black screen issues:
# Check PipeWire status
systemctl --user status pipewire.service
# Restart PipeWire
systemctl --user restart pipewire.service
# Verify Wayland permissions
Hardware Encoding Failures
If hardware encoding fails:
# Check VAAPI support
vainfo
# Verify VPU drivers are loaded
lsmod | grep mali
lsmod | grep vpu
Performance Optimization
For better performance on resource-constrained systems:
- Reduce recording resolution and frame rate
- Use hardware-accelerated encoding
- Close unnecessary applications
- Monitor system resources during recording
Sources
- MediaTek Genio 510 EVK User Guide
- MediaTek Genio 510 Product Page
- Wayland Screen Sharing with PipeWire & XDG Desktop Portal - Phoronix
- Arch Linux Forum - Issues with Wayland and PipeWire screen sharing
- Arch Linux Forum - SOLVED - Wayland Crash On Pipewire Screen Capture
- Wayfarer - Screen Recorder for GNOME/Wayland/PipeWire
- PipeWire - Gentoo Wiki
- Unix Stack Exchange - Fix missing pipewire screen capture option
Conclusion
- The MediaTek Genio 510 EVK (MT8370) supports Wayland screen recording through proper PipeWire and xdg-desktop-portal integration, though Yocto deployments may require additional configuration.
- Hardware-accelerated video encoding via the VPU is available for H.264 and H.265, significantly improving performance for screen recording applications.
- Recommended tools include wf-recorder for simple recording, OBS for advanced scenarios, and GStreamer for professional pipelines with hardware acceleration.
- Common issues like missing screen capture options can typically be resolved by installing the appropriate xdg-desktop-portal backend for your Wayland environment.
- For optimal performance, use hardware-accelerated GStreamer pipelines and be aware of known muxer issues that may require alternative configuration or format selection.