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
    You might want to edit ffmpeg to avconv. There was some divergence in that recently and Debian, therefore Ubuntu, chose avconv over ffmpeg. – RobotHumans Jul 12 '13 at 14:27
  • Or you can use an up-to-date real ffmpeg by simply downloading a [ffmpeg Linux build](http://askubuntu.com/a/270107/59378) or by [compiling ffmpeg](http://trac.ffmpeg.org/wiki/UbuntuCompilationGuide). – llogan Jul 12 '13 at 20:02

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
  • 57,282
  • 43
  • 144
  • 200