Av1an icon indicating copy to clipboard operation
Av1an copied to clipboard

Av1an makes video longer, preserving fps

Open CrossRoast opened this issue 2 years ago • 5 comments

Try transcoding a Twitch stream to av1 and note how the fps remains pretty much the same, but the frame count and the duration of the video increases.

Here are the settings I'm using: -v "--threads=64 --kf-max-dist=$KEYFRAME_INTERVAL --cpu-used=$CPU_USED --end-usage=q --cq-level=24 --tile-columns=4 --tile-rows=4 --enable-fwd-kf=1 --enable-keyframe-filtering=0 --enable-chroma-deltaq=1 --quant-b-adapt=1 --mv-cost-upd-freq=2" -f " -copyts " --target-quality "$TARGET_QUALITY" --vmaf-res "$resolution"

During the process, it occasionally throws warnings, saying that the frame count in a chunk is different from expected.

This results in video-audio desync.

CrossRoast avatar Mar 10 '22 13:03 CrossRoast

Firstly, I cannot reproduce. Do you have a specific sample that this occurs on? Secondly, do not use -copyts for the ffmpeg filter parameters, as they are only used for filtering the y4m input (each chunk) to the encoder, they do not affect muxing. Are you using lsmash or ffms2 for the chunk method? If not, try using lsmash to see if the issue persists.

redzic avatar Mar 10 '22 14:03 redzic

The issue doesn't occur within small video segments. It's only noticeable if you transcode the whole stream. This might be due to jitter on the streamer's end in some moments and the way Twitch handles that. For example, this stream: https://www.twitch.tv/videos/1407344543.

The -copyts option was me trying to troubleshoot. It didn't help, as you said.

I'm not sure which chunk method is used. I leave the option unspecified, since you say that the best method is chosen dynamically. Is there a way for me to check?

CrossRoast avatar Mar 10 '22 16:03 CrossRoast

Ah, it looks like I don't have lsmash installed. Let me try that...

CrossRoast avatar Mar 10 '22 16:03 CrossRoast

Actually, I'm struggling to install the required lsmash components. Am I supposed to compile and install the VapourSynth stuff from here? For some reason it doesn't compile for me. Tried with ffmpeg n4.4.1 and n5.0.

CrossRoast avatar Mar 10 '22 22:03 CrossRoast

If you're not on arch linux (or some arch based distro), the easiest way would be to just run av1an in this repo's docker container which contains all possible dependencies. If you are on arch, simply install the vapoursynth-plugin-lsmashsource package. If you're on Windows, there is Nmkoder which contains all possible dependencies and a GUI wrapper for av1an.

redzic avatar Mar 11 '22 02:03 redzic