0

我正在尝试设置一个管道以使用 gstreamer-0.10 在 Linux 中播放来自 OGG 文件的视频流。我需要使用 gst-launch 实用程序从命令行执行此操作。我可以使用以下命令成功播放音频和视频流:

$ gst-launch-0.10 playbin uri=file:///projects/demo.ogv

我还可以使用以下命令设置管道来播放视频测试文件:

$ gst-launch-0.10 videotestsrc ! autovideosink

但我似乎无法拼凑出合适的管道来播放来自 OGG 解复用器的视频流。

根据 gstreamer 文档(图 3 - http://docs.gstreamer.com/display/GstSDK/Basic+tutorial+3%3A+Dynamic+pipelines),OGG demuxer 视频接收器应该是 src_02。gst-inspect 命令似乎支持这一点:

$ gst-inspect oggdemux
...
Pad Templates:
SRC template: 'src_%d'
    Availability: Sometimes
    Capabilities:
    ANY

SINK template: 'sink'
    Availability: Always
    Capabilities:
      application/ogg
      application/x-annodex
...

并根据本教程指定垫(http://docs.gstreamer.com/display/GstSDK/Basic+tutorial+10%3A+GStreamer+tools),我相信我从文件中播放视频流的命令会看起来像这样:

$ gst-launch-0.10 filesrc location=demo.ogv ! oggdemux name=d d.src_02 ! theoradec ! autovideosink

但这些是我的跑步结果。一切似乎都挂起“预滚动”,我需要用 Ctrl+C 打断才能返回命令行:

$ gst-launch-0.10 filesrc location=demo.ogv ! oggdemux name=d d.src_02 ! theoradec ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
^C
Caught interrupt -- handling interrupt.
Interrupt: Stopping pipeline ...
(gst-launch-0.10:7625): GLib-CRITICAL **: Source ID 1 was not found when attempting to remove it
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

有任何想法吗?

也可能有见地:

$ gst-typefind-0.10 demo.ogv 
demo.ogv - application/x-annodex

$ gst-discoverer-0.10 demo.ogv 
Analyzing file:///projects/keypr/demo.ogv
Done discovering file:///projects/keypr/demo.ogv

Topology:
  container: Ogg
    audio: Vorbis
    video: Theora

Properties:
  Duration: 0:00:05.546666666
  Seekable: yes
  Tags: 
      container format: Ogg
      application name: ffmpeg2theora-0.26
      extended comment: SOURCE_OSHASH=d1af78a82e61d18f
      encoder: Xiph.Org libtheora 1.1 20090822 (Thusnelda)
      encoder version: 0
      nominal bitrate: 110000
      bitrate: 110000
      video codec: Theora
      audio codec: Vorbis

更新:我能够使用以下命令仅播放音频流:

$ gst-launch-0.10 uridecodebin uri=file:///path/to/demo.ogv ! audioconvert ! autoaudiosink

请注意,它在使用filesrc location=demo.ogv. 仅当我使用 uridecodebin 时。而且我仍然无法隔离视频流。

更新2:我偶然发现了一个隔离和播放视频流的管道,但我不明白:

$ gst-launch-0.10 uridecodebin uri=file:///path/to/demo.ogv ! theoraenc ! oggmux ! oggdemux ! theoradec ! ffmpegcolorspace ! videoscale ! ximagesink

我在冲浪 ( http://wiki.laptop.org/go/GStreamer/Developers ) 时发现了它,并看到了 videotestsrc 的演示执行。

$ gst-launch-0.10 videotestsrc ! theoraenc ! oggmux ! oggdemux ! theoradec ! ffmpegcolorspace ! videoscale ! ximagesink

谁能解释为什么这有效?这似乎对文件进行编码、复用、解复用、解码,然后将其过滤/缩放到接收器中。这有什么意义?

4

2 回答 2

1

如果已知 uridecodebin 可以为您提供良好的视频管道,而您只想复制它,则可以尝试以下操作。

1) 设置环境变量 GST_DEBUG_DUMP_DOT_DIR。

export GST_DEBUG_DUMP_DOT_DIR=/tmp

2) 运行您的 gst-launch 命令。

3) 在 /tmp 你应该看到如下文件

  • 0.00.00.010839464-gst-launch.NULL_READY.dot
  • 0.00.00.100795940-gst-launch.READY_PAUSED.dot
  • 0.00.00.104255451-gst-launch.PAUSED_PLAYING.dot
  • 0.00.00.988712046-gst-launch.PLAYING_READY.dot

4) 如果您还没有,请安装 graphviz。

5) 运行“dot”程序以创建所使用的管道 GStreamer 的 PNG 文件。以“PAUSED_PLAYING”文件为基础。

dot -Tpng 0.00.00.104255451-gst-launch.PAUSED_PLAYING.dot  -o /tmp/out.png
于 2014-12-18T15:40:53.260 回答
0

这实际上没有意义,而且是完全错误的:)

您将要使用:

gst-launch-0.10 uridecodebin uri=file:///path/to/demo.ogv ! ffmpegcolorspace ! autovideosink

只播放视频部分。当然,使用 filesrc 是行不通的,因为您将尝试将文件的内容(即经过多路复用和编码的内容)发送到只能处理原始音频的 audioconvert。如果你想手工构建整个管道,你可以这样做:

gst-launch-0.10 filesrc location=demo.ogv ! oggdemux ! theoradec ! ffmpegcolorspace ! autovideosink

附带说明一下,您应该使用 gstreamer 1.0,除非您有充分的理由不这样做。

干杯:)

于 2014-12-17T05:45:21.997 回答