MediaArea / MediaInfo

Convenient unified display of the most relevant technical and tag data for video and audio files.
https://MediaArea.net/MediaInfo
BSD 2-Clause "Simplified" License
1.32k stars 158 forks source link

Missing First Frame/Last Frame Timecodes for Embedded Text #679

Open carsonoffill opened 1 year ago

carsonoffill commented 1 year ago

I am seeing this in the MediaInfo for SCC files:

<TimeCode_FirstFrame>01:00:00;00</TimeCode_FirstFrame>
<TimeCode_LastFrame>01:50:52;28</TimeCode_LastFrame>

However, this is missing for embedded text tracks. Is this something that can be added to MediaInfo for embedded text?

JeromeMartinez commented 1 year ago

Which format? As far as I know, no such data exists in e.g. 608/708 (the timecode you have in your example is from the SCC container, MP4 does not have that) or Timed Text. For TTML in MP4, it is already implemented e.g.:

General
Format                                   : ccff
Codec ID                                 : ccff (iso6)
[...]

Text #1
ID                                       : 4
Format                                   : TTML
Format/Info                              : Timed Text Markup Language
Format profile                           : SMPTE-TT
Codec ID                                 : stpp
Duration                                 : 11 s 912 ms
Start time                               : 2 s 269 ms
End time                                 : 14 s 181 ms
Bit rate                                 : 110 kb/s
Frame rate                               : 0.084 FPS
Compression mode                         : Lossless
Time code of first frame                 : 00:00:02:08
Time code of last frame                  : 00:00:14:04
Stream size                              : 160 KiB (1%)
Language                                 : English
Default                                  : Yes
Forced                                   : No
Alternate group                          : 1
Encoded date                             : UTC 2012-08-21 20:27:17
Tagged date                              : UTC 2012-08-21 20:27:17
Count of events                          : 0
Count of lines                           : 0

And we can see that time code of start and time code of end are within the duration. Note: better to use Start time and End time, in case TTML timing is not a time code.

Note: it is currently only in development snapshots, the official release 22.12 does not have it (it will be in the next one).

carsonoffill commented 1 year ago

Yea the embedded text was 608, and you're saying that start/end timecodes don't exist for that format correct?

carsonoffill commented 1 year ago

Ultimately I am wanting to know where a video can be trimmed so that text is not cut. For SCC/608, we don't want to trim the buffer so that text isn't corrupted. For 608, I do see a start time available in MediaInfo. Does that start time include the buffer?

JeromeMartinez commented 1 year ago

Yea the embedded text was 608, and you're saying that start/end timecodes don't exist for that format correct?

608 is a "stream", 2x 2 bytes for every frame, constant bit rate, and there is no time stamp or time code metadata for positioning in time the 608 frame, positioning is done by the container only. So you have start/end timestamps, based on container timing info, that's all.

It is not like a TTML in MP4, where timing information is in the TTML so can be out of sync with the container duration e.g. TTML duration could be 10 hours and the container duration only 1 hour. This can happen with TTML, not with 608 in MOV.

Ultimately I am wanting to know where a video can be trimmed so that text is not cut.

So here you are looking for timestamps, not timecodes. Timecode is a metadata, optional (except when it is used as timing information like in SCC), timestamp is always there (sometimes deduced from timecode). The MediaInfo fields interesting for trimming are Duration_Start_Command and Duration_End_Command. Every before Duration_Start_Command is void or invalid, everything after Duration_End_Command is void or invalid.

Note: use the full parsing ( --ParseSpeed=1) for that, slow but needed because the full file must be parsed in order to get the end. Could be optimized (e.g. probing the last minute, 10 minutes... instead of all) but not implemented yet.

Note for myself: while checking, I remarked that 608 in MP4 is lacking Duration_End_Command and that Duration_End (which is the last time stamp for display, there may be commands after it which have no impact on display) is off by 1 frame (timestamp of the beginning of the frame, so if you trim from it you miss the last frame), I'll fix that.

carsonoffill commented 1 year ago

Great, I think Duration_Start/End_Command is what I'm looking for then. Thanks for the help!

carsonoffill commented 1 year ago

I am also noticing missing data for the Duration_End_Command for 608 in mov is missing, and both start and end commands are missing for 708 in mov. Is this expected?

JeromeMartinez commented 1 year ago

I am also noticing missing data for the Duration_End_Command for 608 in mov is missing,

Expected as indicated yesterday in my previous comment, fix on the way.

and both start and end commands are missing for 708 in mov. Is this expected?

Yes, because it was implemented only for 608. Could be implemented for 708 on request.

joe-sciame-wm commented 1 year ago

Thanks Jerome! Yes, can we get 708 support as well. We do have 708 QT MOV files. Generally, its 608 data tunneled into 708 but it does exist.