Converting a video to WebM with gstreamer on the commandline

WebM is a new video format. Google bought the original developers and have open sourced it. It's probably one of the best open source video formats, and it supported natively by Firefox and Google Chrome/Chromium. Browser support for WebM, more about HTML5 video format, Basic gstreamer usage on command line. ## Video only no audio WebM convert This simple example will turn a file ``video.mov`` into a WebM file called ``video.webm``. It'll truncate the sound, and will only do the video. gst-launch-0.10 filesrc location=video.mov ! decodebin ! vp8enc ! webmmux ! filesink location=video.webm ### vp8enc This new element will take a video stream and convert it into vp8 format, which is the video codec for webm files, it takes a raw video input, and puts out the vp8 encoded output. ### webmmux Files (like a WebM file) contain audio and video. This example only does the video, but you still need to put it in a container format, the WebM container format. You do that with the ``webmmux``. ## Audio and Video This will convert a video file ``video.mov`` to a webm file ``video.webm`` including audio. gst-launch-0.10 filesrc location=video.mov ! decodebin name=input ! queue ! vp8enc ! webmmux name=mux ! filesink location=video.webm input. ! queue ! audioconvert ! vorbisenc ! mux. source. This pipeline has several new features. ### decodebin name=… I'm giving the ``decodebin`` element a name. This allows me to use the output of it later. ### queue This element is needed if you're doing more than one kind of conversion, you should put a ``queue`` element 'up stream' of where you do things. ### input. and mux. The ``.`` (dot) is used to refer to elements that have a ``name`` and split the output. So the output from ``input`` is put through ``audioconvert`` and then ``vorbisenc`` and then given to ``mux``, i.e. the ``webmmux``. Since muxers (like ``webmmux``) mix an audio and video into one file, you are giving it 2 inputs, an audio stream and a video stream. ### audioconvert & vorbisenc This elements obviously take in audio and convert them. ``vorbisenc`` obviously converts an audio stream to vorbis, the audio format for webm. I'm not sure what ``audioconvert`` does, but it seems to be required. (The pipeline doesn't start without it).

This entry is tagged: