Opened 12 years ago
Closed 12 years ago
#2136 closed defect (fixed)
libvpx -crf option is broken
Reported by: | evilsoup | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | libvpx |
Cc: | slhck | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
If I use a -crf of 1-3, libvpx outputs a broken file. If I use a -crf of 0, or of 4+ the files work, but they are terrible quality with irritating artefacts (I haven't tested the entire range, but 0, 4, 5, 23 and 56 all produce working, albeit horrible files).
Using -crf 0
:
evilsoup@enchantment:~/Videos$ ffmpeg -i wonderlove.mov -map 0:v -c:v libvpx -t 30 -crf 0 test0.webm ffmpeg version git-2012-12-18-b7e085a Copyright (c) 2000-2012 the FFmpeg developers built on Dec 20 2012 11:44:19 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-libass libavutil 52. 12.100 / 52. 12.100 libavcodec 54. 80.100 / 54. 80.100 libavformat 54. 49.102 / 54. 49.102 libavdevice 54. 3.102 / 54. 3.102 libavfilter 3. 28.100 / 3. 28.100 libswscale 2. 1.103 / 2. 1.103 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Guessed Channel Layout for Input Stream #0.1 : stereo Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'wonderlove.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2012-03-06 21:55:06 Duration: 00:04:00.08, start: 0.000000, bitrate: 30340 kb/s Stream #0:0(eng): Video: dvvideo (dvcp / 0x70637664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, SAR 59:54 DAR 295:216, 25 fps, 25 tbr, 25 tbn, 25 tbc Metadata: creation_time : 2012-03-06 21:55:06 handler_name : Apple Alias Data Handler timecode : 01:00:00:00 Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s Metadata: creation_time : 2012-03-06 21:55:06 handler_name : Apple Alias Data Handler Stream #0:2(eng): Data: none (tmcd / 0x64636D74) Metadata: creation_time : 2012-03-06 21:55:36 handler_name : Apple Alias Data Handler timecode : 01:00:00:00 File 'test0.webm' already exists. Overwrite ? [y/N] y v1.1.0 Output #0, webm, to 'test0.webm': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt encoder : Lavf54.49.102 Stream #0:0(eng): Video: vp8, yuv420p, 720x576 [SAR 59:54 DAR 295:216], q=-1--1, 200 kb/s, 1k tbn, 25 tbc Metadata: creation_time : 2012-03-06 21:55:06 handler_name : Apple Alias Data Handler timecode : 01:00:00:00 Stream mapping: Stream #0:0 -> #0:0 (dvvideo -> libvpx) Press [q] to stop, [?] for help frame= 750 fps=4.7 q=0.0 Lsize= 965kB time=00:00:30.00 bitrate= 263.4kbits/s video:959kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.631034%
Using -crf 1
(2 and 3 give almost identical output):
evilsoup@enchantment:~/Videos$ ffmpeg -i wonderlove.mov -map 0:v -c:v libvpx -t 30 -crf 1 test1.webm ffmpeg version git-2012-12-18-b7e085a Copyright (c) 2000-2012 the FFmpeg developers built on Dec 20 2012 11:44:19 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-libass libavutil 52. 12.100 / 52. 12.100 libavcodec 54. 80.100 / 54. 80.100 libavformat 54. 49.102 / 54. 49.102 libavdevice 54. 3.102 / 54. 3.102 libavfilter 3. 28.100 / 3. 28.100 libswscale 2. 1.103 / 2. 1.103 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Guessed Channel Layout for Input Stream #0.1 : stereo Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'wonderlove.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2012-03-06 21:55:06 Duration: 00:04:00.08, start: 0.000000, bitrate: 30340 kb/s Stream #0:0(eng): Video: dvvideo (dvcp / 0x70637664), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 28800 kb/s, SAR 59:54 DAR 295:216, 25 fps, 25 tbr, 25 tbn, 25 tbc Metadata: creation_time : 2012-03-06 21:55:06 handler_name : Apple Alias Data Handler timecode : 01:00:00:00 Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s Metadata: creation_time : 2012-03-06 21:55:06 handler_name : Apple Alias Data Handler Stream #0:2(eng): Data: none (tmcd / 0x64636D74) Metadata: creation_time : 2012-03-06 21:55:36 handler_name : Apple Alias Data Handler timecode : 01:00:00:00 [libvpx @ 0xa03f2e0] v1.1.0 Output #0, webm, to 'test1.webm': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt encoder : Lavf54.49.102 Stream #0:0(eng): Video: vp8, yuv420p, 720x576 [SAR 59:54 DAR 295:216], q=-1--1, 200 kb/s, 1k tbn, 25 tbc Metadata: creation_time : 2012-03-06 21:55:06 handler_name : Apple Alias Data Handler timecode : 01:00:00:00 Stream mapping: Stream #0:0 -> #0:0 (dvvideo -> libvpx) Press [q] to stop, [?] for help [libvpx @ 0xa03f2e0] Error encoding frame: Invalid parameter [libvpx @ 0xa03f2e0] Additional information: cq_level out of range [cfg->rc_min_quantizer..cfg->rc_max_quantizer] Video encoding failed
I apologise if I've simply misunderstood how to use libvpx, but documentation is pretty sparse.
Change History (8)
comment:1 by , 12 years ago
Component: | FFmpeg → avcodec |
---|---|
Keywords: | vp8 webm crf removed |
comment:2 by , 12 years ago
comment:4 by , 12 years ago
Replying to cehoyos:
Please consider sending a patch to ffmpeg-devel.
I sent a patch that fixes this issue.
Sorry for actually sending two patches -- I had discovered one problem too late and this is my first time contributing.
comment:6 by , 12 years ago
Yes, this is fixed now.
You can now correctly set qmin
to 0 to specify a lower CRF, and if CRF is not within the correct bounds, a more verbose error message will be displayed.
comment:7 by , 12 years ago
Replying to cehoyos:
Is this problem fixed in git head?
Sorry if you didn't get this ping, anyway this is fixed in Git HEAD.
@evilsoup: If you get bad quality even with low CRF settings, don't forget to choose a higher target (actually, maximum) bit rate. The default is rather low IIRC.
comment:8 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The error is that the minimum quantizer value is 4 by default. If you set any CRF value below that, it simply doesn't make sense.
Users should be able to override this by setting
-qmin
to 0, however with the current code this is not possible, sinceqmin
can only be set to anything larger than 0.libvpxenc.c
, line 288 should therefore be:instead of
Because of this bug, the only workaround is to set a
-qmin
of 1 and, consequently, a CRF of 1 will work.Also, the check for
qmax
should includeif (avctx->qmax > avctx->qmin)
as well, since it can never be lower thanqmin
.