video – FFmpeg: advantages and drawbacks of DTS/TrueHD vs. FLAC

Let say one have two video files test1DTS.m2ts (test1TrueHD.m2ts) and test2DTS.m2ts (test2TrueHD.m2ts). FFprobe shows the following (relevant) information (both files [true for both DTS and TrueHD] has the same properties):

ffprobe -i test1DTS.m2ts
ffprobe version N-122346-g54829e7722-g649a4e98f4+2 Copyright (c) 2007-2025 the FFmpeg developers
  built with gcc 15.2.0 (Rev8, Built by MSYS2 project)
...
Input #0, mpegts, from 'test1DTS.m2ts':
  ...
  Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn,...
  Stream #0:1[0x1100]: Audio: dts (dca) (DTS-HD MA) ([134][0][0][0] / 0x0086), 48000 Hz, 7.1, s32p (24 bit),...
  ...

and

ffprobe -i test1TrueHD.m2ts
ffprobe version N-122346-g54829e7722-g649a4e98f4+2 Copyright (c) 2007-2025 the FFmpeg developers
  built with gcc 15.2.0 (Rev8, Built by MSYS2 project)
...
Input #0, mpegts, from 'test1TrueHD.m2ts':
  ...
  Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn,...
  Stream #0:1[0x1100]: Audio: truehd (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), s32 (24 bit),...
  ...

The task is to combine the two files into a single one resultDTS.mkv (resultTrueHD.mkv). At the same time some parts of the test files are to be cut out. My solution so far is (for Windows CMD):

ffmpeg -i test1DTS.m2ts^
 -i test2DTS.m2ts^
 -filter_complex "[0:v]trim=0.125:20.064,setpts=PTS-STARTPTS[v0]; [0:a:0]atrim=0.125:20.064,asetpts=PTS-STARTPTS[a0]; [1:v]trim=0:72.364,setpts=PTS-STARTPTS[v1]; [1:a:0]atrim=0:72.364,asetpts=PTS-STARTPTS[a1]; [v0][a0][v1][a1]concat=n=2:v=1:a=1[v][a]"^
 -map "[v]"^
 -c:v libx265^
 -crf 14^
 -preset veryslow^
 -pix_fmt yuv420p10le^
 -map "[a]"^
 -c:a:0 dts^
 -strict -2^
 -b:a:0 3840k^
 resultDTS.mkv

Explanation for -b:a:0 3840k: I extract the audio stream with LosslessCut and test then the bitrate of the audio stream with FFprobe:

ffprobe -i test1DTS-stream-1-audio-dts.mka
ffprobe version N-122346-g54829e7722-g649a4e98f4+2 Copyright (c) 2007-2025 the FFmpeg developers
  built with gcc 15.2.0 (Rev8, Built by MSYS2 project)
Input #0, matroska,webm, from 'test1DTS-stream-1-audio-dts.mka':
  ...
  Duration: XX:XX:XX.XX, start: 0.000000, bitrate: 4079 kb/s
  Stream #0:0: Audio: dts (dca) (DTS-HD MA), 48000 Hz, 7.1, s32p (24 bit)

I don’t know how to setup -b:a for dts correctly. I used this old information.

The solution for TrueHD would be respectively the same:

ffmpeg -i test1TrueHD.m2ts^
 -i test2TrueHD.m2ts^
 -filter_complex "[0:v]trim=0.125:20.064,setpts=PTS-STARTPTS[v0]; [0:a:0]atrim=0.125:20.064,asetpts=PTS-STARTPTS[a0]; [1:v]trim=0:72.364,setpts=PTS-STARTPTS[v1]; [1:a:0]atrim=0:72.364,asetpts=PTS-STARTPTS[a1]; [v0][a0][v1][a1]concat=n=2:v=1:a=2[v][a]"^
 -map "[v]"^
 -c:v libx265^
 -crf 14^
 -preset veryslow^
 -pix_fmt yuv420p10le^
 -map "[a]"^
 -c:a:0 truehd^
 -strict -2^
 -b:a:0 3293k^
 resultTrueHD.mkv

And the setting (-b:a:0 3101k) for the audio stream:

ffprobe -i test1TrueHD-stream-1-audio-truehd.mka
ffprobe version N-122346-g54829e7722-g649a4e98f4+2 Copyright (c) 2007-2025 the FFmpeg developers
  built with gcc 15.2.0 (Rev8, Built by MSYS2 project)
