Fix video length when we scan for it.
authorCarl Hetherington <cth@carlh.net>
Sat, 19 Oct 2024 19:29:29 +0000 (21:29 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 19 Oct 2024 19:29:29 +0000 (21:29 +0200)
Length is 1 frame more than the start time of the last frame.

src/lib/ffmpeg_examiner.cc

index b610892698563f86288e72e3f657da79c523d398..31f1a3d64ff0ffc397b50c5dc0c0ad17148169c0 100644 (file)
@@ -245,10 +245,10 @@ FFmpegExaminer::video_packet (AVCodecContext* context, string& temporal_referenc
                _first_video = frame_time (_video_frame, _format_context->streams[_video_stream.get()]);
        }
        if (_need_video_length) {
-               _video_length = frame_time (
+               _video_length = frame_time(
                        _video_frame,
                        _format_context->streams[_video_stream.get()]
-                       ).get_value_or (ContentTime ()).frames_round (video_frame_rate().get ());
+                       ).get_value_or({}).frames_round(video_frame_rate().get()) + 1;
        }
        if (temporal_reference.size() < (PULLDOWN_CHECK_FRAMES * 2)) {
                temporal_reference += (_video_frame->top_field_first ? "T" : "B");