I'm trying to adapt the wiki tutorial here for my need (batch convert flac to ogg) but I get either white space stripped out file names ... or new line in file names where white space were in input file name.
I tried basename with -a too, and/or -z (this last removes spaces)
The goal is to get
instead of01 - Neal And Jack And Me.ogg
01?-?Neal?And?Jack?And?Me.ogg #or
01 - Neal And Jack And Me.flac.ogg #or
01-NealAndJackAndMe.ogg
Code: Select all
#!/bin/bash
vcodec="VIDEO_CODEC"
#acodec="AUDIO_CODEC"
acodec="vorb"
bitrate="VIDEO_BITRATE"
#arate="AUDIO_BITRATE"
arate="320"
#ext="OUTPUT_EXT"
ext="ogg"
#mux="MUXER"
mux="ogg"
vlc="/usr/bin/vlc"
#fmt="INPUT_EXT"
fmt="flac"
for i in *$fmt; do
f="`basename -s .${fmt} ${i}`"
echo -e $f
#$vlc -I dummy -vvv "$i" --sout "#transcode{vcodec=$vcodec,vb=$bitrate,acodec=$acodec,ab=$arate,channels=6}:standard{mux=$mux,dst=\"$f.$ext\",access=file}" vlc://quit
$vlc -I dummy -vvv "$i" --sout "#transcode{vcodec=none,acodec=$acodec,ab=$arate,channels=2,samplerate=48000}:standard{mux=$mux,dst=\"$f.$ext\",access=file{no-overwrite}}" vlc://quit
#$vlc -I dummy -vvv "$i" --sout "#transcode{vcodec=none,acodec=$acodec,ab=$arate,channels=2,samplerate=48000}:standard{mux=$mux,dst=\"$f.$ext\",access=file}" vlc://quit
done