GetNumberVideoFrames() only checks for per-stream frame counts or durations, which MKV and WebM containers do not include in their headers. This causes the hashing of these files to fail almost before it even begins.
Solution: adding another fallback resolves that situation and in my (limited) tests allows pHash to work with MKV and WebM containers as well:
if (nb_frames <= 0) {
nb_frames = static_cast<float>(pFormatCtx->duration) *
str->avg_frame_rate.num /
str->avg_frame_rate.den /
AV_TIME_BASE;
}
GetNumberVideoFrames()only checks for per-stream frame counts or durations, which MKV and WebM containers do not include in their headers. This causes the hashing of these files to fail almost before it even begins.Solution: adding another fallback resolves that situation and in my (limited) tests allows pHash to work with MKV and WebM containers as well: