Bug 487031 - Unable to play h264 videos on apple silicon mac
Summary: Unable to play h264 videos on apple silicon mac
Status: REPORTED
Alias: None
Product: digikam
Classification: Applications
Component: Preview-Video (show other bugs)
Version: 8.3.0
Platform: macOS (DMG) macOS
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-14 20:28 UTC by brancaleone
Modified: 2024-06-15 07:53 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
sample file from ffmpeg bug report (438.97 KB, video/mp4)
2024-05-15 21:17 UTC, brancaleone
Details

Note You need to log in before you can comment on or make changes to this bug.
Description brancaleone 2024-05-14 20:28:18 UTC
SUMMARY

When trying to display h264 videos from my digital camera (lumix gx9) nothing is shown in preview. Metadata are correctly reported. Same video where displayed correctly on previous versions.

When enabling logging this message is displayed continuously on the console : 

FFmpeg: [h264 @ 0x7f8f05827000] hardware accelerator failed to decode picture

using null output device, none available
using null output device, none available

I've seen that a similar bug has been reported on ffmpeg track some time ago : https://trac.ffmpeg.org/ticket/9713.
The patch fixing this is included on ffmpeg branches 6.0 and up.
I've noticed that the ffmpeg executable embeded in the macos package is version 4.4.4.

I've tried the 8.4.0 preview version and the bug is the same (but audio is ok on that version).

Would it be possible to upgrade ffmpeg to avoid this bug on apple silicon macs ?

STEPS TO REPRODUCE
1. Try to preview a mp4 video using h264 codec from a panasonic camera (4k30p 100Mb/s)

OBSERVED RESULT
No video is show (also no sound but it's a different bug fixed in 8.4.0 already)


SOFTWARE/OS VERSIONS
macOS: Sonoma 14.4 on M2 max.
Comment 1 caulier.gilles 2024-05-14 20:43:42 UTC
This problem must be fixed with the current 8.4.0 pre-release PKG available here :

https://files.kde.org/digikam/

Gilles Caulier
Comment 2 brancaleone 2024-05-14 20:52:11 UTC
No this is not fixed. The audio is working with that package but still no image is displayed.

Same error in the logs : 
FFmpeg: [h264 @ 0x7fcd7c053400] hardware accelerator failed to decode picture
Comment 3 caulier.gilles 2024-05-15 02:12:35 UTC
In help / Components Info dialog did you see the h264 codec in ffmpeg features ?
Comment 4 caulier.gilles 2024-05-15 03:06:21 UTC
Here on my MacBook Pro M1, an H264 video file play perfectly :
https://i.imgur.com/TVksqA5.png

Please share a video file sample to try to reproduce the problem.

Gilles Caulier
Comment 5 Maik Qualmann 2024-05-15 06:15:17 UTC
@Gilles, according to the FFmpeg bug report from Description, the problem does not occur with every H264 video on an M1 Mac. There is also a 1 second sample video in the bug report.

Maik
Comment 6 brancaleone 2024-05-15 21:17:23 UTC
Created attachment 169515 [details]
sample file from ffmpeg bug report

Indeed it does not happen to every h264 video.

I have checked h264 codec feature in ffmpeg and it is listed same as in your screenshot.

I have also tested different files:
* video converted to h264 using handbrake : plays correctly.
* video recorded with codec h264 directly on the camera in fullhd settings : plays correctly
* video recorded with codec h264 directly on the camera in 4K settings : doesn't play and error about hardware decoding in the logs.

I should add that the same files that now cause issues (4K h264 from the camera) where fine in previous versions of digikam (i may have missed a few updates but quite sure 8.0.0 was ok). Have been using the same camera settings for a few years now without issues in digikam.

I cannot had my sample here (4K gets too large for file size limit); but here is a temporary link : https://www.swisstransfer.com/d/dc09bb95-1ad9-443d-bf2f-670a99683267

I can also confirm that the sample from ffmpeg bug report does indeed not play in digikam and show the same error in logs
Comment 7 caulier.gilles 2024-06-15 07:53:12 UTC
Git commit 57536d9f6188f0370d120dd84605a41549651a7b by Gilles Caulier.
Committed on 15/06/2024 at 07:45.
Pushed by cgilles into branch 'master'.

Update media player with git/master branch from GitHub
Related: bug 484479, bug 485468

M  +2    -2    core/libs/video/QtAVPlayer/QtAVPlayer_manifest.txt
M  +3    -0    core/libs/video/QtAVPlayer/qavhwdevice_d3d11.cpp
M  +1    -1    core/libs/video/QtAVPlayer/qavhwdevice_vaapi_drm_egl.cpp
M  +1    -0    core/libs/video/QtAVPlayer/qavsubtitleframe.cpp
M  +3    -1    core/libs/video/QtAVPlayer/qtavplayerglobal.h

https://invent.kde.org/graphics/digikam/-/commit/57536d9f6188f0370d120dd84605a41549651a7b