Convert video to WebM using GStreamer

Ory Band picture Ory Band · Jan 10, 2011 · Viewed 11.5k times · Source

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. :)

Answer

cdhowie picture cdhowie · Jan 10, 2011

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