Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zones support #598

Merged
merged 4 commits into from
Mar 28, 2022
Merged

Add zones support #598

merged 4 commits into from
Mar 28, 2022

Conversation

shssoichiro
Copy link
Collaborator

Currently implemented:

  • Overriding the selected encoder & number of passes
  • Overriding or adding video params
  • Overriding photon noise setting
  • Overriding min/max scene length

Closes #267

@master-of-zen
Copy link
Owner

Looks amazing

@redzic
Copy link
Collaborator

redzic commented Mar 21, 2022

It looks like there is no protection against the user specifying a different encoder which conflicts with the main encoder, for example specifying x264 with aomenc. Is it possible to add error handling for that situation? Somehow in that case the concatenation even ends up succeeding, but the output file ends up being silently broken. Also, since we're parsing untrusted input, it would be nice to look into some sort of fuzzing solution.

@shssoichiro
Copy link
Collaborator Author

shssoichiro commented Mar 22, 2022

Added handling of mismatched formats.

We can probably use something like quickcheck for targeted fuzzing. Rav1e uses libfuzzer-sys for a broader fuzzing solution but I'm not too familiar with that. I think that's a little bit of a larger undertaking though since at the moment we don't use either.

@shssoichiro shssoichiro force-pushed the zones branch 2 times, most recently from c49b9d5 to c8dc343 Compare March 22, 2022 14:35
@redzic
Copy link
Collaborator

redzic commented Mar 22, 2022

For some reason I get a panic with these parameters on a 24 frame video:

redzic@threadripper ~/P/Av1an (zones)> ./target/release/av1an -i ~/input.y4m --zones zones.txt -e rav1e
Scene detection
INFO [av1an_core::settings] scenecut: found 3 scene(s) [with extra_splits (239 frames): 3 scene(s)]
  00:00:00 [##############################################################################################################################################] 100%  24/24 (37.36 fps, eta 0s)Queue 2 Workers 2 Passes 1
Params: --speed 6 --quantizer 100 --no-scene-detection
⠦ 00:00:01 [---------------------------------------------------------------------------------------------------------------------------------------------------]   0%  0/24 (0 fps, eta 0s)thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: ffmpeg::Error(2: No such file or directory)', av1an-core/src/broker.rs:277:70
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', av1an-core/src/broker.rs:188:35
⠋ 00:00:05 [##############>-------------------------------------------------------------------------------------------------]  12%  3/24 (3.13 s/fr, eta 66s, 3532.9 Kbps, est. 431.69 KiB)thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', av1an-core/src/settings.rs:1241:21

Where this is the contents of zones.txt:

3 24 aom reset --cq-level=30

Can you see if you can reproduce this issue as well?

Also, I encountered another edge case where there is no check for if all encoders support the pixel format specified by --pix-format, which can lead to unexpected errors. For example, this leads to an error when trying to implicitly encode yuv444p with SVT-AV1:

redzic@threadripper ~/P/Av1an (zones)> ./target/release/av1an -i ~/input.y4m --pix-format yuv444p --zones zones.txt 
Default output file "input_aom.mkv" exists. Do you want to overwrite it? [Y/n]: y
Scene detection
INFO [av1an_core::settings] scenecut: found 3 scene(s) [with extra_splits (239 frames): 3 scene(s)]
  00:00:00 [##############################################################################################################################################] 100%  24/24 (40.99 fps, eta 0s)Queue 2 Workers 2 Passes 2
Params: --threads=8 --cpu-used=6 --end-usage=q --cq-level=30
WARN [av1an_core::broker] Encoder failed (on chunk 1):
encoder crashed: exit status: 1
stdout:

stderr:
        Svt[info]: -------------------------------------------
        Svt[info]: SVT [version]:       SVT-AV1 Encoder Lib v0.9.0-dirty
        Svt[info]: SVT [build]  :       GCC 11.2.0       64 bit
        Svt[info]: LIB Build date: Mar  6 2022 15:48:38
        Svt[info]: -------------------------------------------
        Error instance 1: 444 chroma format not supported, only 420 is supported at this time.
        Error found when reading the y4m file parameters.
        Error in configuration, could not begin encoding! ... 
        Run SvtAv1EncApp --help for a list of options
        SvtMalloc[info]: you have no memory leak


source pipe stderr:
        Deprecated option --y4m specified, use -c y4m instead

With this zones.txt:

3 24 svt-av1 reset --crf 21

@redzic
Copy link
Collaborator

redzic commented Mar 23, 2022

Could we also automatically set 1-pass mode for aom/vpx if --rt was specified for each zone, like how we do with the main encoding?

Currently implemented:
- Overriding the selected encoder & number of passes
- Overriding or adding video params
- Overriding photon noise setting
- Overriding min/max scene length

Closes master-of-zen#267
@shssoichiro
Copy link
Collaborator Author

Bump.

@master-of-zen
Copy link
Owner

LGTM

Copy link
Owner

@master-of-zen master-of-zen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work) Thanks)

@mergify mergify bot merged commit 84d46bb into master-of-zen:master Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Change encoding parameters for specific segments
3 participants