# the following should not be line wrapped
MP3S:=$(shell for n in *.ogg ; do echo $$n | sed -e s/^/mp3\\// -e s/ogg$$/
mp3/ ; done)

all: $(MP3S)

mp3/%.mp3: %.ogg
        avconv -i $< -map 0:a -c:a copy $@
        ffmpeg -i $< $(OPTS) $@


You could do that in a Makefile like the above, that means you can add new ogg 
files to your collection at any time and not have to regenerate everything.

On Sunday, 24 July 2022 17:18:42 AEST Andrew Greig via luv-main wrote:
> Hi,
> 
> I am trying to populate a drive with music and I have encountered some 
> folders of .ogg files and I wish to convert them to .mp3
> 
> I am following along with a description of the process found here 
> https://linuxconfig.org/how-to-batch-convert-music-files-with-ffmpeg
> 
> Does this look right, please?
> 
> #! bin/bash
> 
> #Script to convert a directory of .ogg files to .mp3 files
> 
> 
> #srcExt=$1   .ogg
> #destExt=$2  .mp3
> #
> #srcDir=$3   `/Music/
> #destDir=$4  `/Music/
> 
> #opts=$5
> 
> #for filename in "$srcDir"/*.$srcExt; do
> 
> #done
> 
> 
> #! /bin/bash
> 
> srcExt=$1
> destExt=$2
> 
> srcDir=$3
> destDir=$4
> 
> opts=$5
> 
> for filename in "$srcDir"/*.$srcExt; do
> 
>          basePath=${filename%.*}
>          baseName=${basePath##*/}
> 
>          ffmpeg -i "$filename" $opts "$destDir"/"$baseName"."$destExt"
> 
> done
> 
> echo "Conversion from ${srcExt} to ${destExt} complete!"
> 
> 
> Many thanks
> 
> Andrew
> 
> 
> _______________________________________________
> luv-main mailing list -- [email protected]
> To unsubscribe send an email to [email protected]


-- 
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/

_______________________________________________
luv-main mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to