1

I'm writing a program that interprets LTC timestamps from audio channels in video files. The goal is to remove the LTC track and replace it with some kind of native timestamps directly in the video file--in a way that downstream NLEs can interpret correctly e.g. for multi-camera timelines.

I've got the LTC parsing done, so for each frame of the video, I can tell what its timestamp is. How do I encode that in containers like .MP4 and .MOV? It would be simplest if I could do it with ffmpeg.

  • What's the framerate? – Gyan Oct 25 '18 at 4:29
  • LTC is fixed at 24 fps; video frame rate can be anything from 23.9 to 60. Curious how this affects the problem. – iter Oct 25 '18 at 16:23
  • As a simplification, and making some assumptions about timebases, I'm only using LTC to calculate the timecode for the first video frame. For every other frame in the file, I simply add the frame's offset from the beginning of the file to the first frame's timecode. – iter Oct 25 '18 at 16:26
  • 1
    MP4s and MOVs store only the TC of the first frame, as a literal frame count, along with the framerate. The consuming app converts that frame count back to a TC string using the framerate. For drop-frame TC, ffmpeg only supports 30 and 60 fps. I'll add 24/48 when I have time and a SMPTE reference that I can consult. For non-drop TC, any fps is fine. Add -timecode HH:MM:SS:FF to your cmd. Use ; for the final separator if TC is drop frame. – Gyan Oct 25 '18 at 16:52
  • Oh, this is cool! At this stage in the project, this is plenty. If you put this as an answer, I'd like to accept it to close out the original question. But your answer brings up more questions :=) 1) I gather from your answer that both MP4 and MOV store DF/NDF flag along with the framerate. 2) I thought DF only existed for 29.98 (and, by extension, for 59.94). I've been using this reference for my LTC code: itu.int/dms_pubrec/itu-r/rec/br/… 3) I gather from your answer that you are an ffmpeg maintainer. Which parts do you work on? – iter Oct 25 '18 at 20:24
0

@Gyan gives the answer in comments:

MP4s and MOVs store only the TC of the first frame, as a literal frame count, along with the framerate. The consuming app converts that frame count back to a TC string using the framerate. For drop-frame TC, ffmpeg only supports 30 and 60 fps. I'll add 24/48 when I have time and a SMPTE reference that I can consult. For non-drop TC, any fps is fine. Add -timecode HH:MM:SS:FF to your cmd. Use ; for the final separator if TC is drop frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.