Skip to content

Instantly share code, notes, and snippets.

@talmobi
Created September 7, 2017 19:00
Show Gist options
  • Save talmobi/f36bc4fa12303c4244435ea45fb67cc0 to your computer and use it in GitHub Desktop.
Save talmobi/f36bc4fa12303c4244435ea45fb67cc0 to your computer and use it in GitHub Desktop.
bash script to convert avi to mp4 with ffmpeg
#!/bin/bash
# Usage: ./convert.sh file
for arg; do
echo ""
echo "arg: $arg"
inputFile=$arg
outputFile="$inputFile.output.mp4"
echo ""
echo "converting $inputFile"
echo ""
echo "to $outputFile ..."
echo ""
# echo "input: $inputFile, output: $outputFile"
/c/Users/Ada/Downloads/ffmpeg/bin/ffmpeg.exe -i $inputFile -c:v libx264 -crf 19 -preset slow -c:a aac -b:a 192k -ac 2 $outputFile
if [ $? -eq 0 ]; then
echo ""
echo "conversion completed [$inputFile] -> [$outputFile]"
else
echo ""
echo "conversion failed"
fi
sleep 2
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment