VideoHelp Forum
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. Hello,

    My issue is similar to knightplex's thread here, in that I would like to convert DTS to AAC. However, I wasn't able to find a solution specific to my needs when using MKV files so I didn't want to hijack his thread with my question.

    Most of my files contain DTS-HD which I've come to realize is total overkill for my setup. Also I'm running out of space and can't add any more hard drives since I'm out of SATA ports. So basically what I hope to achieve is to batch convert the audio throughout my entire video library and remux the MKVs in the process. Not sure if this is possible in ffmpeg or if there would be a better tool to use, but ideally it would go something like this:

    Code:
    take input mkv > convert dts-hd track to aac > remux video and subs (if any) from input mkv with new aac track
    Even if I have to use a combination of ffmpeg and mkvmerge that would be fine, whatever gets the job done. If possible it would be great to not have to demux the DTS-HD audio files first as that will just add an extra step.
    Quote Quote  
  2. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Windows command line:

    Code:
    for %F in (*.mkv) do ffmpeg -i %F -map 0 -acodec aac -b:a 160k [or whatever bitrate you want] -vcodec copy -scodec copy %~nF_new.mkv
    Best to specify a path on a different drive for the new files. Put it just ahead of the percent sign.
    Quote Quote  
  3. Thanks for the quick reply. A couple follow up questions.

    1. Do I need a special version of ffmpeg to decode the DTS-HD and encode the AAC?

    2. For MKV files with multiple audio tracks, is there any way to detect which tracks are the DTS-HD ones and only convert those? So say in File "A" it has a DTS-HD track and an AC3 track and then in File "B" there are two DTS-HD tracks and one AC3 track. Is it possible to only convert the DTS-HD tracks and leave the AC3 as is without manually intervening?
    Quote Quote  
  4. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    1. The latest Windows build at Zeranoe decodes DTS-HD.

    2. FFmpeg maps only on stream type and index, not codec, so you would have to use FFprobe -show_streams to report stats to a file, then parse it to discover which audio streams are DTS-HD, then set appropriate map indices in the call to FFmpeg. This is doable in a batch file.
    Quote Quote  
  5. Thanks, I'll look into FFprobe.
    Quote Quote  
  6. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Something like (untested):

    Code:
    setlocal enabledelayedexpansion
    For %%F in (*.mkv) do (
      FFprobe -v quiet -show_streams %%F > streams.txt
      for /f "tokens=* delims==" %%G in (streams.txt) do (
        if %%G==index set cur_index=%%H
        if %%G==codec_name (
          if %%H==dtshd (
            set recode_list=!recode_list! -c:0:!cur_index! aac
          ) else (
            set copy_list=!copy_list! -c:0:!cur_index! copy
          )
        )
      )
      FFmpeg -i %%F -map 0 !recode_list! !copy_list! -b:a 160k "newdrive:\path\%%F"
      set recode_list=
      set copy_list=
    )
    Last edited by JVRaines; 18th Nov 2016 at 13:27.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!