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

Av1an starts encoding after 2hr #902

Open
EdgeLord69-dev opened this issue Dec 20, 2024 · 6 comments
Open

Av1an starts encoding after 2hr #902

EdgeLord69-dev opened this issue Dec 20, 2024 · 6 comments

Comments

@EdgeLord69-dev
Copy link

EdgeLord69-dev commented Dec 20, 2024

As the title says, av1an encodes the first frame after 2 hrs. I tried various options, different chunk methods with vapoursynth plugins & ffmpeg methods, but each time the first frame is encoded after 2hrs & it shows 300s/frame in the progress bar which gradually decreases to 3s/frame after another 2-3hrs. I am using svt-av1-psy with 1pass on ubuntu 22.04.
I think this is an av1an issue because when i tried piping to SvtAv1EncApp through ffmpeg, it started encoding instantly albeit very slow & it could not saturate my cpu. (CPU usage was like 5% with ffmpeg)
This is my av1an command
av1an -i cut.mkv -o out.mkv -w 0 -e svt-av1 -c mkvmerge -v "--preset 2 --tune 2 --crf 44 --rc 0 --fast-decode 2 --input-depth 10 --keyint 240 --film-grain 8" -a "-c:a libopus -mapping_family 1 -af aformat=channel_layouts=5.1 -b:a 320k"
This is my ffmpeg command if neccessary
ffmpeg -i cut.mkv -map 0:v:0 -pix_fmt yuv420p10le -f yuv4mpegpipe -strict -1 - | SvtAv1EncApp -i stdin --preset 2 --keyint 240 --input-depth 10 --crf 44 --film-grain 8 --tune 2 -b outfile.ivf
ffmpeg -i outfile.ivf -i cut.mkv -map 0:v -map 1:a:0 -c:v copy -c:a copy outfile.mkv
I had even tried AlabamaEncoder but it couldnt saturate my cpu with only 5% cpu usage & massive encoding times.
.

@BlueSwordM
Copy link
Contributor

That is a very weird issue. How did you build svt-av1-psy and av1an? You should be getting much much higher speeds than this.

@ItachiUchiha-IU
Copy link

That's so vague.. no hardware specified, no versions of the software, how the binaries were built etc, no details on what the pc does when encoding (cpu usage, processes, any logging etc)..

Anyway, it may just be the OS acting funny, I would try setting more parameters instead of letting the app and the system decide on everything; for example try setting the number of workers and thread-affinity, specify the chunker and in the encoder the level of parallelism. Try also maybe giving a folder for temp files and moving the output to the end idk.

There are several ways of setting your workers and thread-affinity:
the more canonical is workers=cores, ta=2, lp=2;
but recently I am using instead the most possible on lp (6), same on ta (6) and the workers are n of threads / lp -> in my case I have 12 cores, then I use 4w 6ta 6lp, as it's faster to start and stop encoding while being equally fast to the canonical way (someone on the new r9 9950x tested this and apparently got faster speeds)
Else, u can show us how u built the binaries and/or try to use a prebuilt one.

Also more tips: set -x 240 on av1an and --keyint -1 on the encoder; for svt-av1-psy try tune 3 which is superior to 2

Im leaving here an example of my command
& "C:\av1an\av1an.exe" -i "${inputpath}\$file" -e svt-av1 -w 4 --set-thread-affinity 6 -x 240 --resume --verbose -c mkvmerge -m lsmash --zones "${inputpath}$filename.txt" -a "-c:a copy" -v "--crf ${c} --preset ${p} --film-grain-denoise ${d} --film-grain ${g} --tune 3 --aq-mode 2 --variance-octile ${vo} --variance-boost-strength ${vbs} --sharpness ${s} --frame-luma-bias ${luma} --adaptive-film-grain ${afg} --enable-tf ${tf} --tf-strength ${tf_str} --kf-tf-strength ${kf_tf_str} --noise-norm-strength ${nns} --keyint -1 --input-depth 10 --lp 6 --color-primaries 1 --transfer-characteristics 1 --matrix-coefficients 1" -o "${outputpath}\$prefix$filename$extension" --temp "${inputpath}\temp_$filename"

@EdgeLord69-dev
Copy link
Author

EdgeLord69-dev commented Dec 20, 2024

This is my av1an build command
git clone https://github.com/master-of-zen/Av1an
cd Av1an
RUSTFLAGS="-C target-cpu=native" cargo build --release
sudo cp target/release/av1an /usr/local/bin
This is my svt-psy build command
git clone https://github.com/gianni-rosato/svt-av1-psy
cd svt-av1-psy
mkdir svt_build && cd svt_build
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DBUILD_DEC=OFF -DENABLE_AVX512=ON -DSVT_AV1_LTO=ON -DNATIVE=ON
make -j$(nproc)
sudo make install
cd .. && cd ..

@EdgeLord69-dev
Copy link
Author

EdgeLord69-dev commented Dec 20, 2024

Anyway, it may just be the OS acting funny, I would try setting more parameters instead of letting the app and the system decide on everything; for example try setting the number of workers and thread-affinity, specify the chunker and in the encoder the level of parallelism. Try also maybe giving a folder for temp files and moving the output to the end idk.

I had tried setting --lp & more advanced parameters but it resulted in the same error. After some research, i saw reccomendations to first try a barebones av1an command so thats what i did

@EdgeLord69-dev
Copy link
Author

Also more tips: set -x 240 on av1an and --keyint -1 on the encoder; for svt-av1-psy try tune 3 which is superior to 2

I did tune 3 only.. typo

@EdgeLord69-dev
Copy link
Author

EdgeLord69-dev commented Dec 20, 2024

@ItachiUchiha-IU I tried ur thread-affinity & lp options & now, It encoded the first frame after 20min, showing 500s/frame, which later dropped down to a consistent 30s/frame after another 20min. idk if this is normal but still

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

No branches or pull requests

3 participants