Created
December 17, 2022 11:51
-
-
Save 2niuhe/2b5d68518992b13400e730c8b2c684a0 to your computer and use it in GitHub Desktop.
ffmpeg批量转换文件
This file contains hidden or 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 | |
srcExt=$1 | |
destExt=$2 | |
srcDir=$3 | |
destDir=$4 | |
opts=$5 | |
# sh ./ffmpeg_convert_file.sh mp4 mp3 ./ ./ "-f mp3" | |
for filename in "$srcDir"/*.$srcExt; do | |
basePath=${filename%.*} | |
baseName=${basePath##*/} | |
echo "Convert $filename ....\n" | |
ffmpeg -i "$filename" $opts "$destDir"/"$baseName"."$destExt" | |
done | |
echo "Conversion from ${srcExt} to ${destExt} complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment