Skip to content

Instantly share code, notes, and snippets.

@silvein
Created December 23, 2010 00:27
Show Gist options
  • Save silvein/752363 to your computer and use it in GitHub Desktop.
Save silvein/752363 to your computer and use it in GitHub Desktop.
A bash function (I keep it in my .bash_profile) for remuxing mkv files to mp4
function mkv2mp4 {
INPUT_FILE="$1"
OUTPUT_FILE="${INPUT_FILE%.*}.mp4"
if [[ "" == "${INPUT_FILE}" ]]; then echo "Usage: mkv2mp4 <file.mkv>" && return 1; fi
if [[ ! -f "${INPUT_FILE}" ]]; then echo "Argument not a file." && return 1; fi
if [[ -f "${OUTPUT_FILE}" ]]; then echo "Output file '$OUTPUT_FILE' already exists." && return 1; fi
ffmpeg -vcodec copy -acodec copy -map_meta_data outfile:infile -i "${INPUT_FILE}" "${OUTPUT_FILE}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment