Skip to content

Instantly share code, notes, and snippets.

@narenaryan
Created January 20, 2024 20:50
Show Gist options
  • Save narenaryan/6991c4dcf6bd7d2ceeed8c7f6db7742d to your computer and use it in GitHub Desktop.
Save narenaryan/6991c4dcf6bd7d2ceeed8c7f6db7742d to your computer and use it in GitHub Desktop.
Convert all .mkv files to .mp4 with best quality, less size using FFMpeg
#!/bin/bash
# Loop through each .mkv file in the current directory
for file in *.mkv; do
# Extract the filename without extension
filename=$(basename "$file" .mkv)
# Convert the .mkv file to .mp4 using FFMpeg
ffmpeg -i "$file" -vcodec libx264 -crf 27 -preset veryfast -c:a copy -s 960x540 "${filename}.mp4" &
done
# Wait for all the conversion processes to finish
wait
echo "Conversion complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment