Skip to content

Instantly share code, notes, and snippets.

@Kichrum
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kichrum/70b630407374494afa38 to your computer and use it in GitHub Desktop.
Save Kichrum/70b630407374494afa38 to your computer and use it in GitHub Desktop.
Convert video files to mp4, webm, flv and png formats
#!/bin/bash
#author : Kichrum
files=$(ls *.avi);
outputFolder="output/"
for file in $files
do
outputFile=${file//.avi/};
printf "\n\n === Converting $file => $outputFile.mp4 === \n";
`ffmpeg -i "$file" -y -b:a 128k -vcodec libx264 -b:v 1200k -flags +aic+mv4 "$outputFolder$outputFile.mp4"`
printf "\n\n === Converting $file => $outputFile.webm === \n";
`ffmpeg -i "$file" -y -vcodec libvpx -b:v 1200k -qmin 10 -qmax 20 "$outputFolder$outputFile.webm"`
printf "\n\n === Converting $file => $outputFile.flv === \n";
`ffmpeg -i "$file" -y -b:v 1200k -qmin 1 -qmax 5 -ar 44100 "$outputFolder$outputFile.flv"`
printf "\n\n === Creating picture for $file => $outputFile.jpg === \n";
`ffmpeg -i "$file" -y -vframes 1 -ss 00:00:01 -f image2 "$outputFolder$outputFile.jpg"`
done;
echo ' === All Done === ';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment