Related
I'm building Electron app and I use ffmpeg to convert m4a or webm files to mp3, and also to merge video only mp4 with m4a audio file to mp4.
I am able to achieve this using [media-autobuild-suite] (https://github.com/jb-alvarado/media-autobuild_suite), using light build option, but the size of static files is arround 20mb and I'would like to shrink it a little bit more. I've compiled ffmpeg and ffprobe with this configuration.
--disable-libaom
--disable-version3
# Full
--disable-chromaprint
--disable-cuda-sdk
--disable-decklink
--disable-frei0r
--disable-libbs2b
--disable-libcaca
--disable-libcdio
--disable-libfdk-aac
--disable-libflite
--disable-libfribidi
--disable-libgme
--disable-libgsm
--disable-libilbc
--disable-libkvazaar
--disable-libmodplug
--disable-libnpp
--disable-libopenh264
--disable-libopenmpt
--disable-librtmp
--disable-librubberband
--disable-libssh
--disable-libtesseract
--disable-libxavs
--disable-libzmq
--disable-libzvbi
--disable-opencl
--disable-opengl
--disable-libvmaf
--disable-libcodec2
--disable-libsrt
--disable-ladspa
--disable-ffplay
#--enable-vapoursynth
#--enable-liblensfun
--disable-libndi_newtek
--enable-demuxer=mp3
--enable-demuxer=mov
--enable-demuxer=opus
--enable-parser=ac3
--enable-parser=mpegaudio
--enable-parser=h264
--enable-parser=opus
--enable-protocol=file
--enable-protocol=pipe
--enable-decoder=mp3
--enable-decoder=mp4
--enable-decoder=opus
--enable-encoder=mp3
--enable-encoder=mp4
--enable-encoder=opus
With this configuration I'm getting ffmpeg static file arround 2mb and ffprobe static file arround 2mb but with this error.
C:\Users\Admin\Desktop\ffmpeg compilations\2mb\local64>ffmpeg -i simple.m4a simple.mp3
ffmpeg version N-93147-g9326117bf6 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 8.2.1 (Rev1, Built by MSYS2 project) 20181214
configuration: .... //here comes configuration as described above
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 47.102 / 58. 47.102
libavformat 58. 26.101 / 58. 26.101
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'simple.m4a':
Metadata:
major_brand : dash
minor_version : 0
compatible_brands: iso6mp41
creation_time : 2018-10-31T19:47:32.000000Z
Duration: 00:02:38.92, start: 0.000000, bitrate: 127 kb/s
Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, 7 kb/s (default)
Metadata:
creation_time : 2018-10-31T19:47:32.000000Z
handler_name : SoundHandler
[NULL # 0000000000486200] Unable to find a suitable output format for 'simple.mp3'
simple.mp3: Invalid argument
Any ideas what else should I include into this static file?
No need to disable things piecemeal: just use --disable-everything then enable what you need.
Here's an example you can start out with:
./configure
--disable-everything
--disable-network
--disable-autodetect
--enable-small
--enable-decoder=aac*,ac3*,opus,vorbis
--enable-demuxer=mov,m4v,matroska
--enable-muxer=mp3,mp4
--enable-protocol=file
--enable-libshine
--enable-encoder=libshine
--enable-filter=aresample
Final binary size will be around 2-3 MB.
No need to enable any parsers: the selected decoders will automatically select whichever are required.
FFmpeg does not have a native MP3 encoder, so you'll need to use an external library such as libmp3lame or libshine. Since you mentioned Android I assumed you'll want libshine instead of libmp3lame to encode MP3.
Test thoroughly. I probably forgot something.
If you really want to go nuts then use --disable-all instead of --disable-everything and you'll additionally have to manually include the FFmpeg libraries that you want, but that's more work and more headache for not much return.
This will allow you to encode MP3 audio from most M4A and Webm inputs:
ffmpeg -i input.webm output.mp3
And will also let you re-mux MP4/M4V + M4A into MP4:
ffmpeg -i video.m4v -i audio.m4a -map 0:v -map 0:a -c copy output.mp4
I tried downloading a video with youtube-dl with 3gp format. When I try to play it on VLC or any other application it doesn't play. This is the output I get when trying to download it again.
youtube-dl https://youtu.be/lVFq__mrmlQ -f worst -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['https://youtu.be/lVFq__mrmlQ', '-f', 'worst', '-v']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.03.14
[debug] Python version 3.6.5 (CPython) - Linux-4.15.0-29-generic-x86_64-with-Ubuntu-18.04-bionic
[debug] exe versions: ffmpeg 3.4.2-2, ffprobe 3.4.2-2, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] lVFq__mrmlQ: Downloading webpage
[youtube] lVFq__mrmlQ: Downloading video info webpage
[youtube] lVFq__mrmlQ: Extracting video information
[debug] Invoking downloader on 'https://r4---sn-h5q7dnee.googlevideo.com/videoplayback?signature=5432A7990BB3336616E21753F1D53171D09CBC31.B98E84CF0C51F39C613F53311128CD9E7A3872EA&c=WEB&lmt=1514133618343257&key=yt6&itag=17&fvip=3&mn=sn-h5q7dnee%2Csn-h5q7knes&mm=31%2C29&pl=24&mime=video%2F3gpp&id=o-AKWLZ7MpY1ip3PlxZJ7vXBY-jDqbVpUeI_Bls_o_g-GV&ipbits=0&requiressl=yes&ip=90.174.4.0&gir=yes&mt=1532653244&ms=au%2Crdu&dur=18470.684&initcwndbps=1011250&ei=S29aW5SjH4bIVseNkfgE&expire=1532674987&mv=m&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&clen=195336027&source=youtube&ratebypass=yes'
[download] Heroes of Might and Magic III - No Might 1v7 FFA (200%)-lVFq__mrmlQ.3gp has already been downloaded
[download] 100% of 186.29MiB
I tried converting it with ffmpeg, but I get the following message:
ffmpeg -i Heroes\ of\ Might\ and\ Magic\ III\ -\ No\ Might\ 1v7\ FFA\ \(200%\)-lVFq__mrmlQ.3gp Heroes\ of\ Might\ and\ Magic\ III\ -\ No\ Might\ 1v7\ FFA\ \(200%\)-lVFq__mrmlQ.mp4
ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu2)
configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --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-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0x562e75c728c0] Could not find codec parameters for stream 0 (Video: mpeg4 (mp4v / 0x7634706D), none, 221 kb/s): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Heroes of Might and Magic III - No Might 1v7 FFA (200%)-lVFq__mrmlQ.3gp':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2017-12-24T16:43:17.000000Z
Duration: 05:07:50.68, bitrate: 84 kb/s
Stream #0:0(und): Video: mpeg4 (mp4v / 0x7634706D), none, 221 kb/s, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
Metadata:
creation_time : 2017-12-24T16:43:17.000000Z
handler_name : IsoMedia File Produced by Google, 5-11-2011
Output #0, mp4, to 'Heroes of Might and Magic III - No Might 1v7 FFA (200%)-lVFq__mrmlQ.mp4':
Output file #0 does not contain any stream
With this information, I don't know how to proceed. I already tried ffmpeg with the max analyzeduration and probesize and it still doesn't work. Any ideas?
EDIT: added list of formats youtube-dl detected.
youtube-dl -F https://youtu.be/lVFq__mrmlQ
[youtube] lVFq__mrmlQ: Downloading webpage
[youtube] lVFq__mrmlQ: Downloading video info webpage
[youtube] lVFq__mrmlQ: Extracting video information
[info] Available formats for lVFq__mrmlQ:
format code extension resolution note
249 webm audio only DASH audio 71k , opus # 50k, 108.83MiB
250 webm audio only DASH audio 85k , opus # 70k, 142.71MiB
171 webm audio only DASH audio 119k , vorbis#128k, 228.14MiB
140 m4a audio only DASH audio 145k , m4a_dash container, mp4a.40.2#128k, 279.77MiB
251 webm audio only DASH audio 152k , opus #160k, 280.97MiB
160 mp4 256x144 144p 114k , avc1.4d400c, 30fps, video only, 91.12MiB
278 webm 256x144 144p 153k , webm container, vp9, 30fps, video only, 176.00MiB
133 mp4 426x240 240p 258k , avc1.4d4015, 30fps, video only, 188.39MiB
242 webm 426x240 240p 261k , vp9, 30fps, video only, 366.78MiB
243 webm 640x360 360p 528k , vp9, 30fps, video only, 751.54MiB
134 mp4 640x360 360p 758k , avc1.4d401e, 30fps, video only, 539.15MiB
244 webm 854x480 480p 896k , vp9, 30fps, video only, 1.43GiB
135 mp4 854x480 480p 1441k , avc1.4d401f, 30fps, video only, 1.40GiB
247 webm 1280x720 720p 1798k , vp9, 30fps, video only, 3.03GiB
136 mp4 1280x720 720p 2673k , avc1.4d401f, 30fps, video only, 2.86GiB
302 webm 1280x720 720p60 2907k , vp9, 60fps, video only, 5.10GiB
298 mp4 1280x720 720p60 4626k , avc1.4d4020, 60fps, video only, 4.11GiB
17 3gp 176x144 small , mp4v.20.3, mp4a.40.2# 24k
36 3gp 320x180 small , mp4v.20.3, mp4a.40.2
43 webm 640x360 medium , vp8.0, vorbis#128k
18 mp4 640x360 medium , avc1.42001E, mp4a.40.2# 96k
22 mp4 1280x720 hd720 , avc1.64001F, mp4a.40.2#192k (best)
The one that got downloaded was number 17.
You passed in -f worst. As the name indicates, -f worst will get you the worst video format, with horrible quality and very little support in many applications, including ffmpeg. In short, you got what you asked for.
To get a better file, ask for something else. For instance, if you just want audio (much smaller than picture for most videos), pass in -x.
If you want the best video quality, simply omit -f worst.
If your device can only play a certain resolution (say 300px width), pass in -f 'bestvideo[width<=300]+bestadio/best[width<=300]'.
If your disk space per video is the limit (e.g. 5GB), pass in -f best[filesize<=5GB].
If your device can only play certain formats, specify that format, with acodec, vcodec, container, or simply ext. For instance, -f worstvideo[ext=mp4]+bestaudio/worst[ext=mp4] will get you the worst-quality MP4 file.
Of course, these selectors can be combined, as in -f worst[ext=mp4][filesize<=5GB]. For more information on all of these options, consult the youtube-dl documentation.
The issue had nothing to do with codecs or ffmpeg. The file got corrupted during download and further attempts to redownload didn't tell me anything about it. Credit to the user phihag for sharing the sha256 of the file.
When I use ffmpeg with mjpeg encoder without hardware acceleration, everything works fine. I use following command:
ffmpeg -nostdin -rtsp_transport udp_multicast -allowed_media_types 'video' -i 'rtsp://MYIP' -ss 00:00:0.00 -f image2pipe -q:v 24 -vf scale=-2:480,format=yuv420p -c:v mjpeg -vframes 1 pipe:1
But, when I try to use mjpeg with hardware acceleration, I always get error:
ffmpeg -nostdin -rtsp_transport udp_multicast -allowed_media_types 'video' -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i 'rtsp://MYIP' -ss 00:00:0.00 -f image2pipe -q:v 24 -vf scale=-2:480,format=yuv420p -c:v mjpeg_vaapi -vframes 1 pipe:1
ffmpeg version N-91514-gc51e0cd Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --pkg-config-flags=--static
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 21.106 / 58. 21.106
libavformat 58. 17.101 / 58. 17.101
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 26.100 / 7. 26.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Input #0, rtsp, from 'rtsp://MYIP':
Metadata:
title : Session streamed with GStreamer
comment : rtsp-server
Duration: N/A, start: 0.180600, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuvj420p(pc, progressive), 800x600, 50 fps, 50 tbr, 90k tbn, 100 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (mjpeg_vaapi))
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
Conversion failed!
I tried with some additional options but it still keeps failing:
ffmpeg -nostdin -rtsp_transport udp_multicast -allowed_media_types 'video' -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i 'rtsp://MYIP' -ss 00:00:0.00 -f image2pipe -q:v 24 -vf "scale_vaapi=w=800:h=600" -b:v 700k -r 25 -vcodec mjpeg_vaapi -vframes 1 pipe:1
ffmpeg version N-91514-gc51e0cd Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --pkg-config-flags=--static
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 21.106 / 58. 21.106
libavformat 58. 17.101 / 58. 17.101
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 26.100 / 7. 26.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Input #0, rtsp, from 'rtsp://MYIP':
Metadata:
title : Session streamed with GStreamer
comment : rtsp-server
Duration: N/A, start: 0.179933, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuvj420p(pc, progressive), 800x600, 50 fps, 50 tbr, 90k tbn, 100 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (mjpeg_vaapi))
[mjpeg_vaapi # 0x374cd80] Encoding entrypoint not found (12 / 7).
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Can please anyone suggest right options to make it work?
so the problem was that my Intel CPU platform was old (Broadwell) and JPEG encoding is supported starting Braswell. Please see all supported codecs by platform on the page
After running the same command on the machine with Skylake CPU on it, it work from the first try :)
When you trying to leverage Intel's hardware encoding, you need to check TWO things
rather your particular intel support the encoder you want
rather your ffmpeg binary fetched from somewhere compiled with the hardware acceleration library or not.
To find out what kind of encoder your Intel support, you simply type:
vainfo|grep -i enc
it will list the encoder which your processor support. In my case, for example, it yields the following:
libva info: VA-API version 1.13.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0
VAProfileMPEG2Simple : VAEntrypointEncSlice
VAProfileMPEG2Main : VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointEncSliceLP
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointEncSliceLP
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
VAProfileHEVCMain : VAEntrypointEncSlice
in my case, my intel cpu does have mjpeg encoding support.
if you can't find anything resembles mjpeg, then, you can pretty much give up the idea of using intel's hardware acceleration to accomplish what you want on that machine.
The next thing you need is to find out rather your ffmpeg binary support Intel's vaapi at the first place. First is to type:
ffmpeg -hide_banner -hwaccels
if one of those line has "vaapi," then, it means the ffmpeg compiled with Intel's hardware acceleration library. If your vainfo command has what you want but the above command doesn't display vaapi, then, you need to get another copy of ffmpeg binary. either from a different source, or compile it on your own.
Next, is to list all the ffmpeg encoder that actually uses vaapi, and hoping one of them resembles mjpeg:
ffmpeg -hide_banner -encoders|grep -i vaapi
In my case, I do have it:
V....D h264_vaapi H.264/AVC (VAAPI) (codec h264)
V....D hevc_vaapi H.265/HEVC (VAAPI) (codec hevc)
V....D mjpeg_vaapi MJPEG (VAAPI) (codec mjpeg)
V....D mpeg2_vaapi MPEG-2 (VAAPI) (codec mpeg2video)
V....D vp8_vaapi VP8 (VAAPI) (codec vp8)
V....D vp9_vaapi VP9 (VAAPI) (codec vp9)
So, in my case, the encoder is there.
if both vainfo and ffmpeg -hwaccels yield what you need but this last step doesn't, then, you need to get another ffmpeg binary from somewhere.
good luck.
I am trying to convert a mov with alpha transparency to webm with alpha transparency, as seen here. I followed the steps explained here to no avail.
From this answer I was able to remove all the black in the video, thus making it transparent but this is not what I need as I already have a transparent mov and would like to convert that to transparent webm format.
ffmpeg -i input.mp4 -c:v libvpx -vf "colorkey=0x000000:0.1:0.1,format=yuva420p" out.webm
This is the ffprobe output of the video I would like to convert to webm with transparency.
built with Apple LLVM version 7.0.2 (clang-700.1.81)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda
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 'input.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2016-01-17 16:04:07
encoder : Mac OS X v? (AVF 1046.9.1, CM 1731.15.20, x86_64)
encoder-eng : Mac OS X v? (AVF 1046.9.1, CM 1731.15.20, x86_64)
Duration: 00:00:06.63, start: 0.000000, bitrate: 63966 kb/s
Stream #0:0(eng): Video: prores (ap4h / 0x68347061), yuva444p10le(bt470bg/smpte240m/bt709), 1920x1080, 63963 kb/s, 25.03 fps, 25 tbr, 600 tbn, 600 tbc (default)
Metadata:
creation_time : 2016-01-17 16:04:07
handler_name : Core Media Data Handler
encoder : Apple ProRes 4444
I've also tried the following command which didn't work for me either.
ffmpeg -y -i input.mov -c:v libvpx-vp9 -b:v 2000k -pass 1 -an -f webm output.webm
I'm using version 2.8.4 of ffmpeg on a Mac, installed with brew. 2.8.5 is the latest version.
Since 2016-07-13, it's possible to encode VP9/webm videos with alpha channel (VP9a). However, the command you use here will create a VP8a video. Assuming you got a copy of ffmpeg compiled after that date, all you need is change the libvpx to libvpx-vp9. You don't need the yuva420p conversion either (is selected by default).
Try
ffmpeg -i input.mov -c:v libvpx -pix_fmt yuva420p out.webm
All of the other solutions resulted in a video of subpar quality. Please ensure that you define the bitrate to your liking. I changed mine from 1M to 2M and was satisfied.
ffmpeg -i "Model 1 V1.mov" -f webm -c:v libvpx -b:v 2M -acodec libvorbis -auto-alt-ref 0 model1v3.webm -hide_banner
If you're using After Effects or Premiere Pro, there's also this plugin, which can be used in Adobe Media Encoder.
WebM-alpha is only defined for VP8. It doesn't work at all for VP9 right now.
This is the command that worked for me for VP8.
ffmpeg -i input.mov -c:v libvpx -pix_fmt yuva420p -b:v 2M -auto-alt-ref 0 output.webm
Accepted option did not work.
Im trying to process a file and run the following command
ffmpeg -i input.webm output.webm
I'm doing it with the ffmpeg library from videoconverter.js. I'm trying to understand what is wrong or how I can fix it.
I end up getting this:
Worker has received command
Received command: -i input.webm output.webm. Processing with 268435456 bits.
ffmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
built on Jun 9 2014 20:24:32 with emcc (Emscripten GCC-like replacement) 1.12.0 (commit 6960d2296299e96d43e694806f5d35799ef8d39c)
configuration: --cc=emcc --prefix=/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist --extra-cflags='-I/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/include -v' --enable-cross-compile --target-os=none --arch=x86_32 --cpu=generic --disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads --disable-network --disable-hwaccels --disable-parsers --disable-bsfs --disable-debug --disable-protocols --disable-indevs --disable-outdevs --enable-protocol=file --enable-libvpx --enable-gpl --extra-libs='/Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libx264.a /Users/bgrinstead/Sites/videoconverter.js/build/ffmpeg/../dist/lib/libvpx.a'
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
[vp8 # 0xed8c00] Warning: not compiled with thread support, using thread emulation
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, matroska,webm, from 'input.webm':
Metadata:
encoder : Chrome
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0(eng): Audio: opus, 48000 Hz, mono (default)
Stream #0:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
[abuffer # 0xedd670] Unable to parse option value "(null)" as sample format
Last message repeated 1 times
Last message repeated 1 times
[abuffer # 0xedd670] Error setting option sample_fmt to value (null).
[graph 1 input from stream 0:0 # 0xedd600] Error applying options to the filter.
Error opening filters!
Finished processing (took 673ms)
The end result is stopped due to 'Unable to parse option value "(null)" as sample format'. How would I solve this?
Your ffmpeg build is using version 2.2.1 which is old and unsupported.
It is too old to natively support Opus decoding (this version requires libopus to decode Opus). Upgrade to a build derived from the development branch ("git master") or at least use the latest release.
You should also use a modern libvpx if possible as well. Note that with recent FFmpeg you will need to remove --disable-bsfs because VP9 is now the default video encoder for Webm and it requires the vp9_superframe bitstream filter (it is automatically applied). Alternatively, you can force VP8 encoding with -c:v libvpx.
Consider adding libopus (preferred) or libvorbis support for Webm; otherwise you'll be using the very crappy and experimental FFmpeg native Vorbis encoder.