I try to use ffmpeg to downscale a 4k and tonemap a 4k HDR mkv to a 1080p SDR mkv with this code:
ffmpeg -i "Input.mkv" -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 "Output.mkv"
The problem is, that only the first audio track (of four) is copied to the new mkv and the subtitle tracks are missing:
Input:
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
Output:
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)
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.
I have tried to use the -map 0
or -map 0:a:0 -map 0:a:1 ...
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.
I possible, I would also like to use nvenc with a high quality preset, which is the reason for -c:v hevc_nvenc -b:v 12M -preset slow
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 -c:v
because it overrides -vf
? Sorry, I am feeling dumb and am just getting started with ffmpeg.
There is so much information about ffmpeg out there, but it is either too complicated for me, or not answering my questions.
Thanks for your help!