A video playback application for NextUI featuring local file playback, YouTube streaming, IPTV/Online TV, and channel subscriptions.
- tg5040 - TrimUI Smart Pro / TrimUI Brick / Brick Hammer
- tg5050 - TrimUI Smart Pro S
- Mount your NextUI SD card to a computer.
- Download the latest release file named
Video.Player.pak.zipfrom Github. - Copy the zip file to
/Tools/<PLATFORM>/Video.Player.pak.zip(replace<PLATFORM>with your device:tg5040ortg5050). - Extract the zip in place, then delete the zip file.
- Confirm that there is a
/Tools/<PLATFORM>/Video.Player.pakfolder on your SD card. - Rename the
Video.Player.pakfolder toVideo Player.pak. - Unmount your SD Card and insert it into your TrimUI device.
- Open
Pak Storeapplication in your TrimUI device. - Navigate to the
BrowsethenMediamenu. - Select
Video Playerto install.
- You can update the application directly via
Settingspage in the application. - Or, you can update via
Pak Store.
- Automatic screen off (Follow system screen timeout).
- Resume playback from where you left off.
- Self-update from GitHub releases.
- Supports
MP4,MKV,AVI,WEBM,MOV,FLV,M4V,WMV,MPEG,3GPformats - File browser for navigating video libraries (Video files must be placed in
./Videosfolder) - Subtitle support:
- External subtitles (
.srt,.ass,.ssa,.sub): Place the subtitle file next to the video with a matching name. Works with any file size. - Embedded subtitles (e.g., ASS/SSA tracks inside
.mkv): Automatically rendered for files under 500 MB. For larger files, use external subtitle files instead.
- External subtitles (
- On-screen display with progress bar, elapsed/total time
- Search YouTube videos directly from the device
- Thumbnail previews in search results
- Stream resolution selection
- Channel subscriptions (bookmarks)
- M3U/M3U8 playlist support
- Bundled curated channel list
- Browse channels by category
- Add custom playlist URLs
- D-Pad: Navigate menus and file browser
- A Button: Select/Confirm
- B Button: Back/Cancel/Exit
- Start (short press): Show Controls Help
- Start (long press): Exit Application
- A Button: Play/Pause
- B Button: Stop and return to browser
- D-Pad Left/Right: Seek ±10 seconds (hold for continuous seek)
- D-Pad Up: Cycle audio track
- D-Pad Down: Cycle subtitle track
- Navigate to your video folder using the
Local Videosmenu - Select a file to start playback
- Place subtitle files (
.srt,.ass) alongside video files with matching names for automatic detection
- Navigate to
YouTubefrom the main menu - Use the on-screen keyboard to search for videos
- Select a video to stream
- Press
D-Pad Upto subscribe to a channel
- Navigate to
Online TVfrom the main menu - Browse channels by category or flat list
- Select a channel to stream
- Add custom M3U playlist URLs
The device uses software video decoding (no hardware video decoder is exposed). HEVC/H.265 is significantly more CPU-intensive than H.264, especially at higher resolutions. The following optimizations are applied automatically for the best possible playback experience:
- Resolution cap: Video is downscaled to the device's screen resolution before rendering, reducing post-decode work for 1080p+ content.
- Decoder optimizations: Loop filter and IDCT skipping are enabled (
-skip_loop_filter all,-skip_idct noref) to reduce decode CPU usage at the cost of minor visual artifacts. - Frame dropping: Frames are dropped when decoding falls behind audio to maintain sync.
- Embedded subtitles disabled for HEVC: The subtitle overlay filter adds significant CPU overhead. Embedded subtitle streams are not rendered for HEVC files. External subtitle files (
.srt,.ass) placed next to the video still work. - CPU locked at max frequency: The CPU is set to 2GHz (max) during the video player session to avoid frame drops from frequency scaling ramp-up.
Recommendations for HEVC content:
- Use 720p or lower resolution encodes for smooth playback
- Prefer 8-bit over 10-bit color depth
- Use external
.srtsubtitle files instead of embedded subtitles - H.264 encoded videos will always play more smoothly than HEVC on this hardware
- Docker (for cross-compilation toolchain)
- NextUI workspace with platform dependencies
# Enter the toolchain (replace PLATFORM accordingly)
make shell PLATFORM=tg5040
# Once in the toolchain shell
cd ~/workspace/nextui-video-player/src
# Build for TrimUI Brick (tg5040)
make clean && make PLATFORM=tg5040ffplay is a patched build of FFmpeg's ffplay with gamepad input support and custom OSD. It is built separately from the main application.
# Build ffplay using Docker toolchain
docker run --rm -v $(pwd)/workspace:/root/workspace \
ghcr.io/loveretro/tg5040-toolchain:latest /bin/bash -c \
'source ~/.bashrc && bash /root/workspace/nextui-video-player/ffplay/build.sh'The build script will:
- Download FFmpeg 6.1 source (cached after first run)
- Set up SDL2 headers and device's shared library for cross-compilation
- Apply the patched
ffplay.c(gamepad controls, OSD, progress bar) - Build and copy the resulting binary to
bin/ffplay
workspace/
├── nextui-video-player/ # This project
│ ├── src/ # Source code
│ ├── ffplay/ # ffplay build system
│ │ ├── ffplay.c # Patched ffplay source (gamepad + OSD)
│ │ ├── build.sh # Cross-compilation build script
│ │ ├── sdl2-headers/ # SDL2 headers for cross-compilation
│ │ └── syslibs/ # Device's SDL2 shared library
│ ├── bin/ # Platform binaries and runtime tools
│ │ ├── tg5040/ # TrimUI Brick binary (videoplayer.elf)
│ │ ├── tg5050/ # TrimUI Smart Pro S binary (videoplayer.elf)
│ │ ├── ffplay # Patched ffplay binary (shared across platforms)
│ │ ├── yt-dlp # YouTube downloader
│ │ ├── wget # HTTP downloader
│ │ └── keyboard # On-screen keyboard
│ ├── res/ # Resources (fonts, images)
│ ├── playlists/ # Bundled IPTV playlists
│ └── state/ # Runtime state files
├── all/ # Shared code
│ ├── common/ # Common utilities, API
│ └── minarch/ # Emulator framework
├── tg5040/ # TrimUI Brick platform
│ ├── platform/ # Platform-specific code
│ └── libmsettings/ # Settings library
└── tg5050/ # TrimUI Smart Pro platform
├── platform/ # Platform-specific code
└── libmsettings/ # Settings library
The video player uses:
- Shared code:
workspace/all/common/(utils, api, config, scaler) - Platform code:
workspace/<PLATFORM>/platform/ - Libraries: SDL2, SDL2_image, SDL2_ttf, GLESv2, EGL, libzip, mbedTLS
- ffplay: Patched FFmpeg 6.1 ffplay (dynamically linked against device's SDL2)
