convert audio track scripts

main
Gabe Farrell 9 months ago
parent 3a223888ac
commit d291b2d718

@ -0,0 +1,23 @@
#!/bin/bash
# Check if the input file is provided
if [ -z "$1" ]; then
echo "Usage: $0 input.mkv"
exit 1
fi
INPUT_FILE="$1"
OUTPUT_FILE="${INPUT_FILE%.*}_ddp.mkv"
# Convert and retain all streams, adding a new DDP 5.1 audio track
ffmpeg -i "$INPUT_FILE" -map 0:v -map 0:a -map 0:a -map 0:s? -map 0:t? -c:v copy -c:a:0 copy -c:a:1 eac3 -b:a:1 768k -c:s copy "$OUTPUT_FILE"
# Check if ffmpeg was successful
if [ $? -eq 0 ]; then
mv "$OUTPUT_FILE" "$INPUT_FILE"
echo "Conversion successful. Original file replaced."
else
echo "Conversion failed. Original file unchanged."
exit 1
fi

@ -0,0 +1,23 @@
#!/bin/bash
# Check if the input file is provided
if [ -z "$1" ]; then
echo "Usage: $0 input.mkv"
exit 1
fi
INPUT_FILE="$1"
OUTPUT_FILE="${INPUT_FILE%.*}_dd2.0.mkv"
# Convert and retain all streams, adding a new DD 2.0 audio track
ffmpeg -i "$INPUT_FILE" -map 0:v -map 0:a -map 0:a -map 0:s? -c:v copy -c:a:0 copy -c:a:1 ac3 -b:a:1 320k -ac 2 -c:s copy "$OUTPUT_FILE"
# Check if ffmpeg was successful
if [ $? -eq 0 ]; then
mv "$OUTPUT_FILE" "$INPUT_FILE"
echo "Conversion successful. Original file replaced."
else
echo "Conversion failed. Original file unchanged."
exit 1
fi

@ -25,5 +25,11 @@ if [ $? -gt 1 ]; then
echo "Error processing mime-type: font/ttf for $MKV_FILE"
fi
mkvpropedit "$MKV_FILE" --attachment-mime-type "application/x-font-ttf" --update-attachment "mime-type:application/x-truetype-font"
if [ $? -gt 1 ]; then
echo "Error processing mime-type: application/x-truetype-font for $MKV_FILE"
fi
echo "Finished processing $MKV_FILE"

Loading…
Cancel
Save