{ "name": "Mkvdts2ac3", "description": "Convert DTS audio to AC3 within a matroska file", "url": "https://github.com/JakeWharton/mkvdts2ac3/archive/1.6.0.tar.gz", "mirror": null, "homepage": "https://github.com/JakeWharton/mkvdts2ac3", "depends": [ { "depend": "ffmpeg", "build-depend": false }, { "depend": "mkvtoolnix", "build-depend": false } ], "resource": [], "conflicts": [], "patches": [ { "url": null, "data": [ "diff --git a/mkvdts2ac3.sh b/mkvdts2ac3.sh\n", "index 270f768..156d60d 100755\n", "--- a/mkvdts2ac3.sh\n", "+++ b/mkvdts2ac3.sh\n", "@@ -355,8 +355,18 @@ if [ $EXECUTE = 1 ]; then\n", " \tcheckdep perl\n", " fi\n", " \n", "+# Make some adjustments based on the version of mkvtoolnix\n", "+MKVTOOLNIXVERSION=$(mkvmerge -V | cut -d \" \" -f 2 | sed s/\\[\\^0-9\\]//g)\n", "+if [ ${MKVTOOLNIXVERSION} -lt 670 ]; then\n", "+\tAUDIOTRACKPREFIX=\"audio (A_\"\n", "+\tVIDEOTRACKPREFIX=\"video (V_\"\n", "+else\n", "+\tAUDIOTRACKPREFIX=\"audio (\"\n", "+\tVIDEOTRACKPREFIX=\"video (\"\n", "+fi\n", "+\n", " # Added check to see if AC3 track exists. If so, no need to continue\n", "-if [ \"$(mkvmerge -i \"$MKVFILE\" | grep -i \"A_AC3\")\" ]; then\n", "+if [ \"$(mkvmerge -i \"$MKVFILE\" | grep -i \"${AUDIOTRACKPREFIX}AC3\")\" ]; then\n", " \techo $\"AC3 track already exists in '$MKVFILE'.\"\n", " \tif [ $FORCE = 0 ]; then\n", " \t\techo $\"Use -f or --force argument to bypass this check.\"\n", "@@ -389,11 +399,11 @@ doprint $\"WORKING DIRECTORY: $WD\"\n", " if [ -z $DTSTRACK ]; then\n", " \tdoprint \"\"\n", " \tdoprint $\"Find first DTS track in MKV file.\"\n", "-\tdoprint \"> mkvmerge -i \\\"$MKVFILE\\\" | grep -m 1 \\\"audio (A_DTS)\\\" | cut -d \":\" -f 1 | cut -d \\\" \\\" -f 3\"\n", "+\tdoprint \"> mkvmerge -i \\\"$MKVFILE\\\" | grep -m 1 \\\"${AUDIOTRACKPREFIX}DTS)\\\" | cut -d \":\" -f 1 | cut -d \\\" \\\" -f 3\"\n", " \tDTSTRACK=\"DTSTRACK\" #Value for debugging\n", " \tdopause\n", " \tif [ $EXECUTE = 1 ]; then\n", "-\t\tDTSTRACK=$(mkvmerge -i \"$MKVFILE\" | grep -m 1 \"audio (A_DTS)\" | cut -d \":\" -f 1 | cut -d \" \" -f 3)\n", "+\t\tDTSTRACK=$(mkvmerge -i \"$MKVFILE\" | grep -m 1 \"${AUDIOTRACKPREFIX}DTS)\" | cut -d \":\" -f 1 | cut -d \" \" -f 3)\n", " \n", " \t\t# Check to make sure there is a DTS track in the MVK\n", " \t\tif [ -z $DTSTRACK ]; then\n", "@@ -405,10 +415,10 @@ if [ -z $DTSTRACK ]; then\n", " else\n", " \t# Checks to make sure the command line argument track id is valid\n", " \tdoprint $\"Checking to see if DTS track specified via arguments is valid.\"\n", "-\tdoprint \"> mkvmerge -i \\\"$MKVFILE\\\" | grep \\\"Track ID $DTSTRACK: audio (A_DTS)\\\"\"\n", "+\tdoprint \"> mkvmerge -i \\\"$MKVFILE\\\" | grep \\\"Track ID $DTSTRACK: ${AUDIOTRACKPREFIX}DTS)\\\"\"\n", " \tdopause\n", " \tif [ $EXECUTE = 1 ]; then\n", "-\t\tVALID=$(mkvmerge -i \"$MKVFILE\" | grep \"Track ID $DTSTRACK: audio (A_DTS)\")\n", "+\t\tVALID=$(mkvmerge -i \"$MKVFILE\" | grep \"Track ID $DTSTRACK: ${AUDIOTRACKPREFIX}DTS)\")\n", " \n", " \t\tif [ -z \"$VALID\" ]; then\n", " \t\t\terror $\"Track ID '$DTSTRACK' is not a DTS track and/or does not exist.\"\n", "@@ -555,14 +565,14 @@ else\n", " \t# If user doesn't want the original DTS track drop it\n", " \tif [ $NODTS ]; then\n", " \t\t# Count the number of audio tracks in the file\n", "-\t\tAUDIOTRACKS=$(mkvmerge -i \"$MKVFILE\" | grep \"audio (A_\" | wc -l)\n", "+\t\tAUDIOTRACKS=$(mkvmerge -i \"$MKVFILE\" | grep \"$AUDIOTRACKPREFIX\" | wc -l)\n", " \n", " \t\tif [ $AUDIOTRACKS -eq 1 ]; then\n", " \t\t\t# If there is only the DTS audio track then drop all audio tracks\n", " \t\t\tCMD=\"$CMD -A\"\n", " \t\telse\n", " \t\t\t# Get a list of all the other audio tracks\n", "-\t\t\tSAVETRACKS=$(mkvmerge -i \"$MKVFILE\" | grep \"audio (A_\" | cut -d \":\" -f 1 | grep -vx \"Track ID $DTSTRACK\" | cut -d \" \" -f 3 | awk '{ if (T == \"\") T=$1; else T=T\",\"$1 } END { print T }')\n", "+\t\t\tSAVETRACKS=$(mkvmerge -i \"$MKVFILE\" | grep \"$AUDIOTRACKPREFIX\" | cut -d \":\" -f 1 | grep -vx \"Track ID $DTSTRACK\" | cut -d \" \" -f 3 | awk '{ if (T == \"\") T=$1; else T=T\",\"$1 } END { print T }')\n", " \t\t\t# And copy only those\n", " \t\t\tCMD=\"$CMD -a \\\"$SAVETRACKS\\\"\"\n", " \n", "@@ -576,7 +586,7 @@ else\n", " \tfi\n", " \n", " \t# Get track ID of video track\n", "-\tVIDEOTRACK=$(mkvmerge -i \"$MKVFILE\" | grep -m 1 \"video (V_\" | cut -d \":\" -f 1 | cut -d \" \" -f 3)\n", "+\tVIDEOTRACK=$(mkvmerge -i \"$MKVFILE\" | grep -m 1 \"$VIDEOTRACKPREFIX\" | cut -d \":\" -f 1 | cut -d \" \" -f 3)\n", " \t# Add original MKV file, set header compression scheme\n", " \tCMD=\"$CMD --compression $VIDEOTRACK:$COMP \\\"$MKVFILE\\\"\"\n", " \n" ] } ], "install": [ "bin.install \"mkvdts2ac3.sh\" => \"mkvdts2ac3\"" ], "version": "1.6.0", "file": "mkvdts2ac3.rb" }