可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
After looking over the web project I see no evidence of a 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?
Thanks.
回答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.
回答2:
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.
回答3:
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}
回答4:
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.
回答5:
MiroVideoConverter is a nice cross-platform and open-source wrapper around ffmpeg, which, in particular, supports converting to WebM.
回答6:
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
回答7:
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
回答8:
Try it with avconv
:
avconv -i inmovie.mp4 -flags global_header -strict experimental outmovie.webm