FastFlix icon indicating copy to clipboard operation
FastFlix copied to clipboard

Error during VP9 bitrate encoding

Open BuyMyMojo opened this issue 4 years ago • 4 comments

I get this error during the second pass:

[libvpx-vp9 @ 0x55e0931b8f40] Failed to initialize encoder: Invalid parameter
[libvpx-vp9 @ 0x55e0931b8f40]   Additional information: rc_twopass_stats_in.buf not set.
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!

These are the raw commands:

First pass: "/usr/bin/ffmpeg" -y -i "/home/buymymojo/Videos/Source.mkv" -map 0:0 -c:v libvpx-vp9 -pix_fmt yuv420p -row-mt 1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -passlogfile "/home/buymymojo/.local/share/FastFlix/temp_6f5db49dc2784ff259a69287/pass_log_file_d67079147a92138ce44e" -speed:v 4 -b:v 6000k -quality:v realtime -profile:v 0 -tile-columns:v -1 -tile-rows:v -1 -pass 1 -an -f webm /dev/null

Second pass: "/usr/bin/ffmpeg" -y -i "/home/buymymojo/Videos/Source.mkv" -map 0:0 -c:v libvpx-vp9 -pix_fmt yuv420p -row-mt 1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -passlogfile "/home/buymymojo/.local/share/FastFlix/temp_6f5db49dc2784ff259a69287/pass_log_file_d67079147a92138ce44e" -speed:v 8 -b:v 6000k -quality:v realtime -profile:v 0 -tile-columns:v -1 -tile-rows:v -1 -pass 2 -map_metadata 0 -map_chapters -1 -map 0:1 -metadata:s:1 title="" -metadata:s:1 handler="" -metadata:s:1 language=eng -c:1 libopus -b:1 128k -default_mode infer_no_subs "/home/buymymojo/Videos/Source-fastflix-e7cb.mkv"

BuyMyMojo avatar Oct 26 '21 02:10 BuyMyMojo

The issue seems to be when having the speed set to realtime

BuyMyMojo avatar Oct 26 '21 02:10 BuyMyMojo

After playing with this a bit, it seems that realtime doesn't support dual pass mode. I need to set up some logic to use single pass when setting it to realtime mode with bitrate.

cdgriffith avatar Nov 03 '21 20:11 cdgriffith

Resolved in 4.5.1 https://github.com/cdgriffith/FastFlix/releases/tag/4.5.1

cdgriffith avatar Nov 10 '21 14:11 cdgriffith

Reproduced in Debian 12 (Stable) with ffmpeg version 5.1.6

$ ffmpeg -y -err_detect ignore_err -i /home/user/lemon.mkv -cpu-used 0 -threads 0 -deadline realtime -map 0:v -map 0:a -map 0:s -b:v 0 -tune-content film -af aformat=channel_layouts='7.1|5.1|stereo' -ac 2 -pass 1 -an -f webm -y /dev/null
$ ffmpeg -y -err_detect ignore_err -i /home/user/lemon.mkv -cpu-used 0 -threads 0 -deadline realtime -map 0:v -map 0:a -map 0:s -b:v 0 -tune-content film -af aformat=channel_layouts='7.1|5.1|stereo' -ac 2 -pass 2 /tmp/lemon.webm

and ffmpeg only proceeds second pass if I remove this one: -map 0:v (no video track encoding) Using -deadline parameter with any value or not uting it, has no effect on fail. Same with bit_rate, rate, width or height.

[libopus @ 0x5640501bd2c0] No bit rate set. Defaulting to 96000 bps.
[libopus @ 0x5640501c0c00] No bit rate set. Defaulting to 96000 bps.
[libvpx-vp9 @ 0x5640501bffc0] v1.12.0
[libvpx-vp9 @ 0x5640501bffc0] Neither bitrate nor constrained quality specified, using default CRF of 32
[libvpx-vp9 @ 0x5640501bffc0] vpx_codec_enc_cfg
[libvpx-vp9 @ 0x5640501bffc0] generic settings
  g_usage:                      0
  g_threads:                    12
  g_profile:                    0
  g_w:                          1274
  g_h:                          692
  g_bit_depth:                  8
  g_input_bit_depth:            8
  g_timebase:                   {1/25}
  g_error_resilient:            0
  g_pass:                       2
  g_lag_in_frames:              25
[libvpx-vp9 @ 0x5640501bffc0] rate control settings
  rc_dropframe_thresh:          0
  rc_resize_allowed:            0
  rc_resize_up_thresh:          60
  rc_resize_down_thresh:        30
  rc_end_usage:                 3
  rc_twopass_stats_in:          (nil)(0)
  rc_target_bitrate:            256
[libvpx-vp9 @ 0x5640501bffc0] quantizer settings
  rc_min_quantizer:             0
  rc_max_quantizer:             63
[libvpx-vp9 @ 0x5640501bffc0] bitrate tolerance
  rc_undershoot_pct:            25
  rc_overshoot_pct:             25
[libvpx-vp9 @ 0x5640501bffc0] temporal layering settings
  ts_number_layers:             1
[libvpx-vp9 @ 0x5640501bffc0] 
  layer_target_bitrate:         0 0 0 0 0 
[libvpx-vp9 @ 0x5640501bffc0] 
  ts_rate_decimator:            0 0 0 0 0 
[libvpx-vp9 @ 0x5640501bffc0] 
  ts_periodicity:               0
[libvpx-vp9 @ 0x5640501bffc0] 
  ts_layer_id:                  0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
[libvpx-vp9 @ 0x5640501bffc0] decoder buffer model
  rc_buf_sz:                    6000
  rc_buf_initial_sz:            4000
  rc_buf_optimal_sz:            5000
[libvpx-vp9 @ 0x5640501bffc0] 2 pass rate control settings
  rc_2pass_vbr_bias_pct:        50
  rc_2pass_vbr_minsection_pct:  0
  rc_2pass_vbr_maxsection_pct:  2000
[libvpx-vp9 @ 0x5640501bffc0]   rc_2pass_vbr_corpus_complexity:0
[libvpx-vp9 @ 0x5640501bffc0] keyframing settings
  kf_mode:                      1
  kf_min_dist:                  0
  kf_max_dist:                  128
[libvpx-vp9 @ 0x5640501bffc0] 
[libvpx-vp9 @ 0x5640501bffc0] Failed to initialize encoder: Invalid parameter
[libvpx-vp9 @ 0x5640501bffc0]   Additional information: rc_twopass_stats_in.buf not set.
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
[libopus @ 0x5640501bd2c0] 1 frames left in the queue on closing
[libopus @ 0x5640501c0c00] 1 frames left in the queue on closing

narcisgarcia avatar Apr 26 '25 15:04 narcisgarcia