我正在尝试设置一个管道以使用 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
谁能解释为什么这有效?这似乎对文件进行编码、复用、解复用、解码,然后将其过滤/缩放到接收器中。这有什么意义?