Djdefrag / QualityScaler

QualityScaler - image/video AI upscaler app
MIT License
2.05k stars 150 forks source link

A cast to integer causes the extracted and upscaled frame count to be incorrect, on NTSC frame rate videos #36

Closed Chipcraft closed 11 months ago

Chipcraft commented 1 year ago

frame_rate = int(cap.get(cv2.CAP_PROP_FPS))

https://github.com/Djdefrag/QualityScaler/blob/b92bb701e703430b13d7341a41aa8699972ae809/QualityScaler.py#LL455C5-L455C50

Example, input video FPS 23.976, original frame count 1212: (23 / (24000/1001)) * 1212 = 1162.6615 (i.e., 1163).

The same applies to every other video that uses frame rates that are non-even.

Everything works correctly when the cast to int is removed: frame_rate = cap.get(cv2.CAP_PROP_FPS)

Djdefrag commented 1 year ago

Hi my friend,

thank you, i will integrate this fix asap :)

Chipcraft commented 1 year ago

Hi my friend,

thank you, i will integrate this fix asap :)

Well that was quick =)

Chipcraft commented 1 year ago

Didn't notice until now. Same affects the video reconstruction: https://github.com/Djdefrag/QualityScaler/blob/b92bb701e703430b13d7341a41aa8699972ae809/QualityScaler.py#L477

Djdefrag commented 1 year ago

Ok perfect, changing this line too. Thanks! :D