Skip to content [Tab]
~/posts/software/batch-convert-files-in.md
$ stat -x batch-convert-files-in.md POSIX filesystem
Access Mode: -rw-r--r-- (0644)
Author: uid:1000(@f7234bv9s8)
File Size: 1.2 KB (119 words)
Modified:
Flags: --cat="software" --tags="audio,ffmpeg,media,mp3,wav"

ffmpeg. Batch convert files in the folder

attachment://featured-image.webp

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.

@f7234bv9s8 maintainer

Software engineer and writer at notes:own:vision:com.