如何处理 gstreamer 缺少编解码器

如何处理 gstreamer 缺少编解码器

我在命令行上使用 gstreamer 以及尝试运行示例 playbin 代码时都遇到了缺少流行视频容器(如 mp4 和 avi)编解码器的问题(下面详细介绍了每个场景)。

可能是缺少软件包或需要进行某些设置。我该如何修复环境以使 mp4 和 avi 编解码器在 gstreamer 中工作?

1. 使用playbin

尝试运行我的第一个 gstreamer playbin 应用程序,它摘自官方 gstreamer 文档。但是,似乎无论我选择播放的视频编码是什么,解码器都缺失。

已安装 ubuntu-restricted-extras其他地方有人建议使用这种方法来解决此类问题,但我真不知道如何安装或配置缺失的解码器。也许你可以让我更明智一些。

以下是代码和随后的错误跟踪:

import sys, os
import gi
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')
gi.require_version('GstVideo', '1.0')
from gi.repository import Gst, GObject, Gtk

# Needed for window.get_xid(), xvimagesink.set_window_handle(), respectively:
from gi.repository import GdkX11, GstVideo

class GTK_Main(object):

    def __init__(self):
        window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
        window.set_title("Video-Player")
        window.set_default_size(500, 400)
        window.connect("destroy", Gtk.main_quit, "WM destroy")
        vbox = Gtk.VBox()
        window.add(vbox)
        hbox = Gtk.HBox()
        vbox.pack_start(hbox, False, False, 0)
        self.entry = Gtk.Entry()
        hbox.add(self.entry)
        self.button = Gtk.Button("Start")
        hbox.pack_start(self.button, False, False, 0)
        self.button.connect("clicked", self.start_stop)
        self.movie_window = Gtk.DrawingArea()
        vbox.add(self.movie_window)
        window.show_all()

        self.player = Gst.ElementFactory.make("playbin", "player")
        bus = self.player.get_bus()
        bus.add_signal_watch()
        bus.enable_sync_message_emission()
        bus.connect("message", self.on_message)
        bus.connect("sync-message::element", self.on_sync_message)

    def start_stop(self, w):
        if self.button.get_label() == "Start":
            filepath = self.entry.get_text().strip()
            if os.path.isfile(filepath):
                filepath = os.path.realpath(filepath)
                self.button.set_label("Stop")
                self.player.set_property("uri", "file://" + filepath)
                self.player.set_state(Gst.State.PLAYING)
            else:
                print(f"there is no file path {filepath}")
                self.player.set_state(Gst.State.NULL)
                self.button.set_label("Start")

    def on_message(self, bus, message):
        t = message.type
        if t == Gst.MessageType.EOS:
            self.player.set_state(Gst.State.NULL)
            self.button.set_label("Start")
        elif t == Gst.MessageType.ERROR:
            self.player.set_state(Gst.State.NULL)
            err, debug = message.parse_error()
            print("Error: %s" % err, debug)
            self.button.set_label("Start")

    def on_sync_message(self, bus, message):
        if message.get_structure().get_name() == 'prepare-window-handle':
            imagesink = message.src
            imagesink.set_property("force-aspect-ratio", True)
            imagesink.set_window_handle(self.movie_window.get_property('window').get_xid())


GObject.threads_init()
Gst.init(None)
GTK_Main()
Gtk.main()

错误追踪:

playbin-example-video.py:72: PyGIDeprecationWarning: Since version 3.11, calling threads_init is no longer needed. See: https://wiki.gnome.org/PyGObject/Threading
      GObject.threads_init()
    playbin-example-video.py:17: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "type" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
      window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
    playbin-example-video.py:27: PyGTKDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "label" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
      self.button = Gtk.Button("Start")
    Error: gst-core-error-quark: Your GStreamer installation is missing a plug-in. (12) gsturidecodebin.c(988): no_more_pads_full (): /GstPlayBin:player/GstURIDecodeBin:uridecodebin0:
    no suitable plugins found:
    gstdecodebin2.c(4640): gst_decode_bin_expose (): /GstPlayBin:player/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0:
    no suitable plugins found:
    Missing decoder: Audio Video Interleave (AVI) (video/x-msvideo)

也许这个代码已经过时了,我确实必须从官方文档复制后将其转换为 Python 3。

我在看针对此类一般情况的官方文件,但却看不到那里出现的清晰道路。

2. 使用命令行播放器

尝试玩也是同样的问题AVI或者mp4来自 gstreamer 命令的文件:

$ gst-play-1.0 media_file.mp4
$ gst-play-1.0 media_file.avi

有些地方提到需要设置环境变量,但要弄清楚插件安装在哪里才能在该环境变量中提供它们有点棘手。例如,我似乎安装了 apt 插件包(“base”、“good”和“bad”),但我能找到的目录whereis似乎只包含两个可执行文件。

从那里运行可执行文件:

$ /usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner

不返回任何内容。

输出gst-inspect

$ gst-inspect-1.0 
videoscale:  videoscale: Video scaler
ximagesink:  ximagesink: Video sink
audiotestsrc:  audiotestsrc: Audio test source
audiomixer:  audiointerleave: AudioInterleave
audiomixer:  liveadder: AudioMixer
audiomixer:  audiomixer: AudioMixer
audiorate:  audiorate: Audio rate adjuster
volume:  volume: Volume
videotestsrc:  videotestsrc: Video test source
opengl:  glfilterglass: OpenGL glass filter
opengl:  gldeinterlace: OpenGL deinterlacing filter
opengl:  gltestsrc: Video test source
opengl:  glstereosplit: GLStereoSplit
opengl:  glviewconvert: OpenGL Multiview/3D conversion filter
opengl:  glfilterapp: OpenGL application filter
opengl:  glshader: OpenGL fragment shader filter
opengl:  glcolorscale: OpenGL color scale
opengl:  gleffects_laplacian: Laplacian Convolution Demo Effect
opengl:  gleffects_blur: Blur with 9x9 separable convolution Effect
opengl:  gleffects_sobel: Sobel edge detection Effect
opengl:  gleffects_glow: Glow Lighting Effect
opengl:  gleffects_sin: All Grey but Red Effect
opengl:  gleffects_xray: Glowing negative effect
opengl:  gleffects_lumaxpro: Luma Cross Processing Effect
opengl:  gleffects_xpro: Cross Processing Effect
opengl:  gleffects_sepia: Sepia Toning Effect
opengl:  gleffects_heat: Heat Signature Effect
opengl:  gleffects_square: Square Effect
opengl:  gleffects_bulge: Bulge Effect
opengl:  gleffects_twirl: Twirl Effect
opengl:  gleffects_fisheye: FishEye Effect
opengl:  gleffects_tunnel: Light Tunnel Effect
opengl:  gleffects_stretch: Stretch Effect
opengl:  gleffects_squeeze: Squeeze Effect
opengl:  gleffects_mirror: Mirror Effect
opengl:  gleffects_identity: Do nothing Effect
opengl:  gleffects: Gstreamer OpenGL Effects
opengl:  glfiltercube: OpenGL cube filter
opengl:  glsrcbin: GL Src Bin
opengl:  glsinkbin: GL Sink Bin
opengl:  glfilterbin: GL Filter Bin
opengl:  glcolorbalance: Video balance
opengl:  glcolorconvert: OpenGL color converter
opengl:  gldownload: OpenGL downloader
opengl:  glupload: OpenGL uploader
opengl:  glimagesinkelement: OpenGL video sink
opengl:  glimagesink: GL Sink Bin
pbtypes:  GstVideoMultiviewFlagsSet (GstDynamicTypeFactory)
typefindfunctions: audio/audible: aa, aax
typefindfunctions: audio/x-xi: xi
typefindfunctions: video/x-pva: pva
typefindfunctions: application/x-ssa: ssa, ass
typefindfunctions: application/octet-stream: no extensions
typefindfunctions: image/x-degas: no extensions
typefindfunctions: image/x-icon: no extensions
typefindfunctions: application/x-yuv4mpeg: no extensions
typefindfunctions: image/vnd.wap.wbmp: no extensions
typefindfunctions: image/vnd.adobe.photoshop: psd
typefindfunctions: application/msword: doc
typefindfunctions: application/pdf: pdf
typefindfunctions: audio/x-kss: kss
typefindfunctions: video/x-ivf: ivf
typefindfunctions: audio/x-sap: sap
typefindfunctions: audio/x-vgm: vgm
typefindfunctions: audio/x-gbs: gbs
typefindfunctions: audio/x-ay: ay
typefindfunctions: audio/x-gym: gym
typefindfunctions: audio/x-nsf: nsf
typefindfunctions: video/vivo: viv
typefindfunctions: application/x-mmsh: no extensions
typefindfunctions: multipart/x-mixed-replace: no extensions
typefindfunctions: video/x-dirac: no extensions
typefindfunctions: application/x-ms-dos-executable: dll, exe, ocx, sys, scr, msstyles, cpl
typefindfunctions: application/x-ar: a
typefindfunctions: application/x-tar: tar
typefindfunctions: application/x-rar: rar
typefindfunctions: image/svg+xml: svg
typefindfunctions: application/postscript: ps
typefindfunctions: audio/x-caf: caf
typefindfunctions: audio/x-wavpack-correction: wvc
typefindfunctions: audio/x-wavpack: wv, wvp
typefindfunctions: audio/x-spc: spc
typefindfunctions: audio/aac: aac, adts, adif, loas
typefindfunctions: application/x-executable: no extensions
typefindfunctions: text/x-cmml: no extensions
typefindfunctions: application/x-ogg-skeleton: no extensions
typefindfunctions: audio/x-celt: no extensions
typefindfunctions: audio/x-speex: no extensions
typefindfunctions: application/x-ogm-text: no extensions
typefindfunctions: application/x-ogm-audio: no extensions
typefindfunctions: application/x-ogm-video: no extensions
typefindfunctions: video/x-theora: no extensions
typefindfunctions: audio/x-vorbis: no extensions
typefindfunctions: audio/x-flac: flac
typefindfunctions: application/x-subtitle-vtt: vtt
typefindfunctions: subtitle/x-kate: no extensions
typefindfunctions: application/x-compress: Z
typefindfunctions: application/zip: zip
typefindfunctions: application/x-gzip: gz
typefindfunctions: application/x-bzip: bz2
typefindfunctions: image/x-sun-raster: ras
typefindfunctions: image/x-xpixmap: xpm
typefindfunctions: image/x-jng: jng
typefindfunctions: video/x-mng: mng
typefindfunctions: image/x-xcf: xcf
typefindfunctions: audio/x-sid: sid
typefindfunctions: audio/x-sbc: sbc
typefindfunctions: audio/iLBC-sh: ilbc
typefindfunctions: audio/x-amr-wb-sh: amr
typefindfunctions: audio/x-amr-nb-sh: amr
typefindfunctions: video/x-dv: dv, dif
typefindfunctions: video/x-mve: mve
typefindfunctions: application/mxf: mxf
typefindfunctions: video/x-matroska: mkv, mka, mk3d, webm
typefindfunctions: image/x-portable-pixmap: pnm, ppm, pgm, pbm
typefindfunctions: image/x-exr: exr
typefindfunctions: image/webp: webp
typefindfunctions: image/tiff: tif, tiff
typefindfunctions: image/bmp: bmp
typefindfunctions: image/png: png
typefindfunctions: image/gif: gif
typefindfunctions: image/jpeg: jpg, jpe, jpeg
typefindfunctions: application/x-ape: ape
typefindfunctions: audio/x-shorten: shn
typefindfunctions: audio/x-rf64: rf64
typefindfunctions: audio/x-w64: w64
typefindfunctions: audio/x-ircam: sf
typefindfunctions: audio/x-sds: sds
typefindfunctions: audio/x-voc: voc
typefindfunctions: audio/x-nist: nist
typefindfunctions: audio/x-paris: paf
typefindfunctions: audio/x-svx: iff, svx
typefindfunctions: audio/x-aiff: aiff, aif, aifc
typefindfunctions: audio/x-wav: wav
typefindfunctions: application/xml: xml
typefindfunctions: application/ttml+xml: ttml+xml
typefindfunctions: application/smil: smil
typefindfunctions: application/sdp: sdp
typefindfunctions: application/x-hls: m3u8
typefindfunctions: application/itc: itc
typefindfunctions: text/uri-list: ram
typefindfunctions: text/utf-32: txt
typefindfunctions: text/utf-16: txt
typefindfunctions: text/plain: txt
typefindfunctions: video/x-flv: flv
typefindfunctions: application/vnd.ms-sstr+xml: no extensions
typefindfunctions: application/dash+xml: mpd, MPD
typefindfunctions: application/x-shockwave-flash: swf, swfl
typefindfunctions: application/x-pn-realaudio: ra, ram, rm, rmvb
typefindfunctions: application/vnd.rn-realmedia: ra, ram, rm, rmvb
typefindfunctions: text/html: htm, html
typefindfunctions: video/mj2: mj2
typefindfunctions: image/x-jpc: jpc, j2k
typefindfunctions: image/jp2: jp2
typefindfunctions: image/x-quicktime: qif, qtif, qti
typefindfunctions: video/quicktime: mov, mp4
typefindfunctions: application/x-3gp: 3gp
typefindfunctions: audio/x-m4a: m4a
typefindfunctions: video/x-nuv: nuv
typefindfunctions: video/x-h265: h265, x265, 265
typefindfunctions: video/x-h264: h264, x264, 264
typefindfunctions: video/x-h263: h263, 263
typefindfunctions: video/mpeg4: m4v
typefindfunctions: video/mpeg-elementary: mpv, mpeg, mpg
typefindfunctions: application/ogg: ogg, oga, ogv, ogm, ogx, spx, anx, axa, axv
typefindfunctions: video/mpegts: ts, mts
typefindfunctions: video/mpeg-sys: mpe, mpeg, mpg
typefindfunctions: audio/x-gsm: gsm
typefindfunctions: audio/x-dts: dts
typefindfunctions: audio/x-ac3: ac3, eac3
typefindfunctions: audio/mpeg: mp3, mp2, mp1, mpga
typefindfunctions: audio/x-mod: 669, amf, ams, dbm, digi, dmf, dsm, gdm, far, imf, it, j2b, mdl, med, mod, mt2, mtm, okt, psm, ptm, sam, s3m, stm, stx, ult, umx, xm
typefindfunctions: audio/x-ttafile: tta
typefindfunctions: application/x-apetag: mp3, ape, mpc, wv
typefindfunctions: application/x-id3v1: mp3, mp2, mp1, mpga, ogg, flac, tta
typefindfunctions: application/x-id3v2: mp3, mp2, mp1, mpga, ogg, flac, tta
typefindfunctions: video/x-fli: flc, fli
typefindfunctions: audio/mobile-xmf: mxmf
typefindfunctions: audio/riff-midi: mid, midi
typefindfunctions: audio/midi: mid, midi
typefindfunctions: audio/x-imelody: imy, ime, imelody
typefindfunctions: video/x-vcd: dat
typefindfunctions: video/x-cdxa: dat
typefindfunctions: audio/qcelp: qcp
typefindfunctions: video/x-msvideo: avi
typefindfunctions: audio/x-au: au, snd
typefindfunctions: audio/x-musepack: mpc, mpp, mp+
typefindfunctions: video/x-ms-asf: asf, wm, wma, wmv
gio:  giostreamsrc: GIO stream source
gio:  giostreamsink: GIO stream sink
gio:  giosrc: GIO source
gio:  giosink: GIO sink
encoding:  encodebin: Encoder Bin
rawparse:  rawvideoparse: rawvideoparse
rawparse:  rawaudioparse: rawaudioparse
rawparse:  unalignedvideoparse: unalignedvideoparse
rawparse:  unalignedaudioparse: unalignedaudioparse
playback:  parsebin: Parse Bin
playback:  urisourcebin: URI reader
playback:  uridecodebin3: URI Decoder
playback:  uridecodebin: URI Decoder
playback:  decodebin3: Decoder Bin 3
playback:  decodebin: Decoder Bin
playback:  streamsynchronizer: Stream Synchronizer
playback:  subtitleoverlay: Subtitle Overlay
playback:  playsink: Player Sink
playback:  playbin3: Player Bin 3
playback:  playbin: Player Bin 2
app:  appsink: AppSink
app:  appsrc: AppSrc
videoconvert:  videoconvert: Colorspace converter
audioresample:  audioresample: Audio resampler
tcp:  multisocketsink: Multi socket sink
tcp:  multifdsink: Multi filedescriptor sink
tcp:  tcpserversrc: TCP server source
tcp:  tcpserversink: TCP server sink
tcp:  tcpclientsrc: TCP client source
tcp:  tcpclientsink: TCP client sink
tcp:  socketsrc: socket source
coretracers:  leaks (GstTracerFactory)
coretracers:  stats (GstTracerFactory)
coretracers:  rusage (GstTracerFactory)
coretracers:  log (GstTracerFactory)
coretracers:  latency (GstTracerFactory)
adder:  adder: Adder
audioconvert:  audioconvert: Audio converter
subparse:  ssaparse: SSA Subtitle Parser
subparse:  subparse: Subtitle parser
subparse: subparse_typefind: srt, sub, mpsub, mdvd, smi, txt, dks, vtt
coreelements:  streamiddemux: Streamid Demux
coreelements:  valve: Valve element
coreelements:  multiqueue: MultiQueue
coreelements:  typefind: TypeFind
coreelements:  tee: Tee pipe fitting
coreelements:  filesink: File Sink
coreelements:  queue2: Queue 2
coreelements:  queue: Queue
coreelements:  output-selector: Output selector
coreelements:  input-selector: Input selector
coreelements:  identity: Identity
coreelements:  funnel: Funnel pipe fitting
coreelements:  filesrc: File Source
coreelements:  fdsink: Filedescriptor Sink
coreelements:  fdsrc: Filedescriptor Source
coreelements:  fakesink: Fake Sink
coreelements:  fakesrc: Fake Source
coreelements:  downloadbuffer: DownloadBuffer
coreelements:  dataurisrc: data: URI source element
coreelements:  concat: Concat
coreelements:  capsfilter: CapsFilter
videorate:  videorate: Video rate adjuster
staticelements:  bin: Generic bin
staticelements:  pipeline: Pipeline object

