Convert video to WebM using GStreamer

2019-03-10 06:44发布

问题:

Documentation for GStreamer is confusing. This is still no excuse for resorting to StackOverflow.com, but still:

What is the GStreamer command line to convert any video file (from any format) to WebM (+WebM audio)?

This is the only documentation with examples I could find.

I'm stuck somewhere at 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

I'm getting a WARNING: erroneous pipeline: link without source element with no idea how to to get this thing going.

This is pretty frustrating.

Please help, thank you. :)

回答1:

You have the pipeline elements all out of order and you have syntax errors when dealing with named elements. Try something like this:

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.

This will construct the following pipeline:

               filesrc
                  |
              decodebin
                |   |
        +-------+   +-------+
        |                   |
        |                 queue
      queue                 |
        |             progressreport
        |                   |
ffmpegcolorspace       audioconvert
        |                   |
        |             audioresample
      vp8enc                |
        |               vorbisenc
        |                   |
        +-------+   +-------+
                |   |
               webmmux
                  |
               filesink


回答2:

If you have videos with no audio (such as videos from a service like VideoBlocks), remove the audio pipeline.