Matroska segmented output changes video duration

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Matroska segmented output changes video duration

FFmpeg-users mailing list
Hello. I have a video grabbed from EasyCAP (UTV007). It has variable
frame rate, so I use "-vsync passthrough" everywhere to keep it. You can
download a segment of this video here:
https://andreymal.org/files/ffmpeg/contra_test.mkv

I need to split this video into several segments. I tried to use this
command:

ffmpeg -vsync passthrough -i contra_test.mkv \
  -map 0 -c copy -f segment -segment_time 1 \
  -segment_list test.ffcat -reset_timestamps 1 test-%02d.mkv

To verify that everything is fine, I merge the video back:

ffmpeg -vsync passthrough -i test.ffcat \
  -map 0 -c copy contra_test_union.mkv

Then I compare the durations, and the new video (and the audio) is 2
seconds longer!

$ ffmpeg -i contra_test.mkv 2>&1 | grep DURATION
      DURATION        : 00:00:30.007000000
      DURATION        : 00:00:30.069000000
$ ffmpeg -i contra_test_union.mkv 2>&1 | grep DURATION
      DURATION        : 00:00:32.156000000
      DURATION        : 00:00:32.188000000

The more segments the video is splitted into, the longer the new video.

Could someone explain what caused this behavior? Is it possible to fix
it? I expect the same durations.

But when I use mp4 instead of mkv, everything works well. Is this a
matroska bug?

I use ffmpeg 4.2.2 installed from Arch Linux repository.
________
andreymal
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Matroska segmented output changes video duration

Carl Eugen Hoyos-2
Am Mi., 29. Jan. 2020 um 22:47 Uhr schrieb andreymal via ffmpeg-user
<[hidden email]>:

>
> Hello. I have a video grabbed from EasyCAP (UTV007). It has variable
> frame rate, so I use "-vsync passthrough" everywhere to keep it. You can
> download a segment of this video here:
> https://andreymal.org/files/ffmpeg/contra_test.mkv
>
> I need to split this video into several segments. I tried to use this
> command:
>
> ffmpeg -vsync passthrough -i contra_test.mkv \
>   -map 0 -c copy -f segment -segment_time 1 \
>   -segment_list test.ffcat -reset_timestamps 1 test-%02d.mkv
>
> To verify that everything is fine, I merge the video back:

Why do you think that this is possible in the general case?
(Apart from the fact that I suspect -vsync passthrough sees
significantly less testing than the default)

[...]

> I use ffmpeg 4.2.2 installed from Arch Linux repository.

Please test current FFmpeg before reporting issues here.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Matroska segmented output changes video duration

FFmpeg-users mailing list
>Why do you think that this is possible in the general case?

Why not? When I split, for example, 2s to 1s+1s, I expect 1s+1s=2s. As
far as I know, both mp4 and mkv are able to store frame times correctly,
so I expect basic arithmetic operations to work. There are some reasons
why I should think that 2+2=5 is fine?

> (Apart from the fact that I suspect -vsync passthrough sees
> significantly less testing than the default)

I know it, but okay, I tried not to use "-vsync passthrough", but the
duration is still 2 seconds longer.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Matroska segmented output changes video duration

FFmpeg-users mailing list
>> Why do you think that this is possible in the general case?

> Why not?

I suggested that missing keyframes could be the cause of this behavior,
so I tried to use raw input formats (rawvideo+pcm_s16le instead of
h264+aac), but the new video is still 0.2s longer (it's not 2 seconds
but still too long). I have no more ideas.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Matroska segmented output changes video duration

Carl Eugen Hoyos-2
Am Fr., 31. Jan. 2020 um 00:00 Uhr schrieb andreymal via ffmpeg-user
<[hidden email]>:
>
> I have no more ideas.

If you want to debug this, please test current FFmpeg git head and
provide the command line you tested together with the complete,
uncut console output.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".