alexheretic / ab-av1

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

Pass arguments to encoder #106

Open jimbow973 opened 1 year ago

jimbow973 commented 1 year ago

Hi, Thank you for the ab-av1 project, just discovered it yesterday, very helpful to squeeze videos. My concern is how to pass arguments to the encoder like "enable-qm=1" or "tune=screen" whether it is with SVT or libsvtav1 or libaom ab-av1 auto-encode -e libsvtav1 -i test1.mp4 --enc-input enable-qm=1 --min-vmaf 95 --max-crf 63 --preset 4 is not working or ab-av1 auto-encode -e libaom-av1 --min-vmaf 95 --max-crf 63 --acodec libopus --enc b:a=64k --aom-params enable-qm=1 --preset 8 -i test1.mp4 is not working too. Thanks, Jim

alexheretic commented 1 year ago

--enc VAL & --enc-input VAL are for providing ffmpeg args.

--enc aom-params=foo=bar:baz=qux will become ffmpeg ... -aom-params foo=bar:baz=qux

For svt-av1 you can use --svt VAL which is a bit nicer as you can use it multiple times.

It's possible to open your system task manager/process viewer and look at what ffmpeg args are being used during an encode run.

Do you think we should improve the help output for these options?

jimbow973 commented 1 year ago

Amazing, thank you Alex. I spent a good time trying to figure how to pass the arguments, just found some hints in your blog post. So yes, it would be fine to include it in the help output --help.

Can it work with 2 passes ffmpeg encoding too? the CRF value isn't required for libaom-av1 first pass, so I would use ffmpeg for the 1st pass then ab-av1 to launch the 2nd pass using auto-encode? possible?

alexheretic commented 1 year ago

I've never looked into 2 pass support so i don't think this would work, or not very well.

The app is currently focused on single pass crf runs. Perhaps more can be done with 2 pass.

On Wed, 4 Jan 2023, 11:21 jimbow973, @.***> wrote:

Amazing, thank you Alex. I spent a good time trying to figure how to pass the arguments, just found some hints in your blog post. So yes, it would be fine to include it in the help output --help.

Can it work with 2 passes ffmpeg encoding too? the CRF value isn't required for libaom-av1 first pass, so I would use ffmpeg for the 1st pass then ab-av1 to launch the 2nd pass using auto-encode? possible?

— Reply to this email directly, view it on GitHub https://github.com/alexheretic/ab-av1/issues/106#issuecomment-1370800311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARZHV2DTXQQ6UZEQ4SEV7TWQVMKVANCNFSM6AAAAAATQNEUNQ . You are receiving this because you commented.Message ID: @.***>

jimbow973 commented 1 year ago

I was wrong, the CRF value needs to be provided for the first pass too. The first pass is very fast with aomenc (also SVT) and gives some gains alt-ref placement etc. FFmpeg page says "Two-pass encoding is also beneficial for encoding efficiency when constant quality is used without a target bitrate. ", so yes, that would be very appreciated to have some workaround to use 2-pass encoding!

iPaulis commented 1 year ago

I would be interested in trying 2 pass too. I tried passing --svt arguments like --passes 2 --stats stat_file.stat in a single command line, it runs, but it has no effect in the results.

jimbow973 commented 1 year ago

yeah, 2 pass with either libaom-av1 and libsvtav1. Also, ffmpeg is still buggy regarding some of libaom switches (like fp-mt=1 or enable-fwd-kf =1) - I don't use SVT, quality is way lower than aomenc for screen recording despite using scm=1. My suggestion would be to use aomenc.exe directly like in av1an instead of relying only on libaom.

iPaulis commented 1 year ago

It seems that 2 pass is supported in standalone svtav1enc but not in ffmpeg libsvtav1 according to this and this. So the svtav1 implementation is not complete in ffmpeg yet.