2025-06-24 5:08 AM - edited 2025-06-24 7:08 AM
Hello, st:
The board I have on my hand is stm32mp257f-ev1.
Now I have a problem. The gstreamer cannot work properly when playing mp4 format video.
Does the h264 decoder need to be activated or enabled?
I run this command
gst-launch-1.0 playbin3 uri="file:///home/root/Videos/2002.mp4"
here is the error:
and also the gst-discovery-1.0
root@stm32mp2-e3-c2-aa:~# gst-discoverer-1.0 Videos/2002.mp4
Analyzing file:///home/root/Videos/2002.mp4
Done discovering file:///home/root/Videos/2002.mp4
An error was encountered while discovering the file
Failed to configure H264 decoder
It seems that I can play webm format video but not mp4.
I tried the software decode avdec_h264, but it only has 15 fps.
But in fact the h264 plugin has been installed on my board.
root@stm32mp2-e3-c2-aa:~# gst-inspect-1.0 | grep h264
codectimestamper: h264timestamper: H.264 timestamper
libav: avdec_h264: libav H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 decoder
rtp: rtph264depay: RTP H264 depayloader
rtp: rtph264pay: RTP H264 payloader
typefindfunctions: video/x-h264: h264, x264, 264
uvch264: uvch264deviceprovider (GstDeviceProviderFactory)
uvch264: uvch264mjpgdemux: UVC H264 MJPG Demuxer
uvch264: uvch264src: UVC H264 Source
v4l2codecs: v4l2slh264dec: V4L2 Stateless H.264 Video Decoder
v4l2codecs: v4l2slh264enc: V4L2 Stateless H264 Video Encoder
videoparsersbad: h264parse: H.264 parser
I just want to use gstreamer to play a mp4 format video with the help of the hardware h264.
Do you have any suggestions?I'm looking forward your early reply.
Here is my board boot logs:
Solved! Go to Solution.
2025-07-10 11:50 PM
Hi,
I got the information that today the driver of the HW video decoder inside MP25 manages video with a maximum height of 1088.
If any update occurs on the subject, I will let you know.
BR,
Philippe.
2025-06-30 4:48 AM
Hi,
to get the H264 hw accelerated decode on MP257, you need to use the following command:
"gst-launch-1.0 filesrc location=<your .mp4 file> ! qtdemux !
h264parse ! queue ! v4l2slh264dec ! autovideosink"
BR,
Philippe.
2025-06-30 5:44 AM
Hello, Philippe.
I test the command you said, but still failed.
root@stm32mp2-e3-c2-aa:~# gst-launch-1.0 filesrc location=Videos/mp4/noon.mp4 ! qtdemux ! h264parse ! queue ! v4l2slh264dec ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/v4l2slh264dec:v4l2slh264dec0: Failed to configure H264 decoder
Additional debug info:
/usr/src/debug/gstreamer1.0-plugins-bad/1.22.12/sys/v4l2codecs/gstv4l2codech264dec.c(334): gst_v4l2_codec_h264_dec_negotiate (): /GstPipelin:
gst_v4l2_decoder_set_sink_fmt() failed: Invalid argument
ERROR: pipeline doesn't want to preroll.
Redistribute latency...
Setting pipeline to NULL ...
Freeing pipeline ...
Now I upload the video noon.mp4 so you can also test it on your side.
BR, Bruce.
2025-07-08 7:09 AM
Hi Bruce,
I also see a problem playing any similar 720x1280 stream.
I will keep you inform of our investigation.
BR,
Philippe.
2025-07-10 11:50 PM
Hi,
I got the information that today the driver of the HW video decoder inside MP25 manages video with a maximum height of 1088.
If any update occurs on the subject, I will let you know.
BR,
Philippe.
2025-07-11 9:36 AM
Hello Philippe:
OK.thank you very much.
I understand now and it's normal to play the horizontal screen video.
Command
root@stm32mp2-e3-c2-aa:~# gst-discoverer-1.0 Videos/mei.mp4
Analyzing file:///home/root/Videos/mei.mp4
Done discovering file:///home/root/Videos/mei.mp4
An error was encountered while discovering the file
Internal data stream error.
Properties:
Duration: 0:28:20.401000000
Seekable: yes
Live: no
container #0: Quicktime
video #1: H.264 (High Profile)
Stream ID: 9b35559607948a0832dc591351dd1bffe2d60728bff271a52ec25e026f447dd1/001
Width: 1280
Height: 720
Depth: 24
Frame rate: 30/1
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 0
Max bitrate: 0
audio #2: MPEG-4 AAC
Stream ID: 9b35559607948a0832dc591351dd1bffe2d60728bff271a52ec25e026f447dd1/002
Language: <unknown>
Channels: 2 (front-left, front-right)
Sample rate: 44100
Depth: 32
Bitrate: 129693
Max bitrate: 129693
root@stm32mp2-e3-c2-aa:~# cat test.sh
gst-launch-1.0 filesrc location=/home/root/${1} ! qtdemux name=demux \
demux.audio_0 ! queue ! decodebin ! audioconvert ! audioresample ! autoaudiosink \
demux.video_0 ! queue ! h264parse ! v4l2slh264dec ! videoconvert ! autovideosink
root@stm32mp2-e3-c2-aa:~# vi test.sh
root@stm32mp2-e3-c2-aa:~# bash test.sh Videos/mei.mp4
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
Redistribute latency...
Redistribute latency...0.0 %)
Redistribute latency...0.0 %)
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstPulseSinkClock
Redistribute latency...0.0 %)
BR
Bruce.