alexheretic / ab-av1

AV1 re-encoding using ffmpeg, svt-av1 & vmaf.
MIT License
467 stars 29 forks source link

Support `--enc svtav1-params=` as an override #128

Open veikk0 opened 1 year ago

veikk0 commented 1 year ago

I was testing tune=1 vs tune=0 with the latest ab-av1 git and ended up with identical output files (matching sha1sums). Looking at the actual FFmpeg command being run, it seems that since ab-av1 is adding its own -svtav1-params scd=0, any -svtav1-params the user specifies with --enc is overridden (with multiples of a parameter, only the latter is applied by FFmpeg).

Since SvtAv1EncApp usage was removed, I had basically forgotten about the --svt parameter, which seems to be the way to set -svtav1-params currently. I've been using --enc for all the encoders I use with ab-av1, but due to the above, the behavior isn't consistent between SVT-AV1 and other encoders.

scd hasn't done anything since SVT-AV1 0.9.1, so it has no effect in recent SVT-AV1 versions.

Command to reproduce:

ab-av1 auto-encode -e libsvtav1 --enc svtav1-params=tune=0:keyint=300 --min-vmaf 93.4 --pix-format yuv420p --preset 8 -o tune0.ivf --input input.mp4

mr44er commented 1 year ago

Yes, you need to use it multiple times: ... --svt tune=0 --svt scd=0 ... --enc af=loudnorm as example is meant for ffmpeg

the behavior isn't consistent between SVT-AV1 and other encoders

That is because libsvtav1 is the default used encoder. Use ab-av1 auto-encode --help to see the defaults.

alexheretic commented 1 year ago

Thanks for raising this, it's mostly setup to use --svt for these args. I agree that with your usage the behaviour is surprising.

We could:

Or alternatively just ban svtav1-params usage, which is simpler. This might be better since it nudges users to the easier to use API.

Also note, since you used svtav1 "keyint" param, --keyint arg handles this (setting ffmpeg -g) and defaults to 10s.

Regarding --scd it probably is worth removing this as a first class option & default behaviour.

veikk0 commented 1 year ago

I'd prefer being able to use --enc svtav1-params for consistency between encoders and easier scripting. IMO svtav1-params is easier to remember once you're using multiple encoders and setting various encoder parameters with the -{encoder}-params switch. It also makes scripting easier, since FFmpeg has kept the naming of the switch consistent between encoders.

alexheretic commented 1 year ago

I guess the first solution would satisfy that?

  • Make user specified --enc svtav1-params=... override any default params.
  • Fail if using this and --svt.
veikk0 commented 1 year ago

Yes, it would.