Qt Multimedia 6.7.2 with ffmpeg cannot decode h264 on Pi5
-
I am try to use a QMediaPlayer with QT_MEDIA_BACKEND=ffmpeg to play a video with h264 codec on a Rasperry Pi 5, but failing with the error:
qt.core.plugin.factoryloader: checking directory path "/opt/Qt6.7.2/plugins/multimedia" ... qt.core.plugin.factoryloader: looking at "/opt/Qt6.7.2/plugins/multimedia/libffmpegmediaplugin.so" qt.core.plugin.loader: Found metadata in lib /opt/Qt6.7.2/plugins/multimedia/libffmpegmediaplugin.so, metadata= { "IID": "org.qt-project.Qt.QPlatformMediaPlugin", "MetaData": { "Keys": [ "ffmpeg" ] }, "archlevel": 0, "className": "QFFmpegMediaPlugin", "debug": false, "version": 395008 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("ffmpeg") qt.core.plugin.factoryloader: checking directory path "/home/pi/repos/gainbridge-qt672/build/multimedia" ... qt.core.library: "/opt/Qt6.7.2/plugins/multimedia/libffmpegmediaplugin.so" loaded library [2024-11-28 12:31:58.731] [info] Setting video src=RedLeftToRight.avi "FFmpeg log: Opening 'RedLeftToRight.avi' for reading" "FFmpeg log: Setting default whitelist 'file,crypto,data'" "FFmpeg log: Format avi probed with size=2048 and score=100" "FFmpeg log: use odml:1" "FFmpeg log: Before avformat_find_stream_info() pos: 5754 bytes read:22652 seeks:0 nb_streams:1" "FFmpeg log: nal_unit_type: 7(SPS), nal_ref_idc: 3" "FFmpeg log: nal_unit_type: 8(PPS), nal_ref_idc: 3" "FFmpeg log: nal_unit_type: 6(SEI), nal_ref_idc: 0" "FFmpeg log: nal_unit_type: 5(IDR), nal_ref_idc: 3" "FFmpeg log: nal_unit_type: 7(SPS), nal_ref_idc: 3" "FFmpeg log: nal_unit_type: 8(PPS), nal_ref_idc: 3" "FFmpeg log: nal_unit_type: 6(SEI), nal_ref_idc: 0" "FFmpeg log: nal_unit_type: 5(IDR), nal_ref_idc: 3" "FFmpeg log: Format yuv422p chosen by get_format()." "FFmpeg log: Reinit context to 208x80, pix_fmt: yuv422p" "FFmpeg log: no picture " "FFmpeg log: All info found" "FFmpeg log: rfps: 29.666667 0.016451" "FFmpeg log: rfps: 29.666667 0.016451" "FFmpeg log: rfps: 29.750000 0.009253" "FFmpeg log: rfps: 29.750000 0.009253" "FFmpeg log: rfps: 29.833333 0.004113" "FFmpeg log: rfps: 29.833333 0.004113" "FFmpeg log: rfps: 29.916667 0.001028" "FFmpeg log: rfps: 29.916667 0.001028" "FFmpeg log: rfps: 30.000000 0.000000" "FFmpeg log: rfps: 60.000000 0.000000" "FFmpeg log: rfps: 120.000000 0.000000" "FFmpeg log: rfps: 240.000000 0.000000" "FFmpeg log: rfps: 29.970030 0.000133" "FFmpeg log: rfps: 29.970030 0.000133" "FFmpeg log: rfps: 59.940060 0.000532" "FFmpeg log: rfps: 59.940060 0.000532" "FFmpeg log: After avformat_find_stream_info() pos: 7767 bytes read:22652 seeks:0 frames:41" "FFmpeg log: The input looks like it is Annex B already" "FFmpeg log: nal_unit_type: 7(SPS), nal_ref_idc: 3" "FFmpeg log: nal_unit_type: 8(PPS), nal_ref_idc: 3" "FFmpeg log: probing device /dev/video20" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video21" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video22" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video19" "FFmpeg log: driver 'rpivid' on card 'rpivid' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video23" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video24" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video25" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video26" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video27" "FFmpeg log: driver 'pispbe' on card 'pispbe' in unknown mode" "FFmpeg log: probing device /dev/video28" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video29" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video30" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video31" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video32" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video33" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video34" "FFmpeg log: driver 'pispbe' on card 'pispbe' in mplane mode" "FFmpeg log: v4l2 output format not supported" "FFmpeg log: probing device /dev/video35" "FFmpeg log: driver 'pispbe' on card 'pispbe' in unknown mode" "FFmpeg log: Could not find a valid device" "FFmpeg log: can't configure decoder" "FFmpeg log: V4L2 Codec end" "FFmpeg log: V4L2 Context destroyed"
For me it looks like Qt or ffmpeg tries to use a hardware decoder which is not available on Pi5. I am expecting that ffmpeg/Qt should fall back to software decoding in that case.
I first thought this might be a bug in ffmpeg, but I am able to convert that video to another codec successfully:
ffmpeg -i RedLeftToRight.avi -c:v rawvideo raw.avi
So, I assume ffmpeg is able to decode h264 without hardware encoder support.
How can I get this running?