Answers.Body: <p>@Gyan gives the answer in comments:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-28T15:51:22.187Z
Answers.LastActivityDate: 2018-10-28T15:51:22.187Z
Answers.UserDisplayName: iter
Body: <p>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.</p>
  
  <p>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 <code>ffmpeg</code>.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-25T04:29:58.743Z
Comments.Text: What's the framerate?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-25T16:23:05.483Z
Comments.Text: LTC is fixed at 24 fps; video frame rate can be anything from 23.9 to 60. Curious how this affects the problem.
Comments.UserDisplayName: iter
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-25T16:26:35.283Z
Comments.Text: 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.
Comments.UserDisplayName: iter
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-25T16:52:49.727Z
Comments.Text: 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.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-25T20:24:27.250Z
Comments.Text: 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: https://www.itu.int/dms_pubrec/itu-r/rec/br/R-REC-BR.780-2-200504-I!!PDF-E.pdf
  3) I gather from your answer that you are an ffmpeg maintainer. Which parts do you work on?
Comments.UserDisplayName: iter
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-25T20:32:54.890Z
Comments.Text: 4) Which other common containers support `-timecode`?
  5) Reading up on `-timecode` in the manual, I see `-timestamp` parameter. What is the relationship between these? Does `-timestamp` refer to the first frame, or the last (i.e. when the file finished writing)? If these two parameter write different fields in a file, do NLEs interpret them differently?
Comments.UserDisplayName: iter
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-10-26T23:17:21.283Z
Comments.Text: @iter, I'd suggest you create new questions for all the ones you asked in comments. You'll get more exposure that way. Comments aren't really meant for asking new questions or extended discussions. If you need to continue the discussion, please move that to chat.
Comments.UserDisplayName: Michael Liebman
Tags: <ffmpeg><codec><sync>
Title: Add timecode information to file
UserDisplayName: iter
ThreadText: # Add timecode information to file
  
  (Asked by: username_0 on 2018-10-24)
  
  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`.
  
  **Tags:** ffmpeg, codec, sync
  
  > **Comments:**
  > **username_1**: What's the framerate?  
  > **username_0**: LTC is fixed at 24 fps; video frame rate can be anything from 23.9 to 60. Curious how this affects the problem.  
  > **username_0**: 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.  
  > **username_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.  
  > **username_0**: 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: https://www.itu.int/dms_pubrec/itu-r/rec/br/R-REC-BR.780-2-200504-I!!PDF-E.pdf 3) I gather from your answer that you are an ffmpeg maintainer. Which parts do you work on?  
  > **username_0**: 4) Which other common containers support `-timecode`? 5) Reading up on `-timecode` in the manual, I see `-timestamp` parameter. What is the relationship between these? Does `-timestamp` refer to the first frame, or the last (i.e. when the file finished writing)? If these two parameter write different fields in a file, do NLEs interpret them differently?  
  > **username_2**: @username_0, I'd suggest you create new questions for all the ones you asked in comments. You'll get more exposure that way. Comments aren't really meant for asking new questions or extended discussions. If you need to continue the discussion, please move that to chat.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-10-28. Score: 3 | Accepted answer
  
  @username_1 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.
  
  
  ---
  
  