使用GStreamer将视频转换为WebM

9

GStreamer的文档很混乱。尽管如此,这仍然不是求助于StackOverflow.com的借口:

如何使用GStreamer命令行将任何视频文件(从任何格式)转换为WebM(+ WebM音频)?

这是我找到的唯一带有示例的文档

我在gst-launch-0.10 webmmux name=mux ! filesrc location=oldfile.ext ! filesink location=newfile.webm ! name=demux ! demux. ! ffmpegcolorspace ! vp8enc ! queue ! mux.video_0 ! demux. ! progressreport ! audioconvert ! audiorate ! vorbisenc ! queue ! mux.audio_0处卡住了。

我收到了一个WARNING: erroneous pipeline: link without source element的警告,并不知道该怎么做才能让它正常工作。

这真的很令人沮丧。

请帮忙解决问题,谢谢。 :)

2个回答

18
您的管道元素顺序混乱,并且在处理命名元素时存在语法错误。请尝试像这样的方法:

gst-launch-0.10 filesrc location=oldfile.ext ! decodebin name=demux ! queue ! ffmpegcolorspace ! vp8enc ! webmmux name=mux ! filesink location=newfile.webm demux. ! queue ! progressreport ! audioconvert ! audioresample ! vorbisenc ! mux.

这将构建以下流水线:
               filesrc
                  |
              decodebin
                |   |
        +-------+   +-------+
        |                   |
        |                 queue
      queue                 |
        |             progressreport
        |                   |
ffmpegcolorspace       audioconvert
        |                   |
        |             audioresample
      vp8enc                |
        |               vorbisenc
        |                   |
        +-------+   +-------+
                |   |
               webmmux
                  |
               filesink

我遇到了一个错误。以下是详细信息(将其粘贴到记事本/类似的应用程序中,并将“-->”替换为换行符以使其可读):管道正在预滚动... --> 错误:来自元素/GstPipeline:pipeline0/GstDecodeBin:demux/GstAviDemux:avidemux0的内部数据流错误。 --> 附加调试信息:--> gstavidemux.c(5134):gst_avi_demux_loop():/GstPipeline:pipeline0/GstDecodeBin:demux/GstAviDemux:avidemux0:--> 流媒体已停止,原因未连接 --> 错误:管道不想预滚。 --> 将管道设置为NULL... --> 释放管道... - Ory Band
哪个gstreamer版本?看起来avidemux元素在检测某些流的格式时出现了问题。 - cdhowie
0.10版本适用于OSX操作系统。我使用Homebrew(新版MacPorts)进行了安装。我还在我的VirtualBox Ubuntu上尝试了相同的命令行,它能够完美地工作。我错过了什么吗? - Ory Band
这也发生在非常简单的命令中。例如:gst-launch-0.10 filesrc location=horse.mp3 ! decodebin ! audioconvert ! osxaudiosink 我一直收到 streaming task paused, reason not-linked (-1)pipeline doesn't want to preroll 的错误提示。在我的Ubuntu上可以正常工作(将 osxaudiosink 替换为 alsasink)。 - Ory Band
1
我最终明白了这个问题的根源。我缺少了 gst-ffmpeg 插件。我安装了它,一切都正常了。感谢您的回答和全面的帮助! :) - Ory Band
显示剩余2条评论

1
如果您的视频没有声音(例如来自VideoBlocks等服务的视频),请移除音频流程。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接