Last active
May 23, 2022 20:01
-
-
Save manero6/05d6e5a4c0f9b92e70d5f0399795d359 to your computer and use it in GitHub Desktop.
Re-encode videos to x265 with 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
if [ $# -ne 0 ] | |
then | |
for VIDEO in "$@" | |
do | |
VIDEO_NAME=$(echo "$VIDEO" | cut -d. -f1) | |
VIDEO_x265="$VIDEO_NAME".x265.mp4 | |
ffmpeg -i "$VIDEO" -c:v libx265 "$VIDEO_x265" \ | |
&& RESULT="$RESULT$(\ | |
echo "Successfully converted -> $VIDEO_NAME" && \ | |
echo " original: %2s $(ls -lh "$VIDEO" | cut -d' ' -f5)" && \ | |
echo " converted: %1s $(ls -lh "$VIDEO_x265" | cut -d' ' -f5)\n")" \ | |
|| RESULT="$RESULT$(\ | |
echo "Failed to convert -> $VIDEO_NAME\n")" | |
done | |
printf "\n$RESULT\n" | |
else | |
echo "Please provide at least one video file" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment