Copy chapter metadata of input to output for Apple compatibility I have a set of media where I'm trying to strip an audio track and copy everything else over. My command is like so:
ffmpeg -i input.m4v -dn -map 0 -map -0:a:2 -c copy output.m4v

The source file has the following metadata:
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.m4v':
  Metadata:
    major_brand     : M4V 
    minor_version   : 512
    compatible_brands: M4V isomiso2avc1
    encoder         : Lavf58.45.100
  Duration: 01:56:22.98, start: 0.000000, bitrate: 3320 kb/s
    Chapter #0:0: start 0.000000, end 589.923000
    Metadata:
      title           : Chapter 1
    Chapter #0:1: start 589.923000, end 1052.802000
    Metadata:
      title           : Chapter 2
    Chapter #0:2: start 1052.802000, end 1408.282000
    Metadata:
      title           : Chapter 3
    Chapter #0:3: start 1408.282000, end 2034.157000
    Metadata:
      title           : Chapter 4
    Chapter #0:4: start 2034.157000, end 2461.709000
    Metadata:
      title           : Chapter 5
    Chapter #0:5: start 2461.709000, end 3146.101000
    Metadata:
      title           : Chapter 6
    Chapter #0:6: start 3146.101000, end 3454.534000
    Metadata:
      title           : Chapter 7
    Chapter #0:7: start 3454.534000, end 3786.449000
    Metadata:
      title           : Chapter 8
    Chapter #0:8: start 3786.449000, end 4169.207000
    Metadata:
      title           : Chapter 9
    Chapter #0:9: start 4169.207000, end 4569.398000
    Metadata:
      title           : Chapter 10
    Chapter #0:10: start 4569.398000, end 5121.825000
    Metadata:
      title           : Chapter 11
    Chapter #0:11: start 5121.825000, end 5737.065000
    Metadata:
      title           : Chapter 12
    Chapter #0:12: start 5737.065000, end 6326.320000
    Metadata:
      title           : Chapter 13
    Chapter #0:13: start 6326.320000, end 6982.517000
    Metadata:
      title           : Chapter 14
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1910x804 [SAR 1:1 DAR 955:402], 2417 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 254 kb/s (default)
    Metadata:
      handler_name    : Stereo
    Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 640 kb/s
    Metadata:
      handler_name    : Surround
    Side data:
      audio service type: main
    Stream #0:3(eng): Data: bin_data (text / 0x74786574)
    Metadata:
      handler_name    : SubtitleHandler

Without the -dn flag I get an error when running the command:
[ipod @ 0x7f9d4100be00] Tag text incompatible with output codec id '100359' ([0][0][0][0])
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input

When I use the -dn flag I can't select a chapter on my Apple TV which leads me to believe the metadata is incorrect.
When I try and run ffprobe on the produced file I get:
[m4v @ 0x7f966880b800] Format m4v detected only with low score of 1, misdetection possible!
[m4v @ 0x7f966880b800] Could not find codec parameters for stream 0 (Video: mpeg4, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options

I also tried adding -map_chapters and -map_metadata but I get an error:
[ipod @ 0x7f93a0026400] Tag text incompatible with output codec id '100359' ([0][0][0][0])
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input

The command that resulted in the above is:
ffmpeg -i input.m4v -map 0 -map -0:a:2 -map_metadata 0 -map_chapters 0 -c copy output.m4v

What's the proper command to copy everything over EXCEPT the track I want to exclude?
A command like the following seemed to do the trick.
ffmpeg -i input.m4v -dn -map 0 -map -0:a:2 -map_metadata 0 -map_chapters 0 -c copy output.m4v