Opened 3 years ago

Closed 3 years ago

#5037 closed defect (needs_more_info)

WEBM VP8 & VP9 - 2-pass encoding does not work

Reported by: solidghost Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: libvpx
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary:

2-pass encoding does not work when using libvpx-vp9 & libvpx. The output always says "Output file is empty, nothing was encoded", when the first pass is complete. Then it continues with the second pass.

The finished file does not seem to have used information from the first pass because the final bitrate is far from the specified one. Also the quality distribution is far from good.

This is the code string:

ffmpeg -y -i Input.mov -vcodec libvpx-vp9 -f rawvideo -pix_fmt yuv420p -aspect 16:9 -b:v 220k -vminrate 50k -s 420x236 -g 100 -qmin 0 -qmax 63 -an -pass 1 /dev/null && \
ffmpeg -y -i Input.mov -vcodec libvpx-vp9 -f webm -pix_fmt yuv420p -aspect 16:9 -b:v 220k -vminrate 50k -s 420x236 -g 100 -qmin 0 -qmax 63 -an -pass 2 \ out.webm

FFMPEG Output from the Terminal:

Thomas-MacBook-Pro:NEW_ONLINE_SETTINGS Thomas$ ffmpeg -y -i raw.mov -vcodec libvpx-vp9 -f rawvideo -pix_fmt yuv420p -aspect 16:9 -b:v 220k -vminrate 50k -s 420x236 -g 100 -qmin 0 -qmax 63 -an -pass 1 /dev/null && \
> ffmpeg -y -i raw.mov -vcodec libvpx-vp9 -f webm -pix_fmt yuv420p -aspect 16:9 -b:v 220k -vminrate 50k -s 420x236 -g 100 -qmin 0 -qmax 63 -an -pass 2 \ out.webm
ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.0 (clang-700.0.72)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8 --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-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --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 'raw.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2015-11-23 13:44:32
  Duration: 00:00:30.00, start: 0.000000, bitrate: 224330 kb/s
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), rgb24, 720x576, 222782 kb/s, SAR 35:24 DAR 175:96, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2015-11-23 13:44:32
      handler_name    : Apple Alias Data Handler
      encoder         : Animation
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2015-11-23 13:44:32
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2015-11-23 13:44:40
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
[libvpx-vp9 @ 0x7f95a200b800] v1.4.0
Output #0, rawvideo, to '/dev/null':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf56.40.101
    Stream #0:0(eng): Video: vp9 (libvpx-vp9), yuv420p, 420x236 [SAR 944:945 DAR 16:9], q=0-63, pass 1, 220 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2015-11-23 13:44:32
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
      encoder         : Lavc56.60.100 libvpx-vp9
Stream mapping:
  Stream #0:0 -> #0:0 (qtrle (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
frame=  750 fps=134 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded 
ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.0 (clang-700.0.72)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8 --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-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --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 'raw.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2015-11-23 13:44:32
  Duration: 00:00:30.00, start: 0.000000, bitrate: 224330 kb/s
    Stream #0:0(eng): Video: qtrle (rle  / 0x20656C72), rgb24, 720x576, 222782 kb/s, SAR 35:24 DAR 175:96, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2015-11-23 13:44:32
      handler_name    : Apple Alias Data Handler
      encoder         : Animation
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2015-11-23 13:44:32
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2015-11-23 13:44:40
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
[libvpx-vp9 @ 0x7f849401bc00] v1.4.0
Output #0, webm, to ' out.webm':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf56.40.101
    Stream #0:0(eng): Video: vp9 (libvpx-vp9), yuv420p, 420x236 [SAR 944:945 DAR 16:9], q=0-63, pass 2, 220 kb/s, 25 fps, 1k tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2015-11-23 13:44:32
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
      encoder         : Lavc56.60.100 libvpx-vp9
Stream mapping:
  Stream #0:0 -> #0:0 (qtrle (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
frame=  750 fps= 13 q=0.0 Lsize=     844kB time=00:00:30.00 bitrate= 230.4kbits/s    
video:838kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.744376%
Thomas-MacBook-Pro:NEW_ONLINE_SETTINGS Thomas$


ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers

built with Apple LLVM version 7.0.0 (clang-700.0.72)

Change History (9)

comment:1 Changed 3 years ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords libvpx added

Is this issue reproducible with current FFmpeg git head?

comment:2 Changed 3 years ago by solidghost

The version I used was version 2.8, the latest stable version downloaded via "ffmpeg through Homebrew" for OSX. I have tried 2-pass for libvpx this way for this version and all older versions going back 1.5 years.

comment:3 follow-up: Changed 3 years ago by cehoyos

Please test current FFmpeg git head.

comment:4 in reply to: ↑ 3 Changed 3 years ago by solidghost

Replying to cehoyos:

Please test current FFmpeg git head.

Same problem with current FFmpeg git head. (if i managed to install it right. This is not my speciality).

Maybe there is an other way to enable 2-pass with libvpx that I dont know about. But this way works perfectly for libx264.

comment:5 Changed 3 years ago by cehoyos

Please post command lines and console output for current FFmpeg?

comment:6 Changed 3 years ago by cehoyos

I tested the following command lines and the bitrates in the output files are very close to what I requested for vp8:

$ ffmpeg -f lavfi -i testsrc2 -vcodec vp8 -pass 1 -t 120 -vb 500k out1.webm
$ ffmpeg -f lavfi -i testsrc2 -vcodec vp8 -pass 2 -t 120 -vb 500k -y out1.webm
$ ffmpeg -f lavfi -i testsrc2 -vcodec vp8 -pass 1 -t 120 -vb 200k out2.webm
$ ffmpeg -f lavfi -i testsrc2 -vcodec vp8 -pass 2 -t 120 -vb 200k -y out2.webm

vp9 does not produce an output file of the requested size with my old version of libvpx (1.3) but I get different output file sizes for different requested bitrates.

$ ffmpeg -f lavfi -i testsrc2 -vcodec vp9 -pass 1 -t 120 -vb 200k out3.webm
$ ffmpeg -f lavfi -i testsrc2 -vcodec vp9 -pass 2 -t 120 -vb 200k -y out3.webm

comment:7 Changed 3 years ago by solidghost

I just tried whiteout adding "-an" in the first pass. Then the transcoding works and gives no warning about "Output file is empty, nothing was encoded".

This is very strange. It feels like a Bug? Because I should be able to tell the first pass to skip analyzing the Audio. This is how it works with libx264.

Even though it does not complain anymore, the file size and quality on every frame is exactly the same if I do One pass or Two pass encoding. So it still feels like it does not apply the information from the first pass.

comment:8 Changed 3 years ago by cehoyos

Please either test with the command lines I provided or upload your input sample so I can try to reproduce.

Completely unrelated: Please note that if you encode with x264 using -an for the first pass, the resulting encode can be horribly broken depending on the used container and input sample.

comment:9 Changed 3 years ago by cehoyos

  • Resolution set to needs_more_info
  • Status changed from new to closed

Please reopen this ticket if you can explain how to reproduce this issue.

Note: See TracTickets for help on using tickets.