Skip to content

VVC 2-pass encoding fails with current FFmpeg/libvvenc because FastFlix passes obsolete pass and rcstatsfile parameters via -vvenc-params #768

Description

@bcodemz

FastFlix version

FastFlix 6.x Windows packaged release

Operating system

Windows 10/11 x64

Description

VVC encoding works in QP/single-pass mode, but selecting bitrate mode causes the encode to fail immediately at frame 0.

FastFlix appears to generate VVenC two-pass parameters using:

-vvenc-params "pass=1:rcstatsfile=..."

and:

-vvenc-params "pass=2:rcstatsfile=..."

Current FFmpeg/libvvenc no longer accepts pass or rcstatsfile inside -vvenc-params.

FFmpeg reports:

[libvvenc] vvenc-params 2pass option 'pass' not available. Use option 'pass'
[libvvenc] vvenc-params 2pass option 'rcstatsfile' not available. Use option 'passlogfile'

The encoder then fails to initialize.

Error log
Stream mapping:

Stream #0:0 (hevc) -> scale:default

setsar:default -> Stream #0:0 (libvvenc)

Press [q] to stop, [?] for help

[libvvenc @ 00000137cf50f900] vvenc-params 2pass option 'pass' not available. Use option 'pass'

[libvvenc @ 00000137cf50f900] vvenc-params 2pass option 'rcstatsfile' not available. Use option 'passlogfile'

[vost#0:0/libvvenc @ 00000137cf50a780] [enc:libvvenc @ 00000137d16bc840] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.

[fc#0 @ 00000137cf4e45c0] Error sending frames to consumers: Invalid argument

[fc#0 @ 00000137cf4e45c0] Task finished with error code: -22 (Invalid argument)

[vost#0:0/libvvenc @ 00000137cf50a780] [enc:libvvenc @ 00000137d16bc840] Could not open encoder before EOF

[out#0/mp4 @ 00000137d14af440] Nothing was written into output file, because at least one of its streams received no packets.

frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A

Conversion failed!
Cause

The current VVC command builder appears to contain logic equivalent to:

params = get_vvc_params(
["pass=1", f"rcstatsfile={...}"]
)

and:

params2 = get_vvc_params(
["pass=2", f"rcstatsfile={...}"]
)

This results in the two-pass options being included in -vvenc-params.

With current FFmpeg/libvvenc, these are FFmpeg encoder options instead.

Expected command syntax

Pass 1 should use something equivalent to:

-c:v libvvenc -pass 1 -passlogfile "statsfile" -b:v

Pass 2:

-c:v libvvenc -pass 2 -passlogfile "statsfile" -b:v

pass= and rcstatsfile= should not be included in -vvenc-params.

Proposed FastFlix change

Instead of:

params = get_vvc_params(
["pass=1", f"rcstatsfile={quoted_path(clean_file_string(str(pass_log_file)))}"]
)

use:

params = get_vvc_params()

and change:

["-passlogfile", str(pass_log_file), "-b:v", settings.bitrate, ...]

to:

[
"-pass", "1",
"-passlogfile", str(pass_log_file),
"-b:v", settings.bitrate,
...
]

For the second pass:

params2 = get_vvc_params()

with:

[
"-pass", "2",
"-passlogfile", str(pass_log_file),
"-b:v", settings.bitrate,
...
]
Steps to reproduce
Open FastFlix.
Load a video.
Select VVC / libvvenc.
Select bitrate rather than QP so FastFlix performs a 2-pass encode.
Start the encode.
Encoding fails immediately at frame 0 with the pass / rcstatsfile errors above.
Additional note

Editing the loose command_builder.py under the packaged Windows _internal directory does not appear to affect the running packaged application, presumably because the executable is using the bundled Python module. The issue itself, however, is reproducible from the generated FFmpeg/libvvenc command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions