0

I want an avconv script which automatically scans some of my directories and then checks for .avi files and then converts them to .mp4 and then deletes the .avi files when finished.

I am not a bash programmer so I don't know how bash operates so I can't give an example because I don't know if that's what I need.

audittxl
  • 1
  • 4

1 Answers1

1

Just add these 2 scripts to a directory you want to be convert your avi files (./convdir). Run ./convdir/batchavi2mp4 and your done. Example:

  • /convdir
    • batchavi2mp3
    • avi2mp3
    • mp3file1
    • mp3file2
    • mp3file3
    • mp3file4
    • mp3filex
    • avifile1
    • avifile2
    • avifile3
    • avifile4
    • avifilex

batchavi2mp3

for i in *.avi; do
   avi2mp3 "${i}"
done

avi2mp3

fin="$1"
fout=$fin
fout=${fout%".avi"} 
fname=$fout
fout="$fout.mp3"
echo;
echo Converting $fname .... 
echo _Input: $fin
echo Output: $fout
echo;   
#ffmpeg -i "$fin" -acodec libmp3lame -ac 2 -ab 128k -vn -y "$fout"
avconv -i "$fin" -vn -f mp3 "$fout"
echo;
echo -------------------
echo;

You can get fancy like I have and move the files out from here to like /videos /music and set a cron job script to run. I still working with avconv. Some devices are not liking avconv (ffmpg was working so long .... sigh)

Seth
  • 58,122