Reputation: 629
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?
Upvotes: 62
Views: 119634
Reputation: 241
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 {INPUT} 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}
Upvotes: 3
Reputation: 3024
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.
Upvotes: 77
Reputation: 151
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.
Upvotes: 15
Reputation: 11
Another option if you're looking for an easy graphical way to accomplish this is HandBrake (although HandBrake does come in a commandline flavor as well, in case you're scripting the process, or maybe just prefer the commandline). Like the ffmpeg
that others have suggested here, HandBrake is available on Linux, Mac, and Windows, so it won't matter what operating system you're using. The process and interface will be almost exactly the same.
Now, the .webm
container is basically just a Matroska file, but what really makes it webm is the streams it contains. According to the WebM Project, the video stream must be either VP8 or VP9, and the audio stream must be either Vorbis, or Opus, so when using HandBrake, you'll need to make sure you're setting those options properly.
So, to encode a video to webm, naturally, you'll need to select a video, so let's do that first. In the toolbar across the top of the HandBrake window, the first option says "Open Source". It doesn't refer to the nature of the software (even though it is actually Open Source software), but rather it refers to opening a source of video using your operating system's standard file requester window which you've probably seen more than once already. Click that button, and navigate to a video on your system which you'd like to encode to a webm file.
Now that you've got a file selected, a few bits of the interface update with some new information, and you can start to select options for your conversion. There's a buncha interesting choices, but for this answer we'll focus on the ones related to the question of "How to create a webm video file?" rather than go over each option in detail. You can always read the HandBrake Documentation if you're interested in more details.
English (AC3)(5.1 ch)(48khz) Bitrate: 448kbps
for example). The right side of the ->
there lists what format you're converting to from what's on the left. That's where we need to ensure either Vorbis or Opus..webm
file, that your filename actually ends with .webm
, or you're just creating a Matroska file with webm streams. (Totally valid, but some less sophisticated software might get confused if it expects webm and the file is named as something.mkv
despite them being the same thing, just with a different filename.)At this point you should be ready to click "Start Encoding" in the toolbar to immediately begin the encode, or "Add to Queue" if you're encoding many videos and want to just start a list and do them all one after another automagically. And now you just wait. It can take a while, so be patient. It'll let you know when it's done.
Upvotes: 0
Reputation:
FFmpeg. MP4 to WebM. To have lipsync and high-quality
$ ffmpeg -i input.mp4 -b:v 1M -q:v 10 -vcodec libvpx -acodec libvorbis output.webm
ffmpeg version 2.8.6-1ubuntu2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.1 (Ubuntu 5.3.1-11ubuntu1) 20160311
configuration: --prefix=/usr --extra-version=1ubuntu2 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'SPBFRE_01.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2015-05-29 14:49:20
Duration: 00:01:41.61, start: 0.000000, bitrate: 9452 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 9132 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc (default)
Metadata:
creation_time : 2015-05-29 14:49:20
handler_name : ?Mainconcept Video Media Handler
encoder : AVC Coding
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 317 kb/s (default)
Metadata:
creation_time : 2015-05-29 14:49:20
handler_name : #Mainconcept MP4 Sound Media Handler
File 'output.webm' already exists. Overwrite ? [y/N] y
[libvpx @ 0x132af40] v1.5.0
Output #0, webm, to 'output.webm':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf56.40.101
Stream #0:0(eng): Video: vp8 (libvpx), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 1000 kb/s, 50 fps, 1k tbn, 50 tbc (default)
Metadata:
creation_time : 2015-05-29 14:49:20
handler_name : ?Mainconcept Video Media Handler
encoder : Lavc56.60.100 libvpx
Stream #0:1(eng): Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp (default)
Metadata:
creation_time : 2015-05-29 14:49:20
handler_name : #Mainconcept MP4 Sound Media Handler
encoder : Lavc56.60.100 libvorbis
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> vp8 (libvpx))
Stream #0:1 -> #0:1 (aac (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
frame= 755 fps= 10 q=0.0 size= 1987kB time=00:00:15.12 bitrate=1076.5kbits/s
Upvotes: 3
Reputation: 5351
Try it with avconv
:
avconv -i inmovie.mp4 -flags global_header -strict experimental outmovie.webm
Upvotes: 0
Reputation: 2581
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
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>
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.
Upvotes: 6
Reputation: 32063
MiroVideoConverter is a nice cross-platform and open-source wrapper around ffmpeg, which, in particular, supports converting to WebM.
Upvotes: 2
Reputation: 84
I wasn't sure if my copy of FFMPEG supports WebM, so first I converted my MPEG4 video to raw video using FFMPEG.
Then I used the vpxenc.exe provided with the WebM project's SDK to convert this to WebM.
Link to the SDK download: http://code.google.com/p/webm/downloads/list
Download, extract and look in the "bin" folder. There are some sample apps there. A decoder is also provided.
Command I used to convert raw video to WebM:
vpxenc.exe -w 720 -h 480 --rt -o v1.webm v1.yuv
HTH
Upvotes: 1