Alkl58 / NotEnoughAV1Encodes

GUI for AV1 (aomenc, rav1e & svt-av1)
MIT License
538 stars 24 forks source link

Small number of extra frames added, causing sync issues #47

Open Milliarde89 opened 3 years ago

Milliarde89 commented 3 years ago

I have done several encodes lately (first of all thanks for the excellent program!!) and have noticed that on some of the movies I've done they end up out of sync with the audio, typically more so as time goes on.

I updated to all the latest versions but am still encountering the problem. For example, I am encoding a Blu-Ray x264 rip of a movie - the original movie has a total of 124480 frames (duration 1:26:31) but the AV1 encoded movie has a total of 124486 frames (duration 1:26:32). So somehow 6 frames are being added, causing the video to be slightly behind the audio the further into the movie you go.

I've attached screenshots of the original and encoded, both after navigating to frame 100000 in MPC-HC.

If it matters, I've used the default ffmpeg scene detect, typically do a resize down to 720p, and use the settings in the attached image.

It's driving me crazy, any idea what the issue is or if I'm doing something wrong?

settings orig_100k av1_100k

Alkl58 commented 3 years ago

Yeah, thats sadly a often reaccuring issue. Most of the reason where because of some meta-data / frame placement issue from the source video. Thats why often re-encoding beforehand works. If you want, you can send me the source video for testing purpose. Else I will recommend to use equal chunking with re-encoding. Many Greetings

Milliarde89 commented 3 years ago

Is this an issue just with neav1e or with aomenc itself? When you say to re-encode the source, do you mean just putting it through ffmpeg with c:v copy or to convert to uncompressed or something? I can send you the source but it has happened on multiple videos so if there is a reliable solution I would be 😄

Milliarde89 commented 3 years ago

I re-encoded using the same settings but using PySceneDetect instead of ffmpeg scenedetect and it turned out correct, interesting...

Milliarde89 commented 3 years ago

Well I tried a different movie using PySceneDetect and it's slightly better, but still 4 extra frames. I guess I will try with re-encoding it first.

Alkl58 commented 3 years ago

Yeah, sadly it's always a hit or miss if it works with re-encoding / different splitting options. Personally I always re-encode to x264 crf 0, then use equal chunking with reencoding. With this combination I never had lost/added frames.

Is this an issue just with neav1e or with aomenc itself?

It's more or less an ffmpeg issue.

When you say to re-encode the source, do you mean just putting it through ffmpeg with c:v copy or to convert to uncompressed or something?

In equal chunking mode there is the option to re-encode during splitting process (re-encodes the video by default with x264), else what I mean by re-encoding is to do -c:v libx264 -crf 0 (as an example)

Milliarde89 commented 3 years ago

I think I understand now. Doesn't equal chunking imply that the encode won't be as efficient, if it's not splitting based on scene changes?

Alkl58 commented 3 years ago

Technically you are correct, but keep in mind that depending on the chunking length that efficiency loss is very small and can be ignored. ^^

j-rodman commented 2 years ago

I'm experiencing audio desynching in 2.0.6 in general. I've gotten this using pyscenedetect as well as fixed sized chunks. I've usually been doing this at low quality (like 35) , 2 pass encoding, speed 2 or 3, and with the lag-in-frames set to 48 in the advanced options. I transcode the audio to opus.

The updater says everything is at 2002.03.24 (except "Manual Update" which i have no idea what that is.)

Does this belong in a separate issue? Or .. otherwise? I can't find any recommended settings.

Alkl58 commented 1 year ago

Maybe the commit Fix Input Seeking Frame Inaccuracy (Scene Based Splitting) fixed this issue.