Import: item.metadata counts a WebM's last frame when its duration is not a whole millisecond (fixes #1429)

This commit is contained in:
Marco Arnulfo
2026-10-14 14:22:15 +02:00
parent 549e9d8251
commit cc29d90943
2 changed files with 31 additions and 1 deletions
+3 -1
View File
@@ -312,7 +312,9 @@ pub fn footage_metadata(f: &Footage) -> Value {
"pixelAspect": f.pixel_aspect,
"frameRate": f.frame_rate.as_f64(),
"duration": f.duration.seconds(),
"frames": if f.has_video && f.kind != FootageKind::Still { Some(f.frame_rate.frame_at(f.duration)) } else { None },
// Rounded like the media pool's frame count: Matroska stores the duration in whole
// milliseconds, a hair short of the last frame at 30 fps (#1429).
"frames": if f.has_video && f.kind != FootageKind::Still { Some(f.frame_rate.frame_at(f.frame_rate.snap_nearest(f.duration))) } else { None },
"hasVideo": f.has_video,
"hasAudio": f.has_audio,
"alpha": format!("{:?}", f.alpha),