Input #0, matroska,webm, from 'test1TrueHD-stream-1-audio-truehd.mka':
  ...
  Duration: XX:XX:XX.XX, start: 0.000000, bitrate: 3293 kb/s
  Stream #0:0: Audio: truehd, 48000 Hz, 5.1(side), s32 (24 bit)

The result (for DTS):

ffprobe -i resultDTS.mkv
ffprobe version N-122346-g54829e7722-g649a4e98f4+2 Copyright (c) 2007-2025 the FFmpeg developers
  built with gcc 15.2.0 (Rev8, Built by MSYS2 project)
  ...
Input #0, matroska,webm, from 'resultDTS.mkv':
  ...
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn
  ...
  Stream #0:1: Audio: dts (dca) (DTS), 48000 Hz, 5.1(side), fltp, 3840 kb/s
  ...

How you can see the dts codec of FFmpeg cuted two audio channels away (the audio stream of the source test1DTS.m2ts has 7.1 channels, see above). I don’t know if the truehd codec of FFmpeg has the same behavior as the dts codec (I don’t have a TrueHD audio stream source with 7.1 channels).

and (for TrueHD):

ffprobe -i resultTrueHD.mkv
ffprobe version N-122346-g54829e7722-g649a4e98f4+2 Copyright (c) 2007-2025 the FFmpeg developers
  built with gcc 15.2.0 (Rev8, Built by MSYS2 project)
  ...
Input #0, matroska,webm, from 'resultTrueHD.mkv':
  ...
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn
  ...
  Stream #0:1: Audio: truehd, 48000 Hz, 5.1(side), s32 (24 bit)
  ...

If one use FLAC instead of DTS:

ffmpeg -i test1DTS.m2ts^
 -i test2DTS.m2ts^
 -filter_complex "[0:v]trim=0.125:20.064,setpts=PTS-STARTPTS[v0]; [0:a:0]atrim=0.125:20.064,asetpts=PTS-STARTPTS[a0]; [1:v]trim=0:72.364,setpts=PTS-STARTPTS[v1]; [1:a:0]atrim=0:72.364,asetpts=PTS-STARTPTS[a1]; [v0][a0][v1][a1]concat=n=2:v=1:a=1[v][a]"^
 -map "[v]"^
 -c:v libx265^
 -crf 14^
 -preset veryslow^
 -pix_fmt yuv420p10le^
 -map "[a]"^
 -c:a:0 flac^
 resultDTStoFLAC.mkv

or FLAC instead of TrueHD:

ffmpeg -i test1TrueHD.m2ts^
 -i test2TrueHD.m2ts^
 -filter_complex "[0:v]trim=0.125:20.064,setpts=PTS-STARTPTS[v0]; [0:a:0]atrim=0.125:20.064,asetpts=PTS-STARTPTS[a0]; [1:v]trim=0:72.364,setpts=PTS-STARTPTS[v1]; [1:a:0]atrim=0:72.364,asetpts=PTS-STARTPTS[a1]; [v0][a0][v1][a1]concat=n=2:v=1:a=2[v][a]"^
 -map "[v]"^
 -c:v libx265^
 -crf 14^
 -preset veryslow^
 -pix_fmt yuv420p10le^
 -map "[a]"^
 -c:a:0 flac^
 resultTrueHDtoFLAC.mkv

Then the result is as follows (for DTS):

ffprobe -i resultDTStoFLAC.mkv
ffprobe version N-122346-g54829e7722-g649a4e98f4+2 Copyright (c) 2007-2025 the FFmpeg developers
  built with gcc 15.2.0 (Rev8, Built by MSYS2 project)
  ...
Input #0, matroska,webm, from 'resultDTStoFLAC.mkv':
  ...
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn
  ...
  Stream #0:1: Audio: flac, 48000 Hz, 7.1, s32 (24 bit)
  ...

And now you see that the flac codec of FFmpeg has encoded the audio stream correctly.

and (for TrueHD):

ffprobe -i resultTrueHDtoFLAC.mkv
ffprobe version N-122346-g54829e7722-g649a4e98f4+2 Copyright (c) 2007-2025 the FFmpeg developers
  built with gcc 15.2.0 (Rev8, Built by MSYS2 project)
  ...
Input #0, matroska,webm, from 'resultTrueHDtoFLAC.mkv':
  ...
  Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn
  ...
  Stream #0:1: Audio: flac, 48000 Hz, 5.1(side), s32 (24 bit)

So, what is the best practice to deal with DTS and TrueHD if one wish to use FFmpeg? Is FLAC in this context a good alternative for DTS and TrueHD? Are there any other points to cosider?

Read more here: Source link