How to create a WebM video file?

91,515

Solution 1

You can use ffmpeg to convert to WebM. Make sure to compile it with the --enable-libvpx and --enable-libvorbis flags (see FFmpeg compile guides), or visit the FFmpeg Download page for links to builds that include support. After that, you can use the following command (I'm using input.flv as my example input file):

ffmpeg -i input.flv -vcodec libvpx -acodec libvorbis output.webm

For additional information, see the FFmpeg vpx (WebM) Encoding Guide.

Solution 2

ffmpeg -i input.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output.webm

By default the CRF value can be from 4–63, and 10 is a good starting point. Lower values mean better quality.

Solution 3

I set this up recently, but it's kind of a pain. Here's what I had to do:

First, build ffmpeg from source to include the libvpx drivers (even if your using a version that has it, you need the newest ones (as of this month) to stream webm because they just did add the functionality to include global headers). I did this on an Ubuntu server and desktop, and this guide showed me how - instructions for other OSes can be found here.

Once you've gotten the appropriate version of ffmpeg/ffserver you can set them up for streaming, in my case this was done as follows.

On the video capture device:

ffmpeg -f video4linux2 -standard ntsc -i /dev/video0 http://<server_ip>:8090/0.ffm
  • The "-f video4linux2 -standard ntsc -i /dev/video0" portion of that may change depending on your input source (mine is for a video capture card).

Relevant ffserver.conf excerpt:

Port 8090
#BindAddress <server_ip>
MaxHTTPConnections 2000
MAXClients 100
MaxBandwidth 1000000
CustomLog /var/log/ffserver
NoDaemon

<Feed 0.ffm>
File /tmp/0.ffm
FileMaxSize 5M
ACL allow <feeder_ip>
</Feed>
<Feed 0_webm.ffm>
File /tmp/0_webm.ffm
FileMaxSize 5M
ACL allow localhost
</Feed>

<Stream 0.mpg>
Feed 0.ffm
Format mpeg1video
NoAudio
VideoFrameRate 25
VideoBitRate 256
VideoSize cif
VideoBufferSize 40
VideoGopSize 12
</Stream>
<Stream 0.webm>
Feed 0_webm.ffm
Format webm
NoAudio
VideoCodec libvpx
VideoSize 320x240
VideoFrameRate 24
AVOptionVideo flags +global_header
AVOptionVideo cpu-used 0
AVOptionVideo qmin 1
AVOptionVideo qmax 31
AVOptionVideo quality good
PreRoll 0
StartSendOnKey
VideoBitRate 500K
</Stream>

<Stream index.html>
Format status
ACL allow <client_low_ip> <client_high_ip>
</Stream>
  • Note this is configured for a server at feeder_ip to execute the aforementioned ffmpeg command, and for the server at server_ip so server to client_low_ip through client_high_ip while handling the mpeg to webm conversation on server_ip (continued below).

This ffmpeg command is executed on the machine previously referred to as server_ip (it handles the actual mpeg --> webm conversion and feeds it back into the ffserver on a different feed):

ffmpeg -i http://<server_ip>:8090/0.mpg -vcodec libvpx http://localhost:8090/0_webm.ffm

Once these have all been started up (first the ffserver, then the feeder_ip ffmpeg process then then the server_ip ffmpeg process) you should be able to access the live stream at http://:8090/0.webm and check the status at http://:8090/

Hope this helps.

Solution 4

For Linux: Open source software available to use vp8 and vp9 codec for linux is Arista for the gnome desktop. Google: Arista Transcoder

For Windows & Linux: Miro Video Converter is also free and open source with a very slick GUI. You can check it out at: Google: mirovideoconverter

FFMPEG is a command line tool and I found it to be the most up-to-date in keeping up with the webmd project. Don't forget to look at the vp8 encoding options provided by the webmproject site https://sites.google.com/a/webmproject.org/wiki/ffmpeg. You should also take a look at the VPX Encoding Guide: https://trac.ffmpeg.org/wiki/vpxEncodingGuide

Another post mentioned vpxenc.exe However, vpxenc.exe needs to be compiled by source.

FFMEG Example Uses: Replace {NPUT} and {OUTPUT} to the file location. On Windows 7 I had to use the power shell (Start > Accessories > Windows Power Shell > Power Shell) and provide the full location for ffmpeg, input and output. Note the parameter -vcodec libvpx uses VP8 by default. To use VP9 replace with -vcodec libvpx-vp9

WedmbSD

ffmeg.exe -i {INPUT} -s hd480 -vcodec libvpx -g 120 -lag-in-frames 16 -deadline good -cpu-used 0 -vprofile 0 -qmax 63 -qmin 0 -b:v 768k -acodec libvorbis -ab 112k -ar 44100 -f webm {OUTPUT}

Solution 5

MiroVideoConverter is a nice cross-platform and open-source wrapper around ffmpeg, which, in particular, supports converting to WebM.

Share:
91,515
Marneau
Author by

Marneau

Updated on July 08, 2022

Comments

  • Marneau
    Marneau almost 2 years

    After looking around the web, I found no way to generate a WebM video. I see drivers for Windows and QuickTime, but no evidence that the most common utility FFmpeg is being supported.

    Is there any open source converter that produces WebM?