Skip to content

Instantly share code, notes, and snippets.

@leganz
Last active September 4, 2020 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leganz/235b687249536afc35cef2b80d89d281 to your computer and use it in GitHub Desktop.
Save leganz/235b687249536afc35cef2b80d89d281 to your computer and use it in GitHub Desktop.
Convert m2t files in a folder to mp4
#!/bin/bash
SEARCH_DIR=$1;
echo "start converting all m2t video files in ${SEARCH_DIR}"
for entry in "$SEARCH_DIR"/*
do
if [[ ${entry: -4} == ".M2T" ]]
then
echo "start converting: ${entry}"
filename="${entry%.*}"
if [[ ! -e ${filename}.mp4 ]]; then
ffmpeg -i $entry -vcodec libx264 -crf 20 -acodec ac3 -vf "yadif" ${filename}.mp4
fi
fi
done
echo "finished converting m2t files..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment