如何使用 GStreamer 播放 mp4 视频?

如何使用 GStreamer 播放 mp4 视频?

我想在 ubuntu 21.04 上使用 GStreamer。以下是我尝试过的:

user@host:~$ gst-launch-1.0 -v playbin uri=file:///home/user/thisVideo.mp4
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: ring-buffer-max-size = 0
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-size = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: buffer-duration = -1
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: use-buffering = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: download = false
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: uri = file:///home/user/thisVideo.mp4
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: connection-speed = 0
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: source = "\(GstFileSrc\)\ source"
/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/quicktime, variant=(string)iso
Missing element: Quicktime demuxer
WARNING: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: No decoder available for type 'video/quicktime, variant=(string)iso'.
Additional debug info:
gsturidecodebin.c(921): unknown_type_cb (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0
ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0: Your GStreamer installation is missing a plug-in.
Additional debug info:
gsturidecodebin.c(988): no_more_pads_full (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0:
no suitable plugins found:
gstdecodebin2.c(4640): gst_decode_bin_expose (): /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0:
no suitable plugins found:
Missing decoder: Quicktime (video/quicktime, variant=(string)iso)

ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

我认为这个输出意味着我的系统上未安装 Quicktime 解复用器。有人能告诉我我必须做什么才能在 GStreamer 中播放此视频吗?

编辑:我发现问题比缺少解码器要深得多。相反,似乎我缺少所有解码器。我尝试将 GStreamer 应用于各种不同格式的文件,但我总是收到“缺少解码器”的消息。以下是另一个示例:

user@host:~$ gst-play-1.0 /home/user/someAudio.flac
Press 'k' to see a list of keyboard shortcuts.
Now playing /home/user/someAudio.flac
WARNING No decoder available for type 'audio/x-flac'.
WARNING debug information: gsturidecodebin.c(921): unknown_type_cb (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0
ERROR Your GStreamer installation is missing a plug-in. for file:///home/user/someAudio.flac
ERROR debug information: gsturidecodebin.c(988): no_more_pads_full (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0:
no suitable plugins found:
gstdecodebin2.c(4640): gst_decode_bin_expose (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0:
no suitable plugins found:
Missing decoder: Free Lossless Audio Codec (FLAC) (audio/x-flac)

Reached end of play list.

所以我认为当我将所有常用解码器都添加到我的系统中时,问题就会解决。但是该怎么做呢?

答案1

sudo apt install gstreamer1.0-plugins-base

如果它不能解决问题

sudo apt install gstreamer1.0-plugins-good
sudo apt install gstreamer1.0-plugins-bad
sudo apt install gstreamer1.0-plugins-ugly

相关内容