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

Open Beginner friendly
#768 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
desktop, tooling

Research direction

Start in command_builder.py and find the VVC two-pass logic around get_vvc_params and pass_log_file. Verify the generated bitrate-mode commands for both passes, then reproduce a VVC/libvvenc two-pass encode; done means pass and passlogfile are emitted as encoder options rather than inside -vvenc-params and encoding no longer fails at frame 0.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
1.6k
Forks
77
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cdgriffith/FastFlix

All issues in cdgriffith/FastFlix

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.