JakeWharton / mkvdts2ac3

Bash script to convert DTS audio to AC3 within a matroska file.
Apache License 2.0
322 stars 60 forks source link

Faulty ERROR: There are no DTS tracks #106

Closed ghost closed 8 years ago

ghost commented 8 years ago

When running this script on an MKV file that contains a DTS track, mkvdts2ac3.sh incorrectly says ERROR: There are no DTS tracks:

$ mkvinfo video.mkv | grep DTS | + Codec ID: A_DTS

$ mkvdts2ac3.sh video.mkv mkvdts2ac3-1.6.0 - by Jake Wharton jakewharton@gmail.com and Chris Hoekstra chris.hoekstra@gmail.com

ERROR: There are no DTS tracks in 'video.mkv'.

I believe this is either an error or the wrong message.

choekstr commented 8 years ago

Can you provide the output of: mkvmerge -i video.mkv

The logic uses that output and greps for "audio (DTS)". If it doesn't see that then it would think it isn't an included track. It should look something like this: Track ID 0: video (MPEG-4p10/AVC/h.264) Track ID 1: audio (DTS) Global tags: 1 entry Tags for track ID 1: 1 entry

ghost commented 8 years ago

Almost:

$ mkvmerge -i video.mkv Bestand 'video.mkv': houder: Matroska Spoor ID 0: video (MPEG-4p10/AVC/h.264) Spoor ID 1: audio (DTS) Chapters: 9 entries

Can I do more research on the file for you?

choekstr commented 8 years ago

Hmm, it should match and return "1" given that output. One other thing it could be is the version check. Can you do: mkvmerge -V

ghost commented 8 years ago

$ mkvmerge -V mkvmerge v8.6.1 ('Flying') 32bit

choekstr commented 8 years ago

I am at a loss as your mkvmerge version should be detecting just fine and the DTS track detection should be properly pulling out ID 1. Can you run the script with a --debug and provide the output? I know it will be quite a lot of text but I can't see a reason why it isn't detecting the DTS track.

ghost commented 8 years ago

$ mkvdts2ac3.sh --debug video.mkv mkvdts2ac3-1.6.0 - by Jake Wharton jakewharton@gmail.com and Chris Hoekstra chris.hoekstra@gmail.com

MKV FILE: video.mkv DTS FILE: /tmp/video.dts AC3 FILE: /tmp/video.ac3 TIMECODE: /tmp/video.tc NEW FILE: /tmp/video.new.mkv WORKING DIRECTORY: /tmp

Find first DTS track in MKV file.

mkvmerge -i "video.mkv" | grep -m 1 "audio (A_DTS)" | cut -d : -f 1 | cut -d " " -f 3

ERROR: There are no DTS tracks in 'video.mkv'.

Looks like it makes sense, if it greps "A_DTS" while the track is "DTS"

choekstr commented 8 years ago

That's exactly it. It does a version check of mkvmerge as the older versions returned A and the newer versions don't. For some reason it is detecting your version as the old one and adding in a A to the grep. A quick and dirty fix is to just remove the A_ from line 362.

Change: AUDIOTRACKPREFIX="audio (A_" to be: AUDIOTRACKPREFIX="audio ("

ghost commented 8 years ago

Yes, thanks, that works!