Total count: 25 plugins, 253 features

我该如何修复我的环境以使 mp4 和 avi 编解码器在 gstreamer 中工作?

输出apt list gstreamer*

gstreamer-qapt/focal 3.0.5-1ubuntu1 amd64
gstreamer1.0-adapter-pulseeffects/focal 4.7.1-2 amd64
gstreamer1.0-alsa/focal-updates,focal-security,now 1.16.2-4ubuntu0.1 amd64 [installed]
gstreamer1.0-alsa/focal-updates,focal-security 1.16.2-4ubuntu0.1 i386
gstreamer1.0-autogain-pulseeffects/focal 4.7.1-2 amd64
gstreamer1.0-clutter-3.0/focal,now 3.0.27-1 amd64 [installed]
gstreamer1.0-convolver-pulseeffects/focal 4.7.1-2 amd64
gstreamer1.0-crystalhd/focal 1:0.0~git20110715.fdd2f19-13build1 amd64
gstreamer1.0-crystalhd/focal 1:0.0~git20110715.fdd2f19-13build1 i386
gstreamer1.0-crystalizer-pulseeffects/focal 4.7.1-2 amd64
gstreamer1.0-doc/focal,focal 1.16.2-2 all
gstreamer1.0-espeak/focal 0.5.0-1 amd64
gstreamer1.0-fluendo-mp3/now 0.10.32.debian-1 amd64 [installed,local]
gstreamer1.0-gl/focal-updates,focal-security,now 1.16.2-4ubuntu0.1 amd64 [installed]
gstreamer1.0-gl/focal-updates,focal-security 1.16.2-4ubuntu0.1 i386
gstreamer1.0-gtk3/focal-updates,focal-security,now 1.16.2-1ubuntu2.1 amd64 [installed,automatic]
gstreamer1.0-gtk3/focal-updates,focal-security 1.16.2-1ubuntu2.1 i386
gstreamer1.0-libav-dbg/focal 1.16.2-2 amd64
gstreamer1.0-libav-dbg/focal 1.16.2-2 i386
gstreamer1.0-libav/focal,now 1.16.2-2 amd64 [installed,automatic]
gstreamer1.0-libav/focal 1.16.2-2 i386
gstreamer1.0-nice/focal,now 0.1.16-1 amd64 [installed,automatic]
gstreamer1.0-nice/focal 0.1.16-1 i386
gstreamer1.0-omx-bellagio-config/focal 1.16.2-1 amd64
gstreamer1.0-omx-generic-config/focal 1.16.2-1 amd64
gstreamer1.0-omx-generic/focal 1.16.2-1 amd64
gstreamer1.0-opencv/focal 1.16.2-2.1ubuntu1 amd64
gstreamer1.0-packagekit/focal-updates,focal-security,now 1.1.13-2ubuntu1.1 amd64 [installed]
gstreamer1.0-pipewire/focal 0.2.7-1 amd64
gstreamer1.0-plugins-bad-dbg/focal 1.16.2-2.1ubuntu1 amd64
gstreamer1.0-plugins-bad-dbg/focal 1.16.2-2.1ubuntu1 i386
gstreamer1.0-plugins-bad-doc/focal,focal 1.16.2-2.1ubuntu1 all
gstreamer1.0-plugins-bad/focal,now 1.16.2-2.1ubuntu1 amd64 [installed,automatic]
gstreamer1.0-plugins-bad/focal 1.16.2-2.1ubuntu1 i386
gstreamer1.0-plugins-base-apps/focal-updates,focal-security,now 1.16.2-4ubuntu0.1 amd64 [installed]
gstreamer1.0-plugins-base-apps/focal-updates,focal-security 1.16.2-4ubuntu0.1 i386
gstreamer1.0-plugins-base-dbg/focal-updates,focal-security 1.16.2-4ubuntu0.1 amd64
gstreamer1.0-plugins-base-dbg/focal-updates,focal-security 1.16.2-4ubuntu0.1 i386
gstreamer1.0-plugins-base-doc/focal-updates,focal-updates,focal-security,focal-security 1.16.2-4ubuntu0.1 all
gstreamer1.0-plugins-base/focal-updates,focal-security,now 1.16.2-4ubuntu0.1 amd64 [installed]
gstreamer1.0-plugins-base/focal-updates,focal-security 1.16.2-4ubuntu0.1 i386
gstreamer1.0-plugins-good-dbg/focal-updates,focal-security 1.16.2-1ubuntu2.1 amd64
gstreamer1.0-plugins-good-dbg/focal-updates,focal-security 1.16.2-1ubuntu2.1 i386
gstreamer1.0-plugins-good-doc/focal-updates,focal-updates,focal-security,focal-security 1.16.2-1ubuntu2.1 all
gstreamer1.0-plugins-good/focal-updates,focal-security,now 1.16.2-1ubuntu2.1 amd64 [installed]
gstreamer1.0-plugins-good/focal-updates,focal-security 1.16.2-1ubuntu2.1 i386
gstreamer1.0-plugins-rtp/focal 1.14.4.1 amd64
gstreamer1.0-plugins-ugly-dbg/focal 1.16.2-2build1 amd64
gstreamer1.0-plugins-ugly-dbg/focal 1.16.2-2build1 i386
gstreamer1.0-plugins-ugly-doc/focal,focal 1.16.2-2build1 all
gstreamer1.0-plugins-ugly/focal,now 1.16.2-2build1 amd64 [installed,automatic]
gstreamer1.0-plugins-ugly/focal 1.16.2-2build1 i386
gstreamer1.0-pocketsphinx/focal 0.8.0+real5prealpha+1-6ubuntu4 amd64
gstreamer1.0-pulseaudio/focal-updates,focal-security,now 1.16.2-1ubuntu2.1 amd64 [installed]
gstreamer1.0-pulseaudio/focal-updates,focal-security 1.16.2-1ubuntu2.1 i386
gstreamer1.0-python3-dbg-plugin-loader/focal 1.16.2-2 amd64
gstreamer1.0-python3-plugin-loader/focal 1.16.2-2 amd64
gstreamer1.0-qt5/focal-updates,focal-security 1.16.2-1ubuntu2.1 amd64
gstreamer1.0-qt5/focal-updates,focal-security 1.16.2-1ubuntu2.1 i386
gstreamer1.0-rtsp-dbg/focal 1.16.2-3 amd64
gstreamer1.0-rtsp/focal 1.16.2-3 amd64
gstreamer1.0-tools/focal,now 1.16.2-2 amd64 [installed]
gstreamer1.0-tools/focal 1.16.2-2 i386
gstreamer1.0-vaapi-doc/focal,focal 1.16.2-2 all
gstreamer1.0-vaapi/focal,now 1.16.2-2 amd64 [installed,automatic]
gstreamer1.0-x/focal-updates,focal-security,now 1.16.2-4ubuntu0.1 amd64 [installed]
gstreamer1.0-x/focal-updates,focal-security 1.16.2-4ubuntu0.1 i386

答案1

也许您遇到了另一个 python 安装(例如来自 anaconda)的“干扰”。请检查which -a pythonwhich -a python3。如果发现可疑情况,请尝试修复该问题并再次播放 mp4 文件。

我必须这样做。有一次,我修改了我的~/.bashrcanaconda,包括

export PATH="${ANACONDA_DIR}/bin${PATH:+:${PATH}}"

所以我的默认 Python 来自 anaconda。除其他外,它没有模块,我怀疑这是无法播放视频的gi最终原因之一。gstreamer

更改为

export PATH="${PATH:+${PATH}:}${ANACONDA_DIR}/bin"

我恢复了 的使用/usr/bin/python3,其中有可用的模块gi,也许还有其他模块。现在gstreamer可以播放视频。

相关内容