ffmpeg. Batch convert files in the folder

This script allows to convert selected by extension files to any other. For example in particular script selected wav files will be converted to mp3.

# Select all files with 'wav' extension
$ for i in *.wav;
    # Remove extension from a file name  
    do name=`echo "$i" | cut -d'.' -f1

    # ffmpeg task  
    ffmpeg -i "$i" "${name}.mp3"

# Finish 
done

It will works if modify and paste script to cli. But the better approach is to create file, make it executable and run.

# Create file and paste a modified script

# file name can be any
$ nano script.sh

# make file executable
$ chmod +x script.sh

# Run script
$ ./script.sh

All described here you do on your own risk and personal responsibility.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *