I used the Win7 powershell to make a batch file (ps1) that converted my avi files from the DV camera directly to DVD compatible mpg files. It takes as many avi files as is in one folder and produces an mpg for each avi. Save the quote below into a ps1 file.
The default.ini file used has these contents:cd e:\Shared
$files=get-childitem ./DV *.avi
foreach($file in $files) {
write-host File name: $file
# file name
$name = $file.tostring().trimend(".avi")
write-host Movie name: $name
# construct avs file
"AVISource(`"E:\Shared\DV\$name.avi`")" | Out-File -Encoding ASCII avs/$name.avs
# construct ini file for hc
Get-Content default/default.ini |
ForEach-Object { $_ -replace "__INFILE__", "E:\Shared\avs\$name.avs" } |
ForEach-Object { $_ -replace "__OUTFILE__", "E:\Shared\OUTPUT\$name.m2v" } |
ForEach-Object { $_ -replace "__LOGFILE__", "E:\Shared\OUTPUT\log\$name.log" } |
Set-Content hcini/$name.ini -encoding ASCII
# hc encode files
write-host Encoding video...
$prog = "E:\MyProgs\HC025\HCenc_025.exe"
$args = "-ini E:\Shared\hcini\$name.ini"
start-process $prog -ArgumentList $args -wait
# extract wave audio from avi files
write-host Extracting wave audio...
$prog = "e:\myprogs\wavi106\wavi.exe"
$args = "e:\shared\avs\$name.avs e:\shared\wav\$name.wav"
start-process $prog -ArgumentList $args -wait
# convert wav to ac3 with 48 kHz SR for DVD compatibility
write-host Encoding ac3 audio...
$prog = "E:\myprogs\ffmpeggui03c\ffmpeggui03c\ffmpeg.exe"
$args = "-i e:\shared\wav\$name.wav -acodec ac3 -ac 2 -ar 48000 -ab 192k e:\shared\aac\$name.ac3"
start-process $prog -ArgumentList $args -wait
# multiplex m2v and ac3 to mpg
write-host Muxing video and audio...
$prog = "e:\myprogs\mplex.exe"
$args = "-f 8 -b 224 -o E:\shared\output\$name.mpg E:\shared\output\$name.m2v E:\shared\aac\$name.ac3"
start-process $prog -ArgumentList $args -wait
}
All the folders used must be created before the script is executed. The programs used are hcenc, wavi, ffmpeg and mplex (windows compilation).*INFILE __INFILE__
*OUTFILE __OUTFILE__
*LOGFILE __LOGFILE__
*MAXBITRATE 9500
*PROFILE best
*ASPECT 4:3
*AUTOGOP 15
*CQ_MAXBITRATE 5.000
*DC_PREC 10
*DVSOURCE
*NOSCD
*CLOSEDGOPS
*INTRAVLC 2
*MATRIX mpeg
*LUMGAIN 1
*PRIORITY normal
*WAIT 0
+ Reply to Thread
Results 1 to 6 of 6
-
Last edited by findus; 19th Dec 2011 at 16:56. Reason: Changed to ac3 encoding in one lossy step with ffmpeg.
-
Thanks for sharing interesting stuff.
# convert wav to aac
$name32 = [string]::join("", ($name, "_32"))
$prog = "E:\MyProgs\NeroAACCodec-1.5.1\win32\neroaacenc.exe"
$args = "-if e:\shared\wav\$name.wav -of e:\shared\aac\$name32.aac"
start-process $prog -ArgumentList $args -wait
coz
i c no reason for wav --> aac -->ac3, i wud rather prefer wav --> ac3.
# resample aac audio to 44.1 kHz to enable mpg compability
$prog = "E:\myprogs\ffmpeggui03c\ffmpeggui03c\ffmpeg.exe"
$args = "-i e:\shared\aac\$name32.aac -acodec ac3 -ac 2 -ar 44100 -ab 192k e:\shared\aac\$name.ac3"
start-process $prog -ArgumentList $args -wait
$args = "-i e:\shared\aac\$name32.aac -acodec ac3 -ac 2 -ar 48000 -ab 448k e:\shared\aac\$name.ac3" -
Thanks for the feedback.
If the wav --> ac3 step can be made in one step it would be better, I just found the tools to do these steps and it worked. Does neroaacenc or ffmpeg do the one step conversion? The arguments used would be appreciated in that case.
You are right about the 48 kHz sample rate for DVD compatibility. I am not sure about the bit rate though. This guide uses 192 kbps for example. -
Thanks for the feedback.
If the wav --> ac3 step can be made in one step it would be better, I just found the tools to do these steps and it worked. Does neroaacenc or ffmpeg do the one step conversion? The arguments used would be appreciated in that case.
here you have two options...
1) use SSRC (resample to 48KHz) + Aften (AC-3 Encoder, read help documentation for cli-parameters) - aften produces better qua;ity ac-3 from wav.
2) use ffmpeg directly on wav like...
$args = "-if e:\shared\wav\$name.wav -acodec ac3 -ac 2 -ar 48000 -ab 448k e:\shared\aac\$name.ac3"
last time, it was a long long ago, ffmpeg - ac-3 conversion was bit buggy, may be solved in recent release.
You are right about the 48 kHz sample rate for DVD compatibility. I am not sure about the bit rate though. This guide uses 192 kbps for example.
# multiplex m2v and ac3 to mpg
$prog = "e:\myprogs\mplex.exe"
$args = "-f 3 -o E:\shared\output\$name.mpg E:\shared\output\$name.m2v E:\shared\aac\$name.ac3"
start-process $prog -ArgumentList $args -wait
}
for DVD compatibility
$args = "-f 8 -b 224k -o E:\shared\output\$name.mpg E:\shared\output\$name.m2v E:\shared\aac\$name.ac3"
i mean -f 8 instead of -f 3, plus video buffer -b|--video-buffer at-least 224k.
Regarding HCEnc, default INI
try *DC_PREC 9 as well instead of *DC_PREC 10, visualize on HD-TV by yourself coz u cud be the best judge than my-self.
it could be my visual illusion that *DC_PREC 9 look better than *DC_PREC 10 while playing DVD on stand-alone HD-TV.
keep up good-works!
Good Luck!
Last edited by Bonie81; 19th Dec 2011 at 16:06.
-
no problemo!
also update mplex commandlines to make it perfect as under:
$args = "-f 8 -b 224k -o E:\shared\output\$name.mpg E:\shared\output\$name.m2v E:\shared\aac\$name.ac3"
so final.mpg can be taken directly to DVDAuthoring S/Ws,
Pls also provide a list of the tools used like HcEnc, FFmpeg, wavi and mplex with a linked back to VideoHelp tools downloads section on the top, with a hope and earnest request to VideoHelp Moderators to include or add wavi.exe and mplex.exe in misc. tools section very shortly.. I can also appreciate if you thank the authors of these tools - HcEnc, FFmpeg, wavi and mplex for their efforts and time developing such nice tools, at the botton-end.
anyway it is very useful guide, i wud like to thank you for posting as it's your first post in VideoHelp.
see ya around here on VideoHelp with more guides.
u r wel-come @ VideoHelp
Last edited by Bonie81; 19th Dec 2011 at 20:19.
Similar Threads
-
Best way to batch convert xvid/avi files to mkv/x264 files?
By gaikokujinkyofusho in forum Video ConversionReplies: 1Last Post: 13th Jan 2012, 06:31 -
How do I burn DVD ready .mpg files as a video DVD?
By sasuweh in forum Authoring (DVD)Replies: 3Last Post: 29th Nov 2011, 15:47 -
How to Convert DVD files to .mpg/.wmv/avi for editing in Win Movie Maker
By Injasuti in forum Newbie / General discussionsReplies: 4Last Post: 8th May 2011, 03:47 -
Looking to convert scr files (screensaver slideshows) to avi or mpg format
By wiltonp in forum Video ConversionReplies: 1Last Post: 23rd Jun 2008, 17:28 -
Is it doable to convert HDV/.m2t 1080i files to AVI files and what...
By Canon GL-2 Guy in forum Newbie / General discussionsReplies: 4Last Post: 30th Sep 2007, 04:03