Last active
October 31, 2016 13:40
-
-
Save denisnazarov/9338340 to your computer and use it in GitHub Desktop.
FFMPEG batch convert to h264 mp4 and webm
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 | |
# Based on Batch Convert Script originally by Beterhans | |
# Put all video files need to be converted in a folder! | |
# the name of files must not have " " Space! | |
# Rename the File if contain space | |
# Target dir | |
indir=$1 | |
cd "$indir" | |
if mkdir -p output | |
then | |
echo "\nUsing $indir/output as Output Folder" | |
else | |
echo "\n\nErr: Check you have the rights to write in $indir ?" | |
exit | |
fi | |
for file in *.mov; | |
do | |
ffmpeg -y -i $file -c:v libx264 -pix_fmt yuv420p -vprofile high -preset slow -b:v 3000k -maxrate 3000k -bufsize 6000k -threads 0 -pass 1 -an -f mp4 /dev/null && \ | |
ffmpeg -i $file -c:v libx264 -pix_fmt yuv420p -vprofile high -preset slow -b:v 3000k -maxrate 3000k -bufsize 6000k -threads 0 -movflags faststart -pass 2 ./output/${file%.*}.mp4 | |
ffmpeg -i $file -c:v libvpx -b:v 1555k -c:a libvorbis ./output/${file%.*}.webm | |
done | |
echo ALL Processed! | |
################### | |
echo "DONE" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can specify resolution with
-s hd720
.