This is basically a media player.
Power it and it will play the first image or video on the USB stick.
With some keyboard strokes you "change the channel", now you have an interactive TV station.
Fill a USB stick with video (or image!) files; plug it in; have a fake TV. Channel number is shown when switching them, white noise is shown when nothing is available and the volume bar is there for you when you expect it. Both can be turned off on-the-fly.
Control it with a wireless keyboard and your actress ort actor can press what they want, you'll be sure they find their program as per the script.
Tested successfully on Raspberry 4 (Debian bullseye).
Raspberry pi 3 (Debian Bookworm 32bit) did not work. Very stuttery but very plausibly i'm doin something wrong.
Combine it with a HDMI-to-RCA adapter and a RCA-to-RF adapter to display on an old TV. Even sound works!
git clone https://github.com/falue/tvPlayer
sudo bash install.sh
to:
python3 autostart.py
on autostart[*]Edit
> Preferences
> Volume Management
> uncheck Show available options for removable media when they are inserted
[*] The
autostart.py
script asks if you want to close all other autostarting windows and after a 12s timeout, it starts the main scripttvPlayer.py
. This is because other windows can overlap the tvPlayer and hinder the fullscreen mode. So without a keyboard and doing anything, the player goes to fullscreen on startup.
The media player MPV (doc wiki) used here can play pretty much everything -
however, filename-endings are fixed to work with .mp4
, .mkv
, .avi
, .mxf
and .mov
(case insensitive).
It uses ffmpeg to decode, so the list of playable media is huge. According to the mpv.io website:
File Formats: mpv supports a wide variety of media formats, including popular video files (e.g., MP4, MKV), audio codecs (e.g., AAC, MP3), and subtitles.
Some cherry picked examples:
- Containers: MP4, MKV, AVI, WebM, OGG, FLV, and more.
- Video Codecs: H.264, HEVC, VP8, VP9, AV1, MPEG-4, MPEG-2, and others.
- Audio Codecs: AAC, MP3, Vorbis, FLAC, Opus, AC3, and DTS. Subtitle Formats: SRT, ASS, SSA, VTT, and embedded subtitle tracks in containers like MKV.
Manually tested:
.mp4
MPEG-4 AAC, H264.avi
MPEG-4 mp3.mkv
h264, yuv420p.mxf
mpeg2video (4:2:2), yuv422p.mp4
HEVC, H265.mov
H264.mkv
"4k UHD" h264 yuv420p works (but stuttering on raspberry pi4 @8gb) Filetypes for images: .png
, .gif
, .tiff
, .bmp
NOTICE: Does not work with
.jpg
!NOTICE:
.png
does not work with color mode: "indexed colors"!
Works with FAT32
.
EXFAT
has worked before and does now, but you have to run the thing with sudo all the way.
Not tested any other.
The order of the files on the USB device lead the order of the TV channels.
The alphabetically first file (case insensitive, numbers before letters) is the first channel, etc.
If you want to change the order, rename the files approprietly.
If you want to change the appearance of the channel numbers or the volume bar, you have to update the .bgra
files in /channel_numbers
and /volume_bars
.
You can edit the pngs and convert them to .bgra
files. Change the variable input_folder
in it first, and then run bash script python3 png_to_bgra.py
to convert the files.
Note: For simplicity, keep the image sizes the same as they are hard coded. Otherwise you have make changes to the script (change the parameters of both
display_image(...)
instances)
Complete black pixels will become transparent.
If you want "black" to show up, use rgb(1,1,1)
.
Keypress | Action | Note |
---|---|---|
LEFT | prev channel | aka "previous file" on USB drive (alphabetically) |
RIGHT | next channel | aka "next file" on USB drive (alphabetically) |
[number] | go to channel nr [number] | |
UP | jump +5 seconds | |
SHIFT+UP | pause and jump one frame forwards | |
DOWN | jump -5 seconds | |
SHIFT+DOWN | pause and jump one frame backwards | |
p or space | toggle play / pause | |
ESC | toggle fullscreen | |
q | shutdown raspberry pi | |
Q (SHIFT+q) | exit program | |
b | toggle black screen | Also pauses the current video when entering black screen, resumes video when exiting black screen |
g | cycle through green screens → | Available chroma screens: Green, Blue, Black, Grey, White Each with 3 different tracking marker arrangements and one without. |
G (SHIFT+g) | cycle through green screens ← | |
c | video fitting | "Contain", "stretch" or "cover" |
i | set inpoint | Set where the file starts to play when chaning channels |
I (SHIFT+i) | clear inpoint on this video | |
a | toggle tv-animations | Animations: show channel number, show pause in between channel changes, show vol bars |
w | toggle white noise | if tv-animations: pause in between channel changes is white noise or black |
, | reduce video brightness by 5% | |
. | increase video brightness by 5% | |
+ | reduce volume by 10% | |
- | increase volume by 10% |