Created
January 24, 2018 14:17
-
-
Save japicoder/79d413e9cc0483b5a0e0eaa6d2c7cee3 to your computer and use it in GitHub Desktop.
Convert all the MP4 mobile video of a folder to HEVC/M4V using ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIR=`dirname $(readlink -f $0)` | |
HEVC_ACTIVE=1 | |
for FILE in *.mp4; do | |
[ -f "$FILE" ] || break; | |
FILENAME=`basename $FILE .mp4` | |
if [[ $HEVC_ACTIVE = 1 ]]; then | |
DESTINATION="$FILENAME.mkv" | |
FFMPEG_PARAMS="-c:v libx265 -preset ultrafast -x265-params crf=23 -c:a copy" | |
else | |
DESTINATION="$FILENAME.m4v" | |
FFMPEG_PARAMS="-acodec copy -vcodec libx264" | |
fi | |
echo "Processing $FILE to $DESTINATION..." | |
ffmpeg -i $FILE $FFMPEG_PARAMS $DESTINATION -y | |
done | |
echo "Done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment