Timecode often comes in a format specific to the file format, so ffmpeg can't be expected to just 'copy' it without getting explicit instructions.
Sometimes it is added as a global metadata of the file, sometimes it is added specifically to the video stream, sometimes there may be a separate 'data' stream to which it is added as a metadata.
You need to find what stream the original timecode is in.
You can determine this by running
ffmpeg -i INPUT
Example output (excerpts):
ffmpeg version...
...
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'inputfile.mp4':
Metadata:
...
Stream #0:0(und): Video: h264...
...
Stream #0:2(und): Data: none (rtmd / 0x646D7472), 2252 kb/s (default)
Metadata:
creation_time : 2021-06-19T16:39:17.000000Z
handler_name : Timed Metadata Media Handler
timecode : 07:15:07:17
This will display info about all the input streams, including the metadata. Then note down the stream number containing the timecode, in this example stream 2 of input 0, and map it to global metadata using -map_metadata
.
For exapmple, this will map metadata of the stream indexed 2 (s:2) from the first input (0:) to the global (default) metadata of the file, and copy audio-video streams to output:
ffmpeg -i INPUT -map_metadata 0:s:2 -c copy OUTPUT
Note that the numbering and the meaning of 's' is different than how it is in other more common options. Check more info in the ffmpeg documentation.
ffmpeg then reads whatever it understands from that stream (which mostly includes timecode), converts it to the destination file format's specified metadata format, and includes it in the output.
The resulting file will have a timecode recognizable in editing software, like DaVinci Resolve or Premiere Pro.