Do you need to work recursively through the directory? or just one layer?
Do you need to work recursively through the directory? or just one layer?
just one layer. keep it simple. But I'd like the output directory to be in the same folder as the .avi's
if
as posted above works to do the encoding changed to start with .avi instead of .mpg,Code:for i in `ls *.mpg`; do mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup \ -srate 48000 -af lavcresample=48000 \ -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect=16/9:\ acodec=ac3:abitrate=192:threads=4 -ofps 30000/1001 -o ${i} ${i%.mpg}.avi; done
then for what you want:
(not sure this is 100% correct, but you should be able to make a file allong these lines executable and run it in a directory to convert the files and move them.)Code:#! /bin/sh for i in `ls *.avi`; do mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup \ -srate 48000 -af lavcresample=48000 \ -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect=16/9:\ acodec=ac3:abitrate=192:threads=4 -ofps 30000/1001 -o ${i} ${i%}.mpg; done mkdir output mv *.mpg output
BINGO! Thank you very much Sir .
That is exactly what I wanted. I knew the script would be simple, I've just not had enough time to re-learn my bash scripting. Something I'll have to brush up on very soon.
in bash you could do something like:
Of course, you would need to strip the file extension off the file name, and maybe debug a bit, but it should work fine.Code:#!/usr/bin/env bash echo starting.... for f in ./*.avi; do mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup \ -srate 48000 -af lavcresample=48000 \ -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect=16/9:\ acodec=ac3:abitrate=192:threads=4 -ofps 30000/1001 -o $f.mpg $f.avi ; done; echo finished...
Ah, beaten to the punch!
hey these scripts work fine for file names without space !
but they dont work for file names with spaces,
for example
it wont work for "Scrubs S03E03 My White Whale [FuFu].avi"
is there any way to make it work for file names with space ?
the error message is
MEncoder 2:1.0~rc2-0ubuntu13+medibuntu1 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Duo CPU E8200 @ 2.66GHz (Family: 6, Model: 23, Stepping: 6)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
File not found: '[FuFu].avi'
Bookmarks