[BASH] simple script to convert bluray BDMV M2TS file to MKV
Posted: September 3rd, 2013, 8:45 am
Hi,
i'have addapted a script found on this forum to convert the biggest M2TS file found in /BDMV/STREAM/ folder of Blu-Ray in MKV, no compression, everything inclued:
edit: bug correction.
Hope that it will be usefull to someone.
Regards.
i'have addapted a script found on this forum to convert the biggest M2TS file found in /BDMV/STREAM/ folder of Blu-Ray in MKV, no compression, everything inclued:
Code: Select all
#!/bin/bash
BDMV_FOLD=`find "$1" -name "BDMV" -print0`
if [[ $BDMV_FOLD == *BDMV* ]]; then
# cd to the ./BDMV/STREAM sub folder
cd "$BDMV_FOLD/STREAM/"
# Find the biggest .M2TS file, usually the movie
BIGST_M2TS=`find . -type f | xargs ls -1S | head -n 1 | rev | cut -c 6- | rev`
# MkvMerge the file
mkvmerge -o "$BIGST_M2TS".mkv --compression -1:none "$BIGST_M2TS".m2ts
# Change MKV permission to -rw-r--r-- and move file out of STREAM folder
chmod 644 "$BIGST_M2TS".mkv
mv "$BIGST_M2TS".mkv "$1"
echo "MKV created! ("$1")"
else
echo "BDMV2Mkv: no processing"
fi
Hope that it will be usefull to someone.
Regards.