Opened 11 years ago

Closed 10 years ago

#3053 closed defect (fixed)

2-pass wmv2 fails with "requested bitrate is too low"

Reported by: Terran Vigil Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: wmv2
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

We've run into a number of files that when encoded to wmv2 using 2-pass, fail with this:

[wmv2 @ 0x7fe5e281fe00] requested bitrate is too low

and then the always helpful:

Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Occasionally, changing the bitrate of the first pass is a workaround. The bitrate of the source video does not seem to have any relationship with the error. Similarly, using a range of target bitrates from 20% to %120 doesn't seem to consistently affect the outcome.

How to reproduce:

Sample file here: http://www1.datafilehost.com/d/8c31dc74

% ffmpeg -i bbb.mp4 -pass 1 -c:v wmv2 -b:v 300k -f null -y /dev/null && ffmpeg -i bbb.mp4 -pass 2 -c:v wmv2 -b:v 300k -y out.wmv
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 16 2013 16:22:18 with Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.0.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.12.100
  Duration: 00:00:15.02, start: 0.000333, bitrate: 835 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 703 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 3.0, fltp, 127 kb/s
    Metadata:
      handler_name    : SoundHandler
Output #0, null, to '/dev/null':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.12.100
    Stream #0:0(und): Video: wmv2, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, pass 1, 200 kb/s, 90k tbn, 24 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: pcm_s16le, 48000 Hz, 3.0, s16, 2304 kb/s
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> wmv2)
  Stream #0:1 -> #0:1 (aac -> pcm_s16le)
Press [q] to stop, [?] for help
frame=  360 fps=208 q=31.0 Lsize=N/A time=00:00:15.01 bitrate=N/A    
video:1399kB audio:4218kB subtitle:0 global headers:0kB muxing overhead -100.000382%
ffmpeg version 2.0.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 16 2013 16:22:18 with Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.0.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.12.100
  Duration: 00:00:15.02, start: 0.000333, bitrate: 835 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 703 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 3.0, fltp, 127 kb/s
    Metadata:
      handler_name    : SoundHandler
[wmv2 @ 0x7fe5e281fe00] requested bitrate is too low
Output #0, asf, to 'out.wmv':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.12.100
    Stream #0:0(und): Video: wmv2, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, pass 2, 300 kb/s, 90k tbn, 24 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: wmav2, 48000 Hz, 3.0, fltp, 128 kb/s
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> wmv2)
  Stream #0:1 -> #0:1 (aac -> wmav2)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Attachments (1)

bbb.mp4 (1.5 MB ) - added by Carl Eugen Hoyos 11 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: 2-pass removed
Priority: importantnormal

Is this a regression?
Is the problem reproducible with current git head?

comment:2 by Terran Vigil, 11 years ago

This is not a regression. It is reproducible from at least 0.11.1 to head.

comment:3 by Terran Vigil, 11 years ago

Note that this is does not happen with wmv1.

by Carl Eugen Hoyos, 11 years ago

Attachment: bbb.mp4 added

comment:4 by Carl Eugen Hoyos, 11 years ago

Reproduced by developer: set
Status: newopen
Version: 2.0.1git-master

A bitrate of 300kb is impossible for the given sample and encoder afaict (so the error message is correct) but I can reproduce the issue with a higher bitrate (that can be reached with a sufficiently high quantiser):

$ ffmpeg -i bbb.mp4 -an -qscale 90 -vcodec wmv2 out.wmv
ffmpeg version N-57252-gfec6d54 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 19 2013 13:03:29 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libx264
  libavutil      52. 47.100 / 52. 47.100
  libavcodec     55. 37.101 / 55. 37.101
  libavformat    55. 19.102 / 55. 19.102
  libavdevice    55.  4.100 / 55.  4.100
  libavfilter     3. 88.101 /  3. 88.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.12.100
  Duration: 00:00:15.02, start: 0.000333, bitrate: 835 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 703 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 3.0, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, asf, to 'out.wmv':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    WM/EncodingSettings: Lavf55.19.102
    Stream #0:0(und): Video: wmv2 (WMV2 / 0x32564D57), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 1k tbn, 24 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> wmv2)
Press [q] to stop, [?] for help
frame=  360 fps=259 q=90.0 Lsize=    1188kB time=00:00:15.00 bitrate= 649.0kbits/s
video:1170kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1.524118%
$ ffmpeg -i bbb.mp4 -an -vb 1000k -pass 1 -vcodec wmv2 out.wmv
ffmpeg version N-57252-gfec6d54 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 19 2013 13:03:29 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libx264
  libavutil      52. 47.100 / 52. 47.100
  libavcodec     55. 37.101 / 55. 37.101
  libavformat    55. 19.102 / 55. 19.102
  libavdevice    55.  4.100 / 55.  4.100
  libavfilter     3. 88.101 /  3. 88.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.12.100
  Duration: 00:00:15.02, start: 0.000333, bitrate: 835 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 703 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 3.0, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, asf, to 'out.wmv':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    WM/EncodingSettings: Lavf55.19.102
    Stream #0:0(und): Video: wmv2 (WMV2 / 0x32564D57), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, pass 1, 1000 kb/s, 1k tbn, 24 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> wmv2)
Press [q] to stop, [?] for help
frame=  360 fps=212 q=21.3 Lsize=    2123kB time=00:00:15.00 bitrate=1159.3kbits/s
video:2096kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1.284990%
$ ffmpeg -i bbb.mp4 -an -vb 1000k -pass 2 -vcodec wmv2 -y out.wmv
ffmpeg version N-57252-gfec6d54 Copyright (c) 2000-2013 the FFmpeg developers
  built on Oct 19 2013 13:03:29 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libx264
  libavutil      52. 47.100 / 52. 47.100
  libavcodec     55. 37.101 / 55. 37.101
  libavformat    55. 19.102 / 55. 19.102
  libavdevice    55.  4.100 / 55.  4.100
  libavfilter     3. 88.101 /  3. 88.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.12.100
  Duration: 00:00:15.02, start: 0.000333, bitrate: 835 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 703 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 3.0, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[wmv2 @ 0x194bee0] requested bitrate is too low
Output #0, asf, to 'out.wmv':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.12.100
    Stream #0:0(und): Video: wmv2, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, pass 2, 1000 kb/s, 90k tbn, 24 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> wmv2)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

comment:5 by Michael Niedermayer, 10 years ago

Resolution: fixed
Status: openclosed

Fixed in ec5e02d49573975ee4bc73be173a2fad76d808ff
also note that -lmax may need to be raised for doing really low quality bitrate based encoding

Note: See TracTickets for help on using tickets.