Log in

View Full Version : WebM encoding using ffmpeg


stax76
24th June 2010, 11:27
I'm not sure if WebM is well supported in ffmpeg, it is encoding but ignores setting a bitrate.


-i: input
-y: overwrite
-b: bitrate

ffmpeg.exe -i "D:\sample.avs" -y -b 300 test.webm

-


I know there is some other command line encoder but for StaxRip it would make sense to use ffmpeg since it has many codecs StaxRip could offer a GUI for.

Chikuzen
24th June 2010, 12:05
-b 300k

stax76
24th June 2010, 12:13
Thanks, that's not documented, maybe I should search a tutorial instead of using the official documentation, are there any good tutorials?

nm
24th June 2010, 12:26
Thanks, that's not documented
Both the bits/s unit and the k suffix are described in official documentation:

ffmpeg -h:
-b bitrate set bitrate (in bits/s)

http://www.ffmpeg.org/ffmpeg-doc.html#SEC10
`-b bitrate'
Set the video bitrate in bit/s (default = 200 kb/s).

http://www.ffmpeg.org/ffmpeg-doc.html#SEC7
* To set the video bitrate of the output file to 64kbit/s:

ffmpeg -i input.avi -b 64k output.avi

stax76
24th June 2010, 12:32
I missed that, thanks.

Chikuzen
24th June 2010, 18:14
another tutorial for webm encoding with ffmpeg
http://micksam7.com/blog/index.php/?p=743

stax76
24th June 2010, 18:58
Thanks, exactly what I needed.

ricardo.santos
24th June 2010, 20:51
whatever i try ffmpeg (latest builds) give me oversized output and dont respect bitrate, if i select 450k it gives me 930k i tried several values and still the same.

i compared with other codecs (flv, h264, wmv) and at same video bitrate the ffmpeg webm output is way to big... its not a mediainfo bug... ivfenc is the only that respects video bitrate

Selur
4th July 2010, 11:21
@stax76: this spreadsheet (http://spreadsheets.google.com/ccc?key=0AvWxUS1XGCPAdGNtNW10a2p4c1VwdG1VZk1uMl9MUEE&hl=en#gid=0) might be interesting to you, it's a ffmpeg<>ivfenc parameter mapping I started to set up (it's free to edit, so if someone finds a mistake -> fix it!). :)
@ricardo.santos: how do your settings look like with ffmpeg and with ivfenc ?

Leeloo Minaļ
4th July 2010, 14:27
I did a little test with a very latest FFmpeg build (24035, July 4) and Nic's ivfenc 1.5 from the following sample :
399 frames at 55fps (~ 7,25 seconds) (no audio)

ivfenc
Command line :
ivfenc.exe temp.avs temp.ivf --best --target-bitrate=700
mkvmerge.exe --timecode-scale 1000000 --disable-lacing -w temp.ivf -o temp.webm
Speed : ~ 2fps
Final size : 587 KB


ffmpeg
Command line :
ffmpeg.exe -i temp.avs -vb 700k -level 100 -an test.webm
Speed : ~ 25fps
Final size : 1,66 MB

FFmpeg does not seem to take care of parameters...

ricardo.santos
4th July 2010, 18:37
ffmpeg
Command line :
ffmpeg.exe -i temp.avs -vb 700k -level 100 test.webm
Speed : ~ 25fps
Final size : 1,66 MB

FFmpeg does not seem to take care of parameters...

ffmpeg has converted the audio with default values, you need to specify "no sound" in the bat script... but even then it still oversizes

@selur
will post it later...

Leeloo Minaļ
4th July 2010, 21:05
Little typo error, i used -an in my command line to disable audio, i correct my previous post.

Selur
5th July 2010, 00:08
about the ffmpeg call: isn't '-vcodec libvpx_vp8' needed or is it automatically selected when an output with .webm extension is detected?

stax76
8th August 2010, 17:06
@Selur

spreadsheet was very helpful, thanks

@all

I need a command line to perform a compressibility check, with x264 I just use crf 18, has anybody a idea what I could use for webm with ffmpeg?

LigH
11th September 2010, 09:34
ivfenc doesn't seem to have a 1-pass fixed quantizer mode. Might be related to the fact that WebM video has a purpose target of streaming up to a maximum bitrate.

It might be enforced by max=min quantizer options {ivfenc: --min-q=# --max-q=# | ffmpeg: -qmin # -qmax #} but possibly not without a dummy target bitrate -- to be tested how it behaves... ;) - and if you can get a result in only 1 pass at all (I believe ifvenc creates only the stats file in the 1st, and the result only in the 2nd).

stax76
11th September 2010, 09:44
I'll give it a try, thanks LigH.

ricardo.santos
3rd May 2011, 17:10
Hi everyone!

recently i started to test webm again with latest ffmpeg, but i still have video bitrate issues, altough i specified "-b 450k" or "-b 460800" i always end up with a video with twice as much video bitrate, i then convert the video with x264 and theora with same video and audio settings and their output has the correct bitrate and the file size is half of the webm file.

i know this has been discussed in the past but i havent managed to solve this problem, can anyone share a 2 pass webm script for ffmpeg?

Thanks

ricardo.santos
3rd May 2011, 17:53
i found out why its not working, i usually do all my test encodings with HD clips, and the video bitrate doubling issue only happens with m2ts videos, here's what mediainfo says about the source file, its an LG demo:

Format : BDAV
Format/Info : Blu-ray Video
File size : 35.1 MiB
Duration : 30s 58ms
Overall bit rate : 9 785 Kbps
Maximum Overall bit rate : 35.5 Mbps

Video #0
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Codec ID : 27
Duration : 29s 946ms
Bit rate mode : Variable
Bit rate : 8 610 Kbps
Maximum bit rate : 25.0 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps

i've tried 720p clips and all encodings were sucessfull without bitrate issues, is this an ffmpeg bug with 1080p videos?

LigH
4th May 2011, 08:49
450 kbps for 1080 video?! What shall be the result – visual slime soup?

460800 B * 8 b/B / 1920 / 1080 / 23.976 ~ 0.074 bppf – this is ... ridiculous. :scared:

ricardo.santos
14th May 2011, 21:45
Ligh it was a test... 450k was just one of the examples... i tried with higher bitrates but same thing.

just read any video converter as webm as input/output formats, set up a test conversion and located the CMD any video converter uses with mencoder and it works, tried a 2 pass conversion but a error popped up, does anyone know how to do 2 pass with mencoder?

here's the 1 pass CMD:
mencoder.exe -af volnorm,lavcresample=44100:channels=2 -vf scale=640:-10,harddup -ofps 23.976 -ovc lavc -lavcopts vcodec=libvpx:vbitrate=900 -of lavf -lavfopts format=webm -ffourcc VP80 -srate 44100 -oac lavc -lavcopts acodec=vorbis:abitrate=96:audio_o=global_quality=2000,flags=2 -o output.webm test.m2ts