title: Use ffmpeg to downscale, tonemap, downmix and re encode mkv
body: <p>I try to use ffmpeg to downscale a 4k and tonemap a 4k HDR mkv to a 1080p SDR mkv with this code:</p>
  <pre><code>ffmpeg -i &quot;Input.mkv&quot; -vf zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p -c:v hevc_nvenc -b:v 12M -preset slow &quot;Output.mkv&quot;
  </code></pre>
  <p>The problem is, that only the first audio track (of four) is copied to the new mkv and the subtitle tracks are missing:</p>
  <p><strong>Input:</strong></p>
  <pre><code>Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
  Stream #0:1(ger): Audio: eac3, 48000 Hz, 7.1, fltp (default)
  Stream #0:2(ger): Audio: dts (DTS-HD MA), 48000 Hz, 7.1, s16p
  Stream #0:3(eng): Audio: truehd, 48000 Hz, 7.1, s32 (24 bit)
  Stream #0:4(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s
  Stream #0:5(ger): Subtitle: subrip (default) (forced)
  Stream #0:6(ger): Subtitle: dvd_subtitle, 1920x1080 (forced)
  Stream #0:7(ger): Subtitle: hdmv_pgs_subtitle, 1920x1080 (forced)
  Stream #0:8(ger): Subtitle: dvd_subtitle, 1920x1080
  Stream #0:9(ger): Subtitle: hdmv_pgs_subtitle
  Stream #0:10(eng): Subtitle: dvd_subtitle, 1920x1080
  Stream #0:11(eng): Subtitle: hdmv_pgs_subtitle
  </code></pre>
  <p><strong>Output:</strong></p>
  <pre><code>Stream #0:0: Video: hevc (Main), yuv420p(tv), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
  Stream #0:1(ger): Audio: vorbis, 48000 Hz, 7.1, fltp (default)
  Stream #0:2(ger): Subtitle: ass (default) (forced)
  </code></pre>
  <p>I would like to have an mkv as output converts all the audio tracks to aac Stereo (but keeps all four of them), copies the subtitle tracks and tonemaps/downscales the video track.</p>
  <p>I have tried to use the <code>-map 0</code> or <code>-map 0:a:0 -map 0:a:1 ...</code> commands (and some similiar to those, however I seemingly end up with either one audio track, no video track or a video track that is just copied.</p>
  <p>I possible, I would also like to use nvenc with a high quality preset, which is the reason for <code>-c:v hevc_nvenc -b:v 12M -preset slow</code> in my command, however I have no idea, if this is done right, since the ouput mkv also as a 4k video track instead of a 1080p. Maybe this is caused by the <code>-c:v</code> because it overrides <code>-vf</code>? Sorry, I am feeling dumb and am just getting started with ffmpeg.</p>
  <p>There is so much information about ffmpeg out there, but it is either too complicated for me, or not answering my questions.</p>
  <p>Thanks for your help!</p>