Av1an icon indicating copy to clipboard operation
Av1an copied to clipboard

Feature request: get chunk frame count from FFmpeg output

Open Bl4cKn1gh7 opened this issue 3 years ago • 2 comments

Currently Av1an gets the frame count of its chunks from the input frame count of the chunk itself, without regard to FFmpeg filtering. This can cause problems during use of FFmpeg filters that change the output frame count, eg. IVTC -vf pullup -r 24000/1001 etc. or deinterlacing with frame doubling, bwdif, etc.

My initial idea was that if the output frame count of the FFmpeg filter is used instead, by decoding the y4m stream to a null output, you could get an accurate frame count for Av1an to verify that a chunk was completed. Currently if you try to inverse telecine 3:2 pull down content, each chunk will error out, even though the resulting video is fine. You also cannot resume any encode with incorrect frame counts.

Bl4cKn1gh7 avatar Jan 19 '22 23:01 Bl4cKn1gh7

This means 2 things, first you would have to run the filters at scene detection, second is that you would need a way to somehow get the chunking right.

Since the "new frames" are generated from the previous ones, asking for a frame # during chunking will inevitably yield an incorrect result

It is better to filter to an intermediary file first.

lastrosade avatar Jan 19 '22 23:01 lastrosade

In order to do this, you would need your filter to run some sort of "simulation mode" where it returns a map of "old frames" to "new frames" and to have ffmpeg or vapoursynth somehow take it into account when requesting a specific frame number.

This could mean re running the filter many times. You might as well do it once and be done with it.

lastrosade avatar Jan 19 '22 23:01 lastrosade