Monday, 13 May 2024

Convert all mp4 files in a folder to mp3

Dependancies:
ffmpeg
for i in *.mp4; do ffmpeg -i "$i" "${i%.*}.mp3"; done
Change parameters or file extensions as you need on the go.

NOTE:
You can use the same for other conversions as well, like FLAC to MP3;
for file in *.flac; do ffmpeg -i "$file" -ab 320k -map_metadata 0 -id3v2_version 3 "${file%.flac}.mp3"; done

NOTE2:
"${i%.*}.mp3"
and
"${file%.flac}.mp3
do the same thing on bash

Tested on Ubuntu 22.04.4

No comments:

Post a Comment