sakaki- / gentoo-on-rpi-64bit

Bootable 64-bit Gentoo image for the Raspberry Pi4B, 3B & 3B+, with Linux 5.4, OpenRC, Xfce4, VC4/V3D, camera and h/w codec support, weekly-autobuild binhost
GNU General Public License v3.0
926 stars 127 forks source link

Cannot play UHD hevc/h265 video smoothly (under mpv) #196

Open danboid opened 3 years ago

danboid commented 3 years ago

I have a number of UHD hevc/h265 videos that play fine under Raspbian VLC (when using mmal-copy) but I have been unable to get to play smoothly (with hardware acceleration) under rpi gentoo 64 1.6.0 when using smplayer, mpv or ffplay. I have installed gentoo onto a USB3 SSD and I am playing the video file from the same SSD on a RPi4 w/ 8GB RAM.

mpv is my favourite video player so I'm hoping we'll be able to get UHD h265 videos playing under mpv, which I was very happy to see installed by default. I have tried using the auto-copy and auto modes under smplayer, I've tried:

$ ffplay -vcodec hevc_v4l2m2m -i vid.mp4

and I've tried various mpv commands such as:

$ mpv --vo=gpu --gpu-context=drm --drm-connector=1.HDMI-A-1 --hwdec=v4l2m2m-copy vid.mp4

Is hardware decoding and playback of h265 not working yet? Doesn't look like it.

danboid commented 3 years ago

This thread hints at it being possible to play hw accelerated videos under mpv on the RPi4 without any Broadcom binary blobs:

https://github.com/mpv-player/mpv/issues/7492

danboid commented 3 years ago

mpv defaults to the 'gpu' video output device it seems. Here we see it run with no options under grpi64 and we see it has dropped 90 frames after playing only 6 seconds of video.

$ mpv vid.mp4 
 (+) Video --vid=1 (*) (hevc 3840x2160 29.997fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 3840x2160 yuv420p
AV: 00:00:00 / 00:00:50 (0%) A-V:  0.280 Dropped: 3

Audio/Video desynchronisation detected! Possible reasons include too slow
hardware, temporary CPU spikes, broken drivers, and broken files. Audio
position will not match to the video (see A-V status field).

AV: 00:00:06 / 00:00:50 (12%) A-V: 18.669 Dropped: 90

Exiting... (Quit)
danboid commented 3 years ago

This command should enable hw decoding:

 $ mpv --hwdec=v4l2m2m-copy vid.mp4 
 (+) Video --vid=1 (*) (hevc 3840x2160 29.997fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
[ffmpeg/video] hevc_v4l2m2m: Could not find a valid device
[ffmpeg/video] hevc_v4l2m2m: can't configure decoder
Could not open codec.
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 3840x2160 yuv420p
AV: 00:00:00 / 00:00:50 (0%) A-V:  0.380 Dropped: 3

Audio/Video desynchronisation detected! Possible reasons include too slow
hardware, temporary CPU spikes, broken drivers, and broken files. Audio
position will not match to the video (see A-V status field).

AV: 00:00:05 / 00:00:50 (10%) A-V: 15.941 Dropped: 72

Exiting... (Quit)
sakaki- commented 3 years ago

30 Oct 2020: sadly, due legal obligations arising from a recent change in my 'real world' job, I must announce I am standing down as maintainer of this project with immediate effect. For the meantime, I will leave the repo up (for historical interest, and since the images may be of use still in certain applications); however, there will be no further updates to the underlying binhost etc., nor will I be accepting / actioning further pull requests or bug reports from this point. Email requests for support will also have to be politely declined, so, please treat this as an effective EOL notice.

For further details, please see my post here.

Many thanks for your interest in this project!

With sincere apologies, sakaki ><