splitmuxsink and timestamps

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

splitmuxsink and timestamps

Filip Štědronský
Hi all,

I'm trying to use splitmuxsink to split a video into several segments like
this:

    gst-launch-1.0  -e filesrc location=input.mkv ! matroskademux ! h264parse     \
                       ! splitmuxsink location=%02d.mkv max-size-time=15000000000 \
                       muxer=matroskamux

The problem is that all the created segments keep the original
timestamps. For example, the timestamps of the second segment
start at 0:15 instead of 0:00:


    $ mkvinfo -v 00.mkv
    [...]
    | + Duration: 00:00:14.540000000
    [...]
    |+ Cluster
    | + Cluster timestamp: 00:00:00.000000000
    | + Simple block: key, track number 1, 1 frame(s), timestamp 00:00:00.000000000
    [...]

versus:

    $ mkvinfo -v 01.mkv
    [...]
    | + Duration: 00:00:13.964000000
    [...]
    |+ Cluster
    | + Cluster timestamp: 00:00:14.580000000
    | + Simple block: key, track number 1, 1 frame(s), timestamp 00:00:14.580000000
    [...]

This causes problems with seeking e.g. in mpv.

Is this by design or a bug?

Could a "reset timestamps at start of each segment" option be added?
(akin to -reset_timestamps option in ffmpeg)

Is there some other way to fix the timestamps using other gstreamer
elements? (googling hasn't yielded much)

The used test files are (but any mkv file will do):
    http://regnarg.cz/tmp/input.mkv
    http://regnarg.cz/tmp/00.mkv
    http://regnarg.cz/tmp/01.mkv

Thanks for any pointers.

Filip Stedronsky
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: splitmuxsink and timestamps

Filip Štědronský
Ugly workaround: one can fix the segment timestamps post hoc using
ffmpeg:

    ffmpeg -fflags +genpts -i  01.mkv -c copy  01f.mkv

Can gstreamer do something similar?

Filip
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

AW: splitmuxsink and timestamps

Thornton, Keith
In reply to this post by Filip Štědronský
This is what splitmuxsink is supposed to do. The files can then be played in sequence using splitmuxsrc.

-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:[hidden email]] Im Auftrag von Filip Štedronský
Gesendet: Donnerstag, 31. Mai 2018 13:53
An: [hidden email]
Betreff: splitmuxsink and timestamps

Hi all,

I'm trying to use splitmuxsink to split a video into several segments like
this:

    gst-launch-1.0  -e filesrc location=input.mkv ! matroskademux ! h264parse     \
                       ! splitmuxsink location=%02d.mkv max-size-time=15000000000 \
                       muxer=matroskamux

The problem is that all the created segments keep the original timestamps. For example, the timestamps of the second segment start at 0:15 instead of 0:00:


    $ mkvinfo -v 00.mkv
    [...]
    | + Duration: 00:00:14.540000000
    [...]
    |+ Cluster
    | + Cluster timestamp: 00:00:00.000000000
    | + Simple block: key, track number 1, 1 frame(s), timestamp 00:00:00.000000000
    [...]

versus:

    $ mkvinfo -v 01.mkv
    [...]
    | + Duration: 00:00:13.964000000
    [...]
    |+ Cluster
    | + Cluster timestamp: 00:00:14.580000000
    | + Simple block: key, track number 1, 1 frame(s), timestamp 00:00:14.580000000
    [...]

This causes problems with seeking e.g. in mpv.

Is this by design or a bug?

Could a "reset timestamps at start of each segment" option be added?
(akin to -reset_timestamps option in ffmpeg)

Is there some other way to fix the timestamps using other gstreamer elements? (googling hasn't yielded much)

The used test files are (but any mkv file will do):
    http://regnarg.cz/tmp/input.mkv
    http://regnarg.cz/tmp/00.mkv
    http://regnarg.cz/tmp/01.mkv

Thanks for any pointers.

Filip Stedronsky
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: splitmuxsink and timestamps

Filip Štědronský
Hi,

On Mon, Jun 04, 2018 at 06:33:32AM +0000, Thornton, Keith wrote:
> This is what splitmuxsink is supposed to do. The files can then be played in sequence using splitmuxsrc.

ok, understood. However, splitting media into several independent video
files that can be played with an ordinary media player is also a strong
use case. Would you accept a patch adding a reset-timestamps property
to splitmuxsink (defaulting to false)?

Filip
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel