fifonik / FFMetrics

Visualizes Video Quality Metrics (PSNR, SSIM & VMAF) calculated by ffmpeg.exe
562 stars 22 forks source link

[Feature Request] Add more (explicit) options to the "Skip" dropdown #147

Closed Hlsgs closed 2 months ago

Hlsgs commented 3 months ago

I am aware that there are feature requests opened requesting custom values and whatnot. However, as far as I'm concearned, adding some more values to go "deeper" into the files would suffice and should be trivial to implement. The adjacent "Duration" dropdown already has 12 values, so I don't see why "Skip" would not accomodate as many from a UI standpoint.

I would proppose adding:

Thank you for this great tool!

fifonik commented 3 months ago

Technically, it is very easy to add new options into the dropdown.

However, if you tried to use Skip you should notice that it is slow. For proper calculation frames should not be skipped and this means that ALL fo them decode (even the one that before skip time). The large the selected skip value, the longer the delay. This is the reason I do not want to add large values into the Skip. Sorry.

Hlsgs commented 3 months ago

Hmm, surely, analyzing 30 minutes of video will take ALOT longer than just decoding 30 minutes of video to get to the 20 seconds you want to analyze. And since there IS the option of analyzing 30 minutes of video, why not the latter?

That being said, I presume that you are cutting from the appropriately calculated frame number x to frame number y using ffmpeg and exporting to a lossless format for analysis. And, of course, ffmpeg has to decode to do the cutting since x and y are unlikely to be all keyframes. But, isn't ffmeg smart enought to seek the first keyframe before frame x and the next keyframe after frame y and only decode the part between them? Does it need to decode the whole video from the start? Sorry if I'm completly off the mark with my "logic" :)

fifonik commented 3 months ago

There is an option -accurate... in ffmpeg that I used before. Not any longer as it is unreliable. Using trim atm (you can check logging and look what options passed to ffmpeg).

isn't ffmeg smart enought

It is not posible in general at all as keyframe intervals are not fixed.

fifonik commented 3 months ago

I will do a few more tests to make a decision.

Hlsgs commented 3 months ago

There is an option -accurate... in ffmpeg that I used before. Not any longer as it is unreliable. Using trim atm (you can check logging and look what options passed to ffmpeg).

I am completly unfamiliar with lavfi, so what follows may be unrelated:

It is not posible in general at all as keyframe intervals are not fixed.

Ofcourse keyframe intervals are not fixed, but it should be able to seek the previous keyframe and decode from there. Quoting ffmpeg's documentation for -ss position (input/output):

When used as an input option (before -i), seeks in this input file to position. Note that in most formats it is not possible to seek exactly, so ffmpeg will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded. When doing stream copy or when -noaccurate_seek is used, it will be preserved.

When used as an output option (before an output url), decodes but discards input until the timestamps reach position.

Is that the -accurate... you were talking about?

fifonik commented 3 months ago

Yes, it is.

fifonik commented 2 months ago

Added more items in the Skip dropdown in 1.5.0 beta 8 (it is slow)

Hlsgs commented 2 months ago

Thank you! I'll take the slowness, no problem, but it's also unfortunate that accurate_seek proves unreliable. Oh, well! :)