20240508在RK3588的Buildroot系统下播放MP4视频
2024/5/8 18:09
开发板:飞凌的OK3588-C
SDK:Linux/Buildroot R4版本
4.4.2.5 播放 H264 格式视频
[root@ok3588:/]# gst-launch-1.0 filesrc location=13850_h264.mp4 ! qtdemux ! queue ! h264parse !
mppvideodec ! waylandsink
//播放 H264 视频
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:03.303679248
Setting pipeline to NULL ...
Freeing pipeline ...
0,0 到不了 左上角,有你们的nx App Launcher V2 p1标题栏
gst-launch-1.0 filesrc location=1.mp4 ! qtdemux ! queue ! h264parse ! mppvideodec ! waylandsink "render-rectangle=<0,0,426,400>"
这个是直接通过wayland显示的窗口,跟桌面上的应用是没关系的,应该是播放窗口的纵横比跟视频纵横比不一致导致的
这个 参数满屏了。解码4K录像(通过OV13855录像的)
gst-launch-1.0 filesrc location=1.mp4 ! qtdemux ! queue ! h264parse ! mppvideodec ! waylandsink "render-rectangle=<0,0,1024,600>"
实际LOG:
root@ok3588:/# file 1.mp4
sh: file: command not found
root@ok3588:/# file
sh: file: command not found
root@ok3588:/# busybox file 1.mp4
file: applet not found
se ! mppvideodec ! waylandsinkfilesrc location=1.mp4 ! qtdemux ! queue ! h264pars
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:02:59.283971806
Setting pipeline to NULL ...
Freeing pipeline ...
root@ok3588:/#
root@ok3588:/#
se ! mppvideodec ! waylandsinkfilesrc location=1.mp4 ! qtdemux ! queue ! h264pars
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:02:59.283815514
Setting pipeline to NULL ...
Freeing pipeline ...
se ! mppvideodec ! waylandsink "render-rectangle=<0,0,426,400>"! queue ! h264pars
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:02:59.283847846
Setting pipeline to NULL ...
Freeing pipeline ...
root@ok3588:/#
root@ok3588:/#
se ! mppvideodec ! waylandsink "render-rectangle=<0,0,1024,600>" queue ! h264pars
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:02:59.283834389
Setting pipeline to NULL ...
Freeing pipeline ...
root@ok3588:/#
4.3 视频硬解码
OK3588 支持 H264,H265、VP8、VP9 视频硬解码,H264 解码器支持 8K@30fps,H265 解码器支持
8K@60fps。
OK3588 使用 mppvideodec 组件进行视频硬解码,它的输出格式为:NV12,I420,YV12。
4.3.1 解码并播放 H264 格式视频
[root@ok3588:/]# gst-launch-1.0 filesrc location=/userdata/media/1080p_60fps_h264-30S.mp4 ! qtdemux !
h264parse ! mppvideodec ! waylandsink
Pipeline is PREROLLING ...
[ 1705.438451] dwhdmi-rockchip fde80000.hdmi: Rate 266625000 missing; computeRedistribute latency. ..
NRedistribute latency...
dynamically
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstAudioSinkClock
0:00:01.4 / 0:00:30.0 (4.8 %)
4.3.2 解码并播放 H264 格式视频带音频
[root@ok3588:/]# gst-launch-1.0 filesrc location=/userdata/media/1080p_60fps_h264-30S.mp4 ! qtdemux
name=demux demux.video_0 ! queue ! h264parse ! mppvideodec ! waylandsink demux.audio_0 ! queue !
aacparse ! faad ! alsasink
Pipeline is PREROLLING ...
[ 1705.438451] dwhdmi-rockchip fde80000.hdmi: Rate 266625000 missing; computeRedistribute latency. ..
NRedistribute latency...
dynamically
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstAudioSinkClock
0:00:01.4 / 0:00:30.0 (4.8 %)
4.3.3 解码并播放 H265 格式视频
[root@ok3588:/]# gst-launch-1.0 filesrc location=/userdata/media/4k_60fps_h265-30S.mp4 ! qtdemux !
h265parse ! mppvideodec ! waylandsink
Pipeline is PREROLLING ...
[ 1705.438451] dwhdmi-rockchip fde80000.hdmi: Rate 266625000 missing; computeRedistribute latency. ..
NRedistribute latency...
dynamically
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstAudioSinkClock
0:00:01.4 / 0:00:30.0 (4.8 %)
4.3.4 解码并播放 H265 格式视频带音频
[root@ok3588:/]# gst-launch-1.0 filesrc location=/userdata/media/4k_60fps_h265-30S.mp4 ! qtdemux
name=demux demux.video_0 ! queue ! h265parse ! mppvideodec ! waylandsink demux.audio_0 ! queue !
aacparse ! faad ! alsasink
Pipeline is PREROLLING ...
[ 1705.438451] dwhdmi-rockchip fde80000.hdmi: Rate 266625000 missing; computeRedistribute latency. ..
NRedistribute latency...
dynamically
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstAudioSinkClock
0:00:01.4 / 0:00:30.0 (4.8 %)
4.3.5 解码并播放 VP9 格式视频
[root@ok3588:/]# gst-launch-1.0 filesrc location=/userdata/media/1080p_60fps_vp9-30S.mp4 ! qtdemux !
vp9parse ! mppvideodec ! waylandsink
Pipeline is PREROLLING ...
[ 1705.438451] dwhdmi-rockchip fde80000.hdmi: Rate 266625000 missing; computeRedistribute latency. ..
NRedistribute latency...
dynamically
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstAudioSinkClock
0:00:01.4 / 0:00:30.0 (4.8 %)
4.3.6 解码并播放 VP9 格式视频带音频
[root@ok3588:/]# gst-launch-1.0 filesrc location=/userdata/media/1080p_60fps_vp9-30S.mp4 ! qtdemux
name=demux demux.video_0 ! queue ! vp9parse ! mppvideodec ! waylandsink demux.audio_0 ! queue !
aacparse ! faad ! alsasink device=plughw:1,0
Pipeline is PREROLLING ...
[ 1705.438451] dwhdmi-rockchip fde80000.hdmi: Rate 266625000 missing; computeRedistribute latency. ..
NRedistribute latency...
dynamically
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstAudioSinkClock
0:00:01.4 / 0:00:30.0 (4.8 %)
4.3.7 解码并播放 VP8 格式视频
[root@ok3588:/]# gst-launch-1.0 filesrc location=/userdata/media/1080p_30fps_vp8.webm ! matroskademux !
queue ! mppvideodec ! waylandsink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstAudioSinkClock
Got EOS from element "pipeline0".
Execution ended after 0:00:29.573170846
Setting pipeline to NULL ...
Freeing pipeline ...
4.3.8 解码并播放 VP8 格式视频带音频
[root@ok3588:/]# gst-launch-1.0 filesrc location=/userdata/media/1080p_30fps_vp8.webm typefind=true !
video/webm ! matroskademux name=dec dec. ! queue ! mppvideodec ! waylandsink dec. ! queue ! decodebin !
audioconvert ! audioresample ! alsasink device=plughw:1,0
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Redistribute latency...
New clock: GstAudioSinkClock
Got EOS from element "pipeline0".
Execution ended after 0:00:29.573170846
Setting pipeline to NULL ...
Freeing pipeline ...