After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 774209 - splitmuxsink: Add option for timecode-based split
splitmuxsink: Add option for timecode-based split
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: 1.11.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 774208 776447
Blocks:
 
 
Reported: 2016-11-10 13:44 UTC by Vivia Nikolaidou
Modified: 2017-01-12 23:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-splitmuxsink-Add-option-for-timecode-based-split.patch (16.45 KB, patch)
2016-11-10 13:46 UTC, Vivia Nikolaidou
none Details | Review
0001-splitmuxsink-Add-option-for-timecode-based-split.patch (16.44 KB, patch)
2016-11-11 12:11 UTC, Vivia Nikolaidou
none Details | Review
0001-splitmuxsink-Add-option-for-timecode-based-split.patch (17.89 KB, patch)
2016-11-16 18:26 UTC, Vivia Nikolaidou
none Details | Review
0001-splitmuxsink-Add-option-for-timecode-based-split.patch (10.11 KB, patch)
2017-01-10 12:14 UTC, Vivia Nikolaidou
none Details | Review
0001-splitmuxsink-Add-option-for-timecode-based-split.patch (12.98 KB, patch)
2017-01-10 12:54 UTC, Vivia Nikolaidou
committed Details | Review

Description Vivia Nikolaidou 2016-11-10 13:44:42 UTC
If this option is given, it will also attach the next target timecode to
the force key event.
Comment 1 Vivia Nikolaidou 2016-11-10 13:46:53 UTC
Created attachment 339489 [details] [review]
0001-splitmuxsink-Add-option-for-timecode-based-split.patch
Comment 2 Vivia Nikolaidou 2016-11-11 12:11:21 UTC
Created attachment 339614 [details] [review]
0001-splitmuxsink-Add-option-for-timecode-based-split.patch
Comment 3 Vivia Nikolaidou 2016-11-16 18:26:16 UTC
Created attachment 340050 [details] [review]
0001-splitmuxsink-Add-option-for-timecode-based-split.patch

Turns out that the timecode track isn't to be trusted, it may wrap around. For timecode-based splitting, we just calculate the timecode-based duration of the chunk (which is complicated for drop-frame cases) and split based on that duration in nsec. Timecode-based splitting will override time-based splitting for requesting a keyframe (should it? should we just request both?)
Comment 4 Jan Schmidt 2016-12-14 11:15:16 UTC
Review of attachment 340050 [details] [review]:

I think this is not quite ready. Also, I'm working on a general rework of the way splitmuxsink handles buffering to make everything more deterministic. It might be worth holding off on reworking this patch until that's done.

::: gst/multifile/gstsplitmuxsink.c
@@ +668,3 @@
+
+  parts = g_strsplit (splitmux->threshold_timecode_str, ":", 4);
+  if (!parts || parts[3] == NULL) {

You shouldn't assume the array is large enough for this to be safe. Use g_strv_length() to check the number of entries.

@@ +728,3 @@
+  GST_DEBUG_OBJECT (splitmux, "Next max TC time: %" GST_TIME_FORMAT,
+      GST_TIME_ARGS (next_max_tc_time));
+  gst_video_time_code_free (target_tc);

This code seems like functionality that should be in the timecode manipulation library API?

@@ +1099,3 @@
+                  queued_time > splitmux->threshold_time) ||
+              (splitmux->next_max_tc_time != GST_CLOCK_TIME_NONE &&
+                  tc_time > splitmux->next_max_tc_time + 5 * GST_USECOND)))) {

What's the 5 microsecond magic number about?

@@ +1679,3 @@
   if (GST_PAD_PAD_TEMPLATE (pad) &&
+      g_str_equal (GST_PAD_TEMPLATE_NAME_TEMPLATE (GST_PAD_PAD_TEMPLATE
+              (pad)), "video"))

Why are there whitespace changes?
Comment 5 Vivia Nikolaidou 2017-01-10 12:14:08 UTC
Created attachment 343230 [details] [review]
0001-splitmuxsink-Add-option-for-timecode-based-split.patch

Thanks, here's a new patch.
Comment 6 Vivia Nikolaidou 2017-01-10 12:54:01 UTC
Created attachment 343239 [details] [review]
0001-splitmuxsink-Add-option-for-timecode-based-split.patch

Oops, wrong file. This is the correct one :)
Comment 7 Jan Schmidt 2017-01-12 23:44:13 UTC
Thanks, pushed:

commit 05db87de21159a124f744ca314520f74c3517e01
Author: Vivia Nikolaidou <vivia@toolsonair.com>
Date:   Thu Dec 22 17:40:40 2016 +0200

    splitmuxsink: Add option for timecode-based split
    
    If this option is given, it will calculate the next split point based on
    timecode difference.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774209