Answers.Body: <p>The <code>-metadata</code> option is for manipulating the metadata. If you just want to copy the metadata from an input file to an output file, you should use the <a href="https://ffmpeg.org/ffmpeg.html#Advanced-options" rel="noreferrer"><code>-map_metadata</code></a> option:</p>
  <pre><code>ffmpeg -i a.MOV -map_metadata 0 -c copy c.MOV
  </code></pre>
  <p>The file specifier is a zero-indexed number, so '0' takes the metadata from the first input file.</p>
  <p>Note that <code>-map_metadata</code> and <code>-movflags</code> can be used in conjunction to preserve more metadata:</p>
  <pre><code>ffmpeg -i in.mp4 -crf 27 -movflags use_metadata_tags -map_metadata 0 out.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-17T09:02:35.460Z
Answers.Text: `-map_metadata 0` or `-map_metadata 1`?
Answers.UserDisplayName: evandrix
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-17T19:28:33.057Z
Answers.Text: @evandrix As stated in the answer, 0 selects the *first input file* as the source. For details, see [this section of the ffmpeg docs](https://ffmpeg.org/ffmpeg.html#Advanced-options).
Answers.UserDisplayName: junkyardsparkle
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-22T22:20:46.250Z
Answers.LastActivityDate: 2022-06-30T07:20:17.287Z
Answers.LastEditDate: 2022-06-30T07:20:17.287Z
Answers.UserDisplayName: junkyardsparkle
Answers.Body: <p>FFmpeg, by default, makes all metadata from the first input file <strong>available</strong>, to the output file muxer, for writing. <code>-map_metadata</code> allows to override that, by either pointing to a different input, or by telling ffmpeg to discard input global metadata (value of <code>-1</code>).</p>
  
  <p>However, which of the available metadata, is <strong>actually written</strong> to the output file, depends on the output muxer. The QT/ISOBMFF muxer (for MOV/MP4/3GP..) only considers a limited number of tags, primarily iTunes-related. As @JerryTian noted, with <code>-movflags use_metadata_tags</code>, all other tags are written to the file. However, these are written in an unconventional manner - Quicktime, in particular, does not recognize these additional metadata entries. Other, ffmpeg-based s/w, should read them. Or anyone who's using custom s/w, like @JerryTian, can adapt their s/w to read them.</p>
  
  <p>Note that movflags only applies to output from the QT muxer. Matroska (MKV) will write anything. Other muxers vary.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-30T12:09:34.230Z
Answers.Text: I\m trying to keep metadata when converting music. I have a custom CATALOGID, but when converting from wav to flac. The field is not preserved. ffmpeg -i bb.wav bb2.flac -movflags use_metadata_tags. Any idea ?
Answers.UserDisplayName: Léo Coco
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-28T17:47:21.747Z
Answers.Text: So if I understand you correctly, you're saying that using FFmpeg to encode into an .mkv should preserve all metadata from the source by default, without needing to speciify any additional options?
Answers.UserDisplayName: Hashim Aziz
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-01T06:42:46.760Z
Answers.LastActivityDate: 2019-03-01T06:42:46.760Z
Answers.UserDisplayName: Gyan
Answers.Body: <p>I haven't found a way to have ffmpeg preserve the data. But I've found that for my needs I wanted the exif metadata and the <a href="https://www.sno.phy.queensu.ca/~phil/exiftool/" rel="noreferrer"><code>exiftool</code></a> was a convenient solution. </p>
  
  <p>You can copy metadata between video files: <a href="https://unix.stackexchange.com/a/492338/83370">https://unix.stackexchange.com/a/492338/83370</a></p>
  
  <p>There's a trick to copy all metadata using the option <code>-all:all&gt;all:all</code>: 
  <a href="http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3440.0" rel="noreferrer">http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3440.0</a></p>
  
  <pre><code>exiftool -TagsFromFile a.MOV "-all:all&gt;all:all" c.MOV
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-24T13:36:43.427Z
Answers.Text: I tried all above on files from Canon 200D and this one is actually most useful. It still makes further `exiftool c.MOV` much smaller than the output from the original, but it preserves actual creation date (`-map_metadata` did it too, but not `-movflags`) and camera name, but lens information is still gone.
Answers.UserDisplayName: virgo47
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-24T14:16:44.187Z
Answers.Text: OK, this was actually a great starting point - all I had to do is skip that mapping part. Just using `exiftool -TagsFromFile in.mp4 out.mp4` did the job!
Answers.UserDisplayName: virgo47
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-14T00:08:31.517Z
Answers.Text: @virgo47 what should -TagsFromFile look like?
Answers.UserDisplayName: CamHart
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-30T05:33:59.480Z
Answers.LastActivityDate: 2019-09-30T05:33:59.480Z
Answers.UserDisplayName: Tully
Answers.Body: <p>Looking at the <a href="https://github.com/FFmpeg/FFmpeg/blob/d61240f8c95e9cf7a0aaef2bb4495960d3fec62c/libavformat/movenc.c" rel="nofollow noreferrer">ffmpeg source</a></p>
  <p>Which metadata is written is hard-coded. There isn't a normal way to write all metadata --- for mov, mp4, etc. Whereas I can see that <a href="https://github.com/FFmpeg/FFmpeg/blob/d61240f8c95e9cf7a0aaef2bb4495960d3fec62c/libavformat/matroskaenc.c" rel="nofollow noreferrer">a mkv file</a> gets all its metadata.</p>
  <p>I can't say why they have it work that way. For other encoders, it could be different.</p>
  <p>Now I found the <code>use_metadata_tags</code> option to be a bad idea since it is not standard - for example Plex does not read <strong>any</strong> of the metadata anymore. Funny that I was trying to get more metadata into Plex, but this option actually did the opposite. In the code above I can see that the MDTA way is to write all keys, then all values, whereas I guess most programs expect key/value pairs in a list, and therefore just don't know how to read MDTA metadata.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-02-27T23:47:19.940Z
Answers.LastActivityDate: 2024-08-02T17:20:02.830Z
Answers.LastEditDate: 2024-08-02T17:20:02.830Z
Answers.UserDisplayName: Alex TD
Answers.Body: <p>From the comment in the answer <a href="https://superuser.com/questions/523286/how-to-make-handbrake-preserve-capture-time-creation-time/523696#comment2528176_523696">https://superuser.com/questions/523286/how-to-make-handbrake-preserve-capture-time-creation-time/523696#comment2528176_523696</a></p>
  <p>A full command line adding the option to copy special tags will be:</p>
  <pre><code>ffmpeg -i in.mp4 -i out.mp4 -map 1 -map_metadata 0 -c copy -movflags use_metadata_tags fixed.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-05-30T02:43:02.313Z
Answers.LastActivityDate: 2023-12-18T19:41:06.980Z
Answers.LastEditDate: 2023-12-18T19:41:06.980Z
Answers.UserDisplayName: julian-alarcon
Answers.Body: <p>ffmpeg does not correctly preserve Keys tags in movie metadata. The problem is that the Keys tags are embedded in UserData atom which Apple's apps do not display:</p>
  <pre><code>ffmpeg -i input.mp4 -c copy -movflags use_metadata_tags -map_metadata 0 output.mp4
  </code></pre>
  <p>That can be fixed with exiftool:</p>
  <pre><code>exiftool -m -overwrite_original -api LargeFileSupport=1 -Keys:All= -tagsFromFile @ -Keys:All output.mp4
  </code></pre>
  <p><a href="https://trac.ffmpeg.org/ticket/4209#comment:26" rel="nofollow noreferrer">https://trac.ffmpeg.org/ticket/4209#comment:26</a><br />
  <a href="https://exiftool.org/forum/index.php?topic=15418.msg82847#msg82847" rel="nofollow noreferrer">https://exiftool.org/forum/index.php?topic=15418.msg82847#msg82847</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-05-01T17:16:03.633Z
Answers.LastActivityDate: 2024-05-03T13:45:06.610Z
Answers.LastEditDate: 2024-05-03T13:45:06.610Z
Answers.UserDisplayName: wywh
Answers.Body: <p>Other answers here only work with the &quot;known&quot; meta keys, but for custom/arbitrary meta keys, <code>-map_metadata 0</code> is not sufficient to keep them all.</p>
  <p>In my transcoder project, a lot of camera makers like to inject custom meta keys in the MP4/MOV container, and I want to keep them in the transcoded MP4/MOV files. After a lot of head scratching, FFmpeg does seem to have a switch for this purpose:</p>
  <pre><code>-movflags use_metadata_tags
  </code></pre>
  <p>Note that this has to go after the input file, as for example in:</p>
  <pre><code>ffmpeg -i $input_file -movflags use_metadata_tags -crf 22 $output_file
  </code></pre>
  <p>Credit goes to the author of this thread and Google:</p>
  <p><a href="https://superuser.com/questions/1208273/add-new-and-non-defined-metadata-to-a-mp4-file">https://superuser.com/questions/1208273/add-new-and-non-defined-metadata-to-a-mp4-file</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-11T09:41:15.510Z
Answers.Text: Nice tip - thanks. One thing I noticed when I converted a bunch of mov files I had recorded on iphones the Rotation tag in the exif data said 180. ffmpeg by default auto rotates the video - but if you also copy the mov tags to the mp4, then it still tells the player to rotate 180 even though ffmpeg auto rotated the mp4 during the conversion. So my videos ended up being upside down when I played them :) - The workaround in my case was to tell ffmpeg to not auto rotate using `-noautorotate` - a quick workaround is to use Exiftool and set the rotation to 0 - `exiftool -Rotation=0 file.mp4`
Answers.UserDisplayName: joensson
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-07T10:55:05.613Z
Answers.Text: Wow, credits indeed. `ffmpeg -h full` documents `use_metadata_tags` as "Use mdta atom for metadata", not the least obfuscated way of saying "just preserve my metadata"!
Answers.UserDisplayName: RJVB
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-11T19:21:14.403Z
Answers.Text: So do I use `-movflags use_metadata_tags` in conjunction with `-map_metadata 0` or is the first one enough?
Answers.UserDisplayName: Shayan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-12T02:36:15.830Z
Answers.Text: @Shayan the first one is enough to "keep all", but with some side effects mentioned in other comments, you need to check if that matters for your cases.
Answers.UserDisplayName: Jerry Tian
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-06-02T09:26:02.250Z
Answers.Text: I think you should include a warning in the answer that other apps can't read these tags (Music, Plex, Meta) because they might use `ffmpeg` to verify tags were added and think all is well.
Answers.UserDisplayName: malhal
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-28T05:21:17.140Z
Answers.LastActivityDate: 2022-05-22T14:25:45.640Z
Answers.LastEditDate: 2022-05-22T14:25:45.640Z
Answers.UserDisplayName: Jerry Tian
Body: <p>When I am simply copying <code>a.MOV</code> (from my iPhone) to <code>c.MOV</code>, <a href="https://en.wikipedia.org/wiki/FFmpeg" rel="noreferrer">FFmpeg</a> drops a lot of metadata, including the time and location of the video.</p>
  <p>I tried <code>-metadata</code>, but FFmpeg still drops the information. It seems that the metadata is not dropped when FFmpeg prints <code>Output #0</code>, but is dropped when I use <a href="https://ffmpeg.org/ffprobe.html" rel="noreferrer"><code>ffprobe</code></a> to see metadata of the output file.</p>
  <p>What should I do to make FFmpeg preserve these metadata?</p>
  <pre><code>$ ffmpeg -i a.MOV -c copy c.MOV -y
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.MOV':
    Metadata:
      major_brand     : qt  
      minor_version   : 0
      compatible_brands: qt  
      creation_time   : 2018-03-...
      com.apple.quicktime.location.ISO6709: .../
      com.apple.quicktime.make: Apple
      com.apple.quicktime.model: iPhone ...
      com.apple.quicktime.software: 11....
      com.apple.quicktime.creationdate: 2018-03-...
    Duration: 00:00:01.77, start: 0.000000, bitrate: 7868 kb/s
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 7707 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
        encoder         : H.264
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 87 kb/s (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
      Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
      Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
  Output #0, mov, to 'c.MOV':
    Metadata:
      major_brand     : qt  
      minor_version   : 0
      compatible_brands: qt  
      com.apple.quicktime.creationdate: 2018-03-...
      com.apple.quicktime.location.ISO6709: .../
      com.apple.quicktime.make: Apple
      com.apple.quicktime.model: iPhone ...
      com.apple.quicktime.software: 11....
      encoder         : Lavf57.71.100
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, q=2-31, 7707 kb/s, 30 fps, 30 tbr, 19200 tbn, 600 tbc (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
        encoder         : H.264
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 87 kb/s (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (copy)
    Stream #0:1 -&gt; #0:1 (copy)
  Press [q] to stop, [?] for help
  frame=   23 fps=0.0 q=-1.0 Lsize=     732kB time=00:00:01.76 bitrate=7827.5kbits/s speed= 971x    
  video:921kB audio:9kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.291216%
  $ ffprobe c.MOV
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'c.MOV':
    Metadata:
      major_brand     : qt  
      minor_version   : 512
      compatible_brands: qt  
      encoder         : Lavf57.71.100
    Duration: 00:00:00.77, start: 0.000000, bitrate: 7819 kb/s
      Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 7707 kb/s, 30 fps, 30 tbr, 19200 tbn, 38400 tbc (default)
      Metadata:
        handler_name    : DataHandler
        encoder         : H.264
      Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 92 kb/s (default)
      Metadata:
        handler_name    : DataHandler
  $ 
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-11-10T04:14:10.827Z
Comments.Text: I have the same problem; the above doesn't work. I am using ffmpeg version
  ffmpeg version 3.4.4-1~16.04.york0 Copyright (c) 2000-2018 the FFmpeg developers and this ffmpeg -i a.MOV -map_metadata 0 -c copy c.MOV still causes this to be dropped:-
  Writing library : Apple QuickTime
  com.apple.quicktime.make : Apple
  com.apple.quicktime.model : iPhone 5s
  com.apple.quicktime.software : 10.3.3
  com.apple.quicktime.creationdate : 2018-06-06T01:15:37+0800 and to be replaced with:-
  Writing application : Lavf57.83.100
Comments.UserDisplayName: Mark
Tags: <ffmpeg><metadata>
Title: How to prevent FFmpeg from dropping metadata?
UserDisplayName: Eric Stdlib
ThreadText: # How to prevent FFmpeg from dropping metadata?
  
  (Asked by: username_0 on 2018-04-08)
  
  When I am simply copying `a.MOV` (from my iPhone) to `c.MOV`, [FFmpeg](https://en.wikipedia.org/wiki/FFmpeg) drops a lot of metadata, including the time and location of the video.
  
  I tried `-metadata`, but FFmpeg still drops the information. It seems that the metadata is not dropped when FFmpeg prints `Output #0`, but is dropped when I use [`ffprobe`](https://ffmpeg.org/ffprobe.html) to see metadata of the output file.
  
  What should I do to make FFmpeg preserve these metadata?
  
  ```
  $ ffmpeg -i a.MOV -c copy c.MOV -y
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.MOV':
    Metadata:
      major_brand     : qt  
      minor_version   : 0
      compatible_brands: qt  
      creation_time   : 2018-03-...
      com.apple.quicktime.location.ISO6709: .../
      com.apple.quicktime.make: Apple
      com.apple.quicktime.model: iPhone ...
      com.apple.quicktime.software: 11....
      com.apple.quicktime.creationdate: 2018-03-...
    Duration: 00:00:01.77, start: 0.000000, bitrate: 7868 kb/s
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 7707 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
        encoder         : H.264
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 87 kb/s (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
      Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
      Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
  Output #0, mov, to 'c.MOV':
    Metadata:
      major_brand     : qt  
      minor_version   : 0
      compatible_brands: qt  
      com.apple.quicktime.creationdate: 2018-03-...
      com.apple.quicktime.location.ISO6709: .../
      com.apple.quicktime.make: Apple
      com.apple.quicktime.model: iPhone ...
      com.apple.quicktime.software: 11....
      encoder         : Lavf57.71.100
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, q=2-31, 7707 kb/s, 30 fps, 30 tbr, 19200 tbn, 600 tbc (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
        encoder         : H.264
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 87 kb/s (default)
      Metadata:
        creation_time   : 2018-03-...
        handler_name    : Core Media Data Handler
  Stream mapping:
    Stream #0:0 -> #0:0 (copy)
    Stream #0:1 -> #0:1 (copy)
  Press [q] to stop, [?] for help
  frame=   23 fps=0.0 q=-1.0 Lsize=     732kB time=00:00:01.76 bitrate=7827.5kbits/s speed= 971x    
  video:921kB audio:9kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.291216%
  $ ffprobe c.MOV
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'c.MOV':
    Metadata:
      major_brand     : qt  
      minor_version   : 512
      compatible_brands: qt  
      encoder         : Lavf57.71.100
    Duration: 00:00:00.77, start: 0.000000, bitrate: 7819 kb/s
      Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 7707 kb/s, 30 fps, 30 tbr, 19200 tbn, 38400 tbc (default)
      Metadata:
        handler_name    : DataHandler
        encoder         : H.264
      Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 92 kb/s (default)
      Metadata:
        handler_name    : DataHandler
  $ 
  
  ```
  
  **Tags:** ffmpeg, metadata
  
  > **Comments:**
  > **username_1**: I have the same problem; the above doesn't work. I am using ffmpeg version ffmpeg version 3.4.4-1~16.04.york0 Copyright (c) 2000-2018 the FFmpeg developers and this ffmpeg -i a.MOV -map_metadata 0 -c copy c.MOV still causes this to be dropped:- Writing library : Apple QuickTime com.apple.quicktime.make : Apple com.apple.quicktime.model : iPhone 5s com.apple.quicktime.software : 10.3.3 com.apple.quicktime.creationdate : 2018-06-06T01:15:37+0800 and to be replaced with:- Writing application : Lavf57.83.100  
  
  ---
  
  ## 7 answers
  
  ### Answer by username_13 on 2019-02-28. Score: 61 | Accepted answer
  
  Other answers here only work with the "known" meta keys, but for custom/arbitrary meta keys, `-map_metadata 0` is not sufficient to keep them all.
  
  In my transcoder project, a lot of camera makers like to inject custom meta keys in the MP4/MOV container, and I want to keep them in the transcoded MP4/MOV files. After a lot of head scratching, FFmpeg does seem to have a switch for this purpose:
  
  ```
  -movflags use_metadata_tags
  
  ```
  
  Note that this has to go after the input file, as for example in:
  
  ```
  ffmpeg -i $input_file -movflags use_metadata_tags -crf 22 $output_file
  
  ```
  
  Credit goes to the author of this thread and Google:
  
  <https://superuser.com/questions/1208273/add-new-and-non-defined-metadata-to-a-mp4-file>
  
  > **Comments:**
  > **username_14**: Nice tip - thanks. One thing I noticed when I converted a bunch of mov files I had recorded on iphones the Rotation tag in the exif data said 180. ffmpeg by default auto rotates the video - but if you also copy the mov tags to the mp4, then it still tells the player to rotate 180 even though ffmpeg auto rotated the mp4 during the conversion. So my videos ended up being upside down when I played them :) - The workaround in my case was to tell ffmpeg to not auto rotate using `-noautorotate` - a quick workaround is to use Exiftool and set the rotation to 0 - `exiftool -Rotation=0 file.mp4`  
  > **username_15**: Wow, credits indeed. `ffmpeg -h full` documents `use_metadata_tags` as "Use mdta atom for metadata", not the least obfuscated way of saying "just preserve my metadata"!  
  > **username_16**: So do I use `-movflags use_metadata_tags` in conjunction with `-map_metadata 0` or is the first one enough?  
  > **username_13**: @username_16 the first one is enough to "keep all", but with some side effects mentioned in other comments, you need to check if that matters for your cases.  
  > **username_17**: I think you should include a warning in the answer that other apps can't read these tags (Music, Plex, Meta) because they might use `ffmpeg` to verify tags were added and think all is well.  
  
  ---
  
  ### Answer by username_2 on 2018-07-22. Score: 28
  
  The `-metadata` option is for manipulating the metadata. If you just want to copy the metadata from an input file to an output file, you should use the [`-map_metadata`](https://ffmpeg.org/ffmpeg.html#Advanced-options) option:
  
  ```
  ffmpeg -i a.MOV -map_metadata 0 -c copy c.MOV
  
  ```
  
  The file specifier is a zero-indexed number, so '0' takes the metadata from the first input file.
  
  Note that `-map_metadata` and `-movflags` can be used in conjunction to preserve more metadata:
  
  ```
  ffmpeg -i in.mp4 -crf 27 -movflags use_metadata_tags -map_metadata 0 out.mp4
  
  ```
  
  > **Comments:**
  > **username_3**: `-map_metadata 0` or `-map_metadata 1`?  
  > **username_2**: @username_3 As stated in the answer, 0 selects the *first input file* as the source. For details, see [this section of the ffmpeg docs](https://ffmpeg.org/ffmpeg.html#Advanced-options).  
  
  ---
  
  ### Answer by username_4 on 2019-03-01. Score: 7
  
  FFmpeg, by default, makes all metadata from the first input file **available**, to the output file muxer, for writing. `-map_metadata` allows to override that, by either pointing to a different input, or by telling ffmpeg to discard input global metadata (value of `-1`).
  
  However, which of the available metadata, is **actually written** to the output file, depends on the output muxer. The QT/ISOBMFF muxer (for MOV/MP4/3GP..) only considers a limited number of tags, primarily iTunes-related. As @username_13 noted, with `-movflags use_metadata_tags`, all other tags are written to the file. However, these are written in an unconventional manner - Quicktime, in particular, does not recognize these additional metadata entries. Other, ffmpeg-based s/w, should read them. Or anyone who's using custom s/w, like @username_13, can adapt their s/w to read them.
  
  Note that movflags only applies to output from the QT muxer. Matroska (MKV) will write anything. Other muxers vary.
  
  > **Comments:**
  > **username_5**: I\m trying to keep metadata when converting music. I have a custom CATALOGID, but when converting from wav to flac. The field is not preserved. ffmpeg -i bb.wav bb2.flac -movflags use_metadata_tags. Any idea ?  
  > **username_6**: So if I understand you correctly, you're saying that using FFmpeg to encode into an .mkv should preserve all metadata from the source by default, without needing to speciify any additional options?  
  
  ---
  
  ### Answer by username_7 on 2019-09-30. Score: 7
  
  I haven't found a way to have ffmpeg preserve the data. But I've found that for my needs I wanted the exif metadata and the [`exiftool`](https://www.sno.phy.queensu.ca/~phil/exiftool/) was a convenient solution.
  
  You can copy metadata between video files: <https://unix.stackexchange.com/a/492338/83370>
  
  There's a trick to copy all metadata using the option `-all:all>all:all`:
  <http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3440.0>
  
  ```
  exiftool -TagsFromFile a.MOV "-all:all>all:all" c.MOV
  
  ```
  
  > **Comments:**
  > **username_8**: I tried all above on files from Canon 200D and this one is actually most useful. It still makes further `exiftool c.MOV` much smaller than the output from the original, but it preserves actual creation date (`-map_metadata` did it too, but not `-movflags`) and camera name, but lens information is still gone.  
  > **username_8**: OK, this was actually a great starting point - all I had to do is skip that mapping part. Just using `exiftool -TagsFromFile in.mp4 out.mp4` did the job!  
  > **username_9**: @username_8 what should -TagsFromFile look like?  
  
  ---
  
  ### Answer by username_10 on 2022-02-27. Score: 2
  
  Looking at the [ffmpeg source](https://github.com/FFmpeg/FFmpeg/blob/d61240f8c95e9cf7a0aaef2bb4495960d3fec62c/libavformat/movenc.c)
  
  Which metadata is written is hard-coded. There isn't a normal way to write all metadata --- for mov, mp4, etc. Whereas I can see that [a mkv file](https://github.com/FFmpeg/FFmpeg/blob/d61240f8c95e9cf7a0aaef2bb4495960d3fec62c/libavformat/matroskaenc.c) gets all its metadata.
  
  I can't say why they have it work that way. For other encoders, it could be different.
  
  Now I found the `use_metadata_tags` option to be a bad idea since it is not standard - for example Plex does not read **any** of the metadata anymore. Funny that I was trying to get more metadata into Plex, but this option actually did the opposite. In the code above I can see that the MDTA way is to write all keys, then all values, whereas I guess most programs expect key/value pairs in a list, and therefore just don't know how to read MDTA metadata.
  
  
  ---
  
  ### Answer by username_11 on 2021-05-30. Score: 1
  
  From the comment in the answer <https://superuser.com/questions/523286/how-to-make-handbrake-preserve-capture-time-creation-time/523696#comment2528176_523696>
  
  A full command line adding the option to copy special tags will be:
  
  ```
  ffmpeg -i in.mp4 -i out.mp4 -map 1 -map_metadata 0 -c copy -movflags use_metadata_tags fixed.mp4
  
  ```
  
  
  ---
  
  ### Answer by username_12 on 2024-05-01. Score: 0
  
  ffmpeg does not correctly preserve Keys tags in movie metadata. The problem is that the Keys tags are embedded in UserData atom which Apple's apps do not display:
  
  ```
  ffmpeg -i input.mp4 -c copy -movflags use_metadata_tags -map_metadata 0 output.mp4
  
  ```
  
  That can be fixed with exiftool:
  
  ```
  exiftool -m -overwrite_original -api LargeFileSupport=1 -Keys:All= -tagsFromFile @ -Keys:All output.mp4
  
  ```
  
  <https://trac.ffmpeg.org/ticket/4209#comment:26>  
  <https://exiftool.org/forum/index.php?topic=15418.msg82847#msg82847>
  
  
  ---
  
  