HandBrake / HandBrake

HandBrake's main development repository
https://handbrake.fr
Other
17.3k stars 1.32k forks source link

1-2 frames shift between source and encoded #5373

Closed CHerSun closed 1 year ago

CHerSun commented 1 year ago

Problem Description

Hi. I'm re-encoding quite a few videos. In many cases I do multiple attempts (h264, h265, constant quality, varying ~18-24) and compare them using MPC-HC fork screenshots at exact time (like, 5 mins, 10 mins, 15 mins, etc).

Comparing screenshots:

I wasn't able to find reason for this. But this happens often. Attaching example screenshots & logs from recent encoding.

P.S.: Handbrake is an awesome tool, absolutely love it. Thank you!

Activity Log, Crash Log or any other details

-

What Operating System are you running?

Windows 10

What version of HandBrake are you running?

1.6.1

Where did you download HandBrake from?

scoop

CHerSun commented 1 year ago

mkv source.

Source screenshot: 00 25 00 000 - Taxi 4 2007 1080p

h265 encoding screenshot: 00 25 00 000 - Taxi 4 2007 1080p hb h265 18 slow

Either save and scroll between screenshots, or note head rotation of the left person on the screenshot. Definitely a minor difference in time, not encoding difference.

Log: Taxi.4.2007.1080p hb h265 18 slow_encode_09.10.2023 06-52-49.txt

CHerSun commented 1 year ago

+1 example, blueray source this time.

Source screenshot: 01 05 00 000 - 00800

Encoded h264: 01 05 00 000 - Steve Jobs hb h264 18 slow

also had h265 encoded - same frame as h264. Difference - head position & opened/closed eyes.

Log: Steve Jobs hb h264 18 slow_encode_09.11.2023 02-56-07.txt

galad87 commented 1 year ago

Are you opening the Blu-ray directly in MPC-HC? The difference might related to the different demuxer used. H.264 and HEVC uses B-frames and reorder frames, so there is usually a delay of 1 or 2 frames, which could be handled in a different way. From the activity log it doesn't seem HandBrake dropped or added any frame. Is there still a difference in you use another player or encoder for example in AV1?

CHerSun commented 1 year ago

@galad87 I'm encoding from many different sources (mkv, mp4, avi, dvd, bluray etc). I wasn't able to attribute this issue to 1 specific source. First example is from MKV source. 2nd example - from bluray. Both show same difference.

Are you opening the Blu-ray directly in MPC-HC?

Yes, opening directly using index.bdmv file.

The difference might related to the different demuxer used.

Not sure how I can test this. I could try to use VLC (it comes with everything built in I guess?). Or could you suggest some other way to verify? K-lite codec pack basic is installed, if this matters.

H.264 and HEVC uses B-frames and reorder frames, so there is usually a delay of 1 or 2 frames, which could be handled in a different way. From the activity log it doesn't seem HandBrake dropped or added any frame. Is there still a difference in you use another player or encoder for example in AV1?

Will test AV1 encoder on next encoding where there'll be a difference. 1-2 days normally.

CHerSun commented 1 year ago

@galad87

The difference might related to the different demuxer used.

Looks like this. Have ongoing encoding, which shows same 1-2 frame difference. Checked it with MPC-HC - there's a difference between source bluray and encoded video. Checked it with VLC - VLC shows exactly the same frame for both source & encoding, and it's the same, as encoded one for MPC-HC. So looks like MPC-HC does something with the source.

Thank you.