You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
scripts/downmix_only_audio_dd2.0_32...

24 lines
604 B

#!/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