From 69c6d150e2835cb771cc375d3000f3d41e14fd9c Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Tue, 31 Aug 2021 17:18:05 +0200 Subject: [PATCH] editlit.jq: Update after mp4 field renames --- dev/editlist.jq | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/dev/editlist.jq b/dev/editlist.jq index d856b92a..7ce835f7 100755 --- a/dev/editlist.jq +++ b/dev/editlist.jq @@ -23,27 +23,33 @@ time_scale: $mvhd.time_scale, duration_s: ($mvhd.duration / $mvhd.time_scale), tracks: - [ .boxes[] - | select(.type == "trak") - | first(.. | select(.type == "mdhd")?) as $mdhd - | first(.. | select(.type == "hdlr")?) as $hdlr - | first(.. | select(.type == "stsd")?) as $stsd - | first(.. | select(.type == "elst")?) as $elst - | { - component_type: $hdlr.component_subtype, - data_format: $stsd.sample_descriptions[0].data_format, - media_scale: $mdhd.time_scale, - edit_list: - [ $elst.table[] - | { - time_scale: $mdhd.time_scale, - track_duration: .track_duration, - media_time: .media_time, - track_duration_s: (.track_duration / $mvhd.time_scale), - media_time_s: (.media_time / $mdhd.time_scale) + [ .boxes[] + | select(.type == "trak") + | first(.. | select(.type == "mdhd")?) as $mdhd + | first(.. | select(.type == "hdlr")?) as $hdlr + | first(.. | select(.type == "stsd")?) as $stsd + | first(.. | select(.type == "elst")?) as $elst + | first(.. | select(.type == "stts")?) as $stts + | ([$stts.entries[] | .count * .delta] | add) as $stts_sum + | { + component_type: $hdlr.component_subtype, + # the sample descriptors are handled as boxes by the mp4 decoder + data_format: $stsd.boxes[0].type, + media_scale: $mdhd.time_scale, + edit_list: + [ $elst.entries[] + | { + track_duration: .segment_duration, + media_time: .media_time, + track_duration_s: (.segment_duration / $mvhd.time_scale), + media_time_s: (.media_time / $mdhd.time_scale) + } + ], + stts: { + sum: $stts_sum, + sum_s: ($stts_sum / $mdhd.time_scale) } - ] - } - ] + } + ] } )