1
1
mirror of https://github.com/wader/fq.git synced 2024-11-25 23:13:19 +03:00
fq/doc/presentations/bts2022/fqscript
2022-03-08 18:20:18 +01:00

22 lines
692 B
Plaintext
Executable File

#!/usr/bin/env fq -d mp4 -f
( first(.boxes[] | select(.type == "moov")?)
| first(.boxes[] | select(.type == "mvhd")?) as $mvhd
| { time_scale: $mvhd.time_scale,
duration: ($mvhd.duration / $mvhd.time_scale),
tracks:
[ .boxes[]
| select(.type == "trak")
| [("mdhd", "stsd", "elst") as $t | first(grep_by(.type == $t))] as [$mdhd, $stsd, $elst]
| { data_format: $stsd.boxes[0].type,
media_scale: $mdhd.time_scale,
edit_list:
[ $elst.entries[]
| { track_duration: (.segment_duration / $mvhd.time_scale),
media_time: (.media_time / $mdhd.time_scale)
}
]
}
]
}
)