I have .mp4 files created by a Sony A7s camera. They're using the XAVC S codec. I'm converting them to .mov using the command below. The original files have a timecode but that is not present in the output file. The output files have their timecodes set to zero. Is there any way to preserve the timecode?

ffmpeg -i [filenmae] -vcodec copy -acodec copy [outputDirectory]

In case someone else comes looking for this, timecode in mp4 and mov files is often a "data" track, and ffmpeg usually drops data tracks. To keep all tracks, I usually use these switches to map tracks from the source to tracks in the destination

-map 0:v (video switches)
-map 0:a (audio switches)
-map 0:d (this keeps the data track)

Which also has the advantage of keeping all the source audio tracks, rather than the default of only the first one. So your command might look like

ffmpeg -i [filenmae] -map 0:v -codec:v copy -map 0:a -codec:a copy -map 0:d [outputDirectory]

EDIT: In modern ffmpeg you can also add a question mark (like -0:a?) which means ffmpeg will keep going if it doesn't find a track like you asked it to copy

| improve this answer | |

Just use copy for all streams i.e.

ffmpeg -i [filename] -c copy -map 0 [outputDirectory]

Edit: Let's switch byte-order

ffmpeg -i [filename] -c copy -c:a pcm_s16le -map 0 [outputDirectory]
| improve this answer | |
  • Thanks for the suggestion. I tried it and it copied the timecode, but it didn't copy the audio. I tried it like this " -acodec copy -c copy -map 0" but still no audio. It also gave this message on both your version and the one I modified: [NULL @ 0000000005795f00] Unknown hldr_type for rtmd / 0x646D7472, writing dummy – user3185563 Mar 21 '16 at 13:32
  • Paste the full console output of the command you ran into the question. – Gyan Mar 21 '16 at 13:43
  • pastebin.com/FRey8JZE – user3185563 Mar 22 '16 at 11:43
  • As per that readout, the audio was copied successfully. What does ffprobe C0371.mov say? – Gyan Mar 22 '16 at 14:29
  • You're right, it did copy the audio. The problem I have is that the program I'm using, Davinci Resolve, will read the audio created using the original command, "-vcodec copy -acodec copy", but won't read the audio created using the modified version. That's a problem, because the sole reason I'm doing the conversion is so that Davinci Resolve will read the audio. This is the ffprobe output for both files pastebin.com/Wbkn3nat – user3185563 Mar 28 '16 at 14:24

Timecode and lot of other informations does not belong to video or audio streams, they are metadata attributes.

FFmpeg has lot of command to manipulate metadata attributes, for the specific question you can give a look to my previous question and relative answer: ffmpeg Cut a media preserving all streams but also all metadata, timecodes and everything else

Please consider that metadata tends to change from format to format, so probably you have to find the right metadata field on the original Sony .mp4, parse it properly and write it changed or renamed into the new .mov file, following the QuickTime .mov specifications for timecode definition.

| improve this answer | |

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.