Zend certified PHP/Magento developer

FFmpeg to mitigate truehd effects on remux of MKV to MP4

I am trying to come up with an FFmpeg command (for use in a script) that will take an mkv generated from MakeMKV and remux all the video and audio tracks to an mp4 (without the subtitles) without doing any re-encoding. Theoretically, this should be a fairly simple command. When trying to do so, I consistently get an (possibly two?) error message/s:

Could not find tag for codec truehd in stream #2, codec not currently supported in container

Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Doing some research, I found some talk of using “-strict -2” as a parameter of the command, but that makes no difference. From what I can gather, as of Dec ’21, there is no software support in FFmpeg to put a TrueHD track into an MP4 container. That’s fine, I don’t really care about the TrueHD tracks.

What I don’t want to have to do is manually sift through each mkv to determine the index of each TrueHD track and then manually specify to the command. The purpose of the script is to batch convert mkv files to mp4 files using FFmpeg, so that would defeat the purpose of the whole endeavor.

I am looking for/hoping to do one of the following, any of which would solve my problem:

  1. Parameters in the FFmpeg command to exclude all TrueHD audio tracks from being sent to the output
  2. Parameters in the FFmpeg command to include all BUT TrueHD in the output (or include only codecs specified manually- mp3,aac,ac3,etc)
  3. Some way to include TrueHD tracks in an MP4 container, using FFmpeg
  4. Even another program that would cleanly deliver me the index numbers of any audio tracks that were TrueHD would work… I can then format that in the script and pass it on to FFmpeg. 1-3 would be preferred, but this could work too.

Here is the command I am working with as a base:

ffmpeg.exe -nostdin -i input.mkv -map 0:v -map 0:a -c:v copy -c:a copy output.mp4

Thanks for your help!