知乎专栏 |
Converting video and audio has never been so easy.
$ ffmpeg -i input.mp4 output.avi
#!/bin/bash folder=/home/XXX for file in $(find "$folder" -type f -iname "*.mp3") do name=$(basename "$file" .mp3) dir=$(dirname "$file") echo ffmpeg -i "$file" -acodec pcm_s16le -ac 1 -ar 16000 "$dir"/"$name".wav ffmpeg -i "$file" -acodec pcm_s16le -ac 1 -ar 16000 "$dir"/"$name".wav done
#!/bin/bash folder=/home/XXX mkdir "$folder"/out for file in $(find "$folder" -type f -iname "*.pcm") do name=$(basename "$file" .pcm) dir=$(dirname "$file") echo ffmpeg -f s16le -ar 16000 -ac 1 -acodec pcm_s16le -i "$file" "$dir"/out/"$name".wav ffmpeg -f s16le -ar 16000 -ac 1 -acodec pcm_s16le -i "$file" "$dir"/out/"$name".wav done