The .mp4 container format supports a feature called "edit lists" (aka "edit atom" or edts
) that can change playback behavior without modifying the bitstream. Is there a way to view, export, and/or modify the raw data in these edit lists, either using ffmpeg or another tool?
1 Answer
To view the edit lists of a media file you could use ffprobe
with an increased loglevel
.1
$ ffprobe -loglevel trace trimmed.mp4 2>&1 | grep edit
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f895a40f580] track[0].edit_count = 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f895a40f580] Processing st: 0, edit list 0 - media time: 120770, duration: 299786
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f895a40f580] track[1].edit_count = 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f895a40f580] Processing st: 1, edit list 0 - media time: 702, duration: 440685
The first index in this case is the video track and the second index the audio track.
In my understanding the value media time
defines the start time and duration
the duration of each segment. Multiplying them with time_base
should give one the value in seconds.
$ ffprobe -v error -i trimmed.mp4 -show_entries stream=index,duration,time_base
[STREAM]
index=0
time_base=1/30000
duration=9.992867
[/STREAM]
[STREAM]
index=1
time_base=1/44100
duration=9.992857
[/STREAM]
So this sample file has about four seconds of video that are skipped (if the player respects edit lists).
>>> 120770*1/30000
4.025666666666667
>>> 299786*1/30000
9.992866666666666
>>> 702*1/44100
0.015918367346938776
>>> 440685*1/44100
9.992857142857142
1. You'll probably not want to parse this, but there may some way to export a stable machine readable format