Issue
For a while now I transcode videos to play on a raspberry pi 3 (or 4) but the performance was always really bad. After a long process of trial and error I found a command which works good most of the time for the various inputs I get from the colleagues:
ffmpeg -i video_input.mp4 -c:v libvpx-vp9 -vf "scale=1280:720" -r 30 -b:v 1.0M -maxrate 1.2M -bufsize 1M video_output.mp4
Today I got a 4k Video, 1.7gb and about 3 minutes with 50fps.
The resulting video has 31MegaBytes. That alone was really concerning but the main problem is, the Video is not playing not even close to smoothly. It's a diashow.
I use a debian bullseye (headless) on an old Z440 machine. So only a CLI is available. Can some please help me to find a codec which is suitable for playback on a rpi3 or rpi4 ?
I also tried h264_omx as the c:v command but it throws this error:
libOMX_Core.so not found
libOmxCore.so not found
I found posts around that this is already deprecated anyway. So I hope to find a hero which knows how to transcode this kind of video.
FFMPEG is version 4.3
Solution
The Raspberry Pi 3 has good playback support for H.264 but not for VP9.
ffmpeg -i video_input.mp4 -c:v libx264 -vf "scale=1280:720" video_output.mp4
The Raspberry Pi 3 has no hardware support for 2160p (4k) - so 4k won't play.
The Raspberry Pi 4 can decode H.265 in 2160p (4k) on hardware
I would try
ffmpeg -i input -c:v libx265 -crf 26 -preset fast output.mp4
Answered By - Markus Schumann Answer Checked By - Dawn Plyler (WPSolving Volunteer)