Skip to content

Instantly share code, notes, and snippets.

@mrsarm
Created March 12, 2023 14:08
Show Gist options
  • Save mrsarm/fcf772fa33209d247e98beb487e121cd to your computer and use it in GitHub Desktop.
Save mrsarm/fcf772fa33209d247e98beb487e121cd to your computer and use it in GitHub Desktop.
Convert what ever video file to a compatible MP4 file that works on most devices.
#!/usr/bin/env bash
if [ "$1" == "-h" -o "$1" == "--help" -o "$#" == "0" ]
then
echo "Convert what ever video file to a compatible MP4 file"
echo "that works on most devices."
echo
echo "Usage: video2mp4.sh [FILE]"
exit
fi
FILE="$1"
ffmpeg -i "${FILE}" \
-c:v libx264 \
-crf 24 \
-pix_fmt yuv420p \
-tune film \
-c:a aac \
-b:a 128k \
-ar 44100 \
-vol 300 \
-strict -2 \
-speed fastest \
"${FILE%.*}-converted.mp4"
@mrsarm
Copy link
Author

mrsarm commented Mar 12, 2023

Another option is just use VLC > "Media" menu > "Convert / Save...".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment