Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract only the time information? #6

Open
ThomasDalla opened this issue Feb 12, 2021 · 5 comments
Open

Extract only the time information? #6

ThomasDalla opened this issue Feb 12, 2021 · 5 comments

Comments

@ThomasDalla
Copy link

Thanks for the tool, very useful.
Is there a way to only save the time in the SRT?

@ThomasDalla
Copy link
Author

FFmpeg supports that in rtmd...

Yes but most players can't show the time when playing the file so I prefer to extract it into a sidecar SRT (or webtt).
And some containers don't support rtmd data (when re-encoding).
Is it possible to extract the time information from rtmd stream into a subtitle stream directly in ffmpeg?

@ThomasDalla
Copy link
Author

Right, so currently I have a custom script that calls exiftool -ee input.mp4 and parse the "Sample Time" and "Date Time" entries to build the srt (very custom, works with videos from my camera but probably not much more).
But as far as I know, neither ffprobe nor exiftool can already export it in SRT format or anything else that can be added directly as a subtitle stream in ffmpeg, which is why I wonder if that tool (which is more powerful than extracting just time information) was able to do that so I can retire my custom script?

@mungewell
Copy link

Just found this project and looking to extract the per-frame TimeCode info, but confused a little by the values the XML on my AS100.

1080p60, NDF, TC set to 11:22:33:18 to start

<LtcChangeTable tcFps="30" halfStep="true">
<LtcChange frameCount="0" value="18332211" status="increment"/>
<LtcChange frameCount="629" value="02C42211" status="end"/>

1080p60, DF, TC set to 11:22:33:11 to start

<LtcChangeTable tcFps="30" halfStep="true">
<LtcChange frameCount="0" value="51332211" status="increment"/>
<LtcChange frameCount="629" value="65C32211" status="end"/>

1080p24, NDF, TC set to 00:00:00:00 to start

<LtcChangeTable tcFps="24" halfStep="false">
<LtcChange frameCount="0" value="00000000" status="increment"/>
<LtcChange frameCount="263" value="23100000" status="end"/>

1080p30, DF, TC set to 00:00:00:00 to start

<LtcChangeTable tcFps="30" halfStep="false">
<LtcChange frameCount="0" value="40000000" status="increment"/>
<LtcChange frameCount="329" value="69100000" status="end"/>

1080p60, DF, TC set to 00:00:00:00 to start

<LtcChangeTable tcFps="30" halfStep="true">
<LtcChange frameCount="0" value="40000000" status="increment"/>
<LtcChange frameCount="629" value="54900000" status="end"/>

'TC.Run' set to 'REC' (only advance TC when recording) and 'TC.MAKE' set to 'PRSET'.
User bits set to FF:11:22:33, and 'TRec' set to 'Off' (Does not record the time as a user bit).

To me those 'end' values don't make sense...
1). If they are BCD values there should be NO letters ('C' in the top two)
2). If they are BCD reversed bytes order, how can frames be '69' dude?

@mungewell
Copy link

For

<LtcChangeTable tcFps="30" halfStep="true">
<LtcChange frameCount="0" value="18332211" status="increment"/>
<LtcChange frameCount="629" value="02C42211" status="end"/>

The first packet from the stream looks like:

00000000: 001c 0100 00ad 0337 f001 0010 000b 1621  .......7.......!
00000010: 0024 003c 0000 0000 3322 11ff 060e 2b34  .$.<....3"....+4
00000020: 0253 0101 0c02 0101 0101 0000 8300 000c  .S..............
00000030: 8000 0002 d077 8001 0002 51ad 060e 2b34  .....w....Q...+4
00000040: 0253 0101 0c02 0101 0201 0000 8300 0036  .S.............6
00000050: 8100 0010 060e 2b34 0401 010b 0510 0101  ......+4........
00000060: 0102 0000 8101 0001 0081 0900 0800 0000  ................
00000070: 0100 0000 3c81 0a00 0209 6081 0c00 0200  ....<.....`.....
00000080: 6481 0d00 0101 060e 2b34 0253 0101 0c02  d.......+4.S....
00000090: 0101 7f01 0000 8300 002f e000 0010 9669  ........./.....i
000000a0: 0800 4678 031c 2051 0000 f0c0 1181 e300  ..Fx.. Q........
000000b0: 0001 01e3 0200 0100 e303 0001 ffe3 0400  ................
000000c0: 0800 2014 0114 2359 4300 0000 0000 0000  .. ...#YC.......
000000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
...

And the last packet looks like:

00000000: 001c 0100 00ad 0337 f001 0010 000b 162c  .......7.......,
00000010: 0005 003c 0000 0000 3322 11ff 060e 2b34  ...<....3"....+4
00000020: 0253 0101 0c02 0101 0101 0000 8300 000c  .S..............
00000030: 8000 0002 d077 8001 0002 51ad 060e 2b34  .....w....Q...+4
00000040: 0253 0101 0c02 0101 0201 0000 8300 0036  .S.............6
00000050: 8100 0010 060e 2b34 0401 010b 0510 0101  ......+4........
00000060: 0102 0000 8101 0001 0081 0900 0800 0000  ................
00000070: 0100 0000 3c81 0a00 0209 6081 0c00 0200  ....<.....`.....
00000080: 6481 0d00 0101 060e 2b34 0253 0101 0c02  d.......+4.S....
00000090: 0101 7f01 0000 8300 002f e000 0010 9669  ........./.....i
000000a0: 0800 4678 031c 2051 0000 f0c0 1181 e300  ..Fx.. Q........
000000b0: 0001 01e3 0200 0100 e303 0001 ffe3 0400  ................
000000c0: 0800 2014 0114 2359 5300 0000 0000 0000  .. ...#YS.......
000000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
...

Can someone point me at which part of the data is for the TimeCodes?

@ignusgraius
Copy link

Just found this project and looking to extract the per-frame TimeCode info, but confused a little by the values the XML on my AS100.

1080p60, NDF, TC set to 11:22:33:18 to start

<LtcChangeTable tcFps="30" halfStep="true">
<LtcChange frameCount="0" value="18332211" status="increment"/>
<LtcChange frameCount="629" value="02C42211" status="end"/>

1080p60, DF, TC set to 11:22:33:11 to start

<LtcChangeTable tcFps="30" halfStep="true">
<LtcChange frameCount="0" value="51332211" status="increment"/>
<LtcChange frameCount="629" value="65C32211" status="end"/>

1080p24, NDF, TC set to 00:00:00:00 to start

<LtcChangeTable tcFps="24" halfStep="false">
<LtcChange frameCount="0" value="00000000" status="increment"/>
<LtcChange frameCount="263" value="23100000" status="end"/>

1080p30, DF, TC set to 00:00:00:00 to start

<LtcChangeTable tcFps="30" halfStep="false">
<LtcChange frameCount="0" value="40000000" status="increment"/>
<LtcChange frameCount="329" value="69100000" status="end"/>

1080p60, DF, TC set to 00:00:00:00 to start

<LtcChangeTable tcFps="30" halfStep="true">
<LtcChange frameCount="0" value="40000000" status="increment"/>
<LtcChange frameCount="629" value="54900000" status="end"/>

'TC.Run' set to 'REC' (only advance TC when recording) and 'TC.MAKE' set to 'PRSET'. User bits set to FF:11:22:33, and 'TRec' set to 'Off' (Does not record the time as a user bit).

To me those 'end' values don't make sense... 1). If they are BCD values there should be NO letters ('C' in the top two) 2). If they are BCD reversed bytes order, how can frames be '69' dude?

I found this thread after trying to re-sync a bunch of Sony FX3 footage (which involves shifting the timecode values). All of my footage is 30fps or 60fps, and what I think I've basically found is that the XML value is the starting timecode written backwards. For 30fps timecode that starts at 05:23:14:18, the XML value will be 18142305. 60fps timecode is just recorded as 30fps timecode with the frame value halved (05:23:14:36 will still be represented as 18142305). And if you're using drop-frame, then it adds 40 to the first two digits (i.e., 05;23;14;18 30fps DF will be 58142305, and 05;23;14;36 60fps DF will also be written as 58142305).

I don't know what the end value means yet, but I think the pattern still follows with the first 2 digits representing the last frame... maybe digits 3&4 represent a hex value? Anyway, it was frustrating me all afternoon so maybe this will help someone in a similar predicament.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@mungewell @ThomasDalla @ignusgraius and others