<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>

CC BY-SA 4.0
2018-10-28T15:51:22.187Z
2018-10-28T15:51:22.187Z
iter
<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>

CC BY-SA 4.0
2018-10-25T04:29:58.743Z
What's the framerate?
Gyan
CC BY-SA 4.0
2018-10-25T16:23:05.483Z
LTC is fixed at 24 fps; video frame rate can be anything from 23.9 to 60. Curious how this affects the problem.
iter
CC BY-SA 4.0
2018-10-25T16:26:35.283Z
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
CC BY-SA 4.0
2018-10-25T16:52:49.727Z
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
CC BY-SA 4.0
2018-10-25T20:24:27.250Z
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?
iter
CC BY-SA 4.0
2018-10-25T20:32:54.890Z
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?
iter
CC BY-SA 4.0
2018-10-26T23:17:21.283Z
@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.
Michael Liebman
<ffmpeg><codec><sync>
Add timecode information to file
iter
# 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 lusername_0al 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 lusername_0al 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.


---

