View Single Post
Old 15th December 2012, 16:51   #2190  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
Forewarning: This might be a lot to try and digest all at once, so don't rush.


You can use HCenc for MPEG-2, and ffmpeg for AC3. AVStoDVD uses both, but the programs can be used on their own (and minimizing an encoding program won't stop it unless the program's process is actually killed by clicking Close or exiting the program). The easiest way is to have it set up as a batch script, where you control the encoding programs through the command line, which will also exit the programs after everything is finished. You can then fetch the encodes when the computer is available again.

HCenc is controlled via an .ini file that contains the settings you want to use. You can experiment with the GUI that comes with the official HCenc 0.26 package (here), which will write the .ini file for you. Once you have it set up in a way that is satisfactory (it may mean playing with the bitrate values so that you can make sure a certain number of episodes fit on a single disc), you can take that .ini file, and use it as input to the command-line version (you need to delete the INPUTFILE and OUTPUTFILE settings in the .ini file, and just specify where to find the right episodes when you call the CLI). Also worth noting that HCenc takes input in the form of AviSynth scripts. I'll give a better example below.

For instance, you might have the following .ini file (let's name it encode.ini):
Code:
*BITRATE          5000
*MAXBITRATE          5000
*1PASS
*PROFILE          best
*ASPECT          4:3
*GOP              12 2
*DC_PREC          9
*PROGRESSIVE
*INTRAVLC          2
*CLOSEDGOPS
*LASTIFRAME
*MPEGLEVEL        MP@ML
*MATRIX           mpeg
*WAIT             0
The *PROFILE and *DC_PREC settings affect performance. If you delete the '*PROFILE' line, HCenc uses the 'normal' setting, or you can change 'best' to 'fast'. *DC_PREC can be lowered to 8. Lowering them speeds up encoding, at the expense of quality.

You would then have an AviSynth script like this, let's name it episode1.avs (the " are necessary, but change the script name and .avi filename as appropriate):
Code:
AVISource("episode1.avi").BilinearResize(720,480).ChangeFPS(29.97).SSRC(48000)
The BilinearResize, ChangeFPS, and SSRC filters are just to make sure that everything matches DVD specifications. If the files are already at the right specs, those filters aren't necessary. 29.97 is assumed for the FPS because these are television episodes from before the advent of HDTV (I'm also assuming NTSC specifications - which covers North America and Japan - rather than PAL).

Then you can use HCenc's command line version directly (make sure encode.ini is in the same folder as the AviSynth script(s), it'll make it easier):
Code:
hcenc_026 -i episode1.avs -o episode1.m2v -ini encode.ini
Chances are, you'll want to make sure Windows can see HCenc from whatever folder you happen to be in. To do this, download Path Editor and tell it to add the 'HCenc' and 'FFmpeg' folders that live inside AVStoDVD's installation folder, and then click 'Save to Registry'. From that point forward, you can open up a Command Prompt anywhere and use either program by just using the program's name. You'll also want to get mplex, which is in the MJPEGTools package (download here). Unpack it with WinRAR or 7zip, and put mplex.exe (from the bin folder) in the same folder as HCenc. Or just throw it into C:\Windows and forget about it.

Finally, batch scripts will tie all of this together so that you don't have to do each step manually. It's completely automatic, so after each task is done it moves onto the next. You open up notepad and use the same command that you would use on the command line if you were doing it manually, each one on a new line. You can even tell the batch script to generate the AviSynth scripts.
Code:
echo AVISource("episode1.avi").BilinearResize(720,480).ChangeFPS(29.97).SSRC(48000)>episode1.avs
ffmpeg -i episode1.avs -vn -acodec ac3 -ab 192k episode1.ac3
hcenc_026 -i episode1.avs -o episode1.m2v -ini encode.ini
mplex -f8 -V episode1.m2v episode1.ac3 -o ../episode1-final.mpg
You'd repeat those lines for any additional episodes, just changing the filenames so they point to the right episodes. If it's all episode#, then you'd just change the #. I also like to make mplex output the final .mpg file to a different folder so that they aren't mixed in with the rest of the files. That's what the ../ does - it makes the final file get output to the folder immediately above where the encoding happens. So if all the files are in C:\Documents and Settings\Username\My Documents\encready, it'll output the final .mpg files to My Documents.

Save the batch script - let's call it encode_now.bat - and then all you have to do is double-click on the batch script and it'll do everything automatically. It creates the AviSynth script for 'episode1.avi', encodes the audio to 192kbps AC3 using ffmpeg, then encodes the video as MPEG-2 using HCenc, and then joins the video and audio together into a single file with mplex. You then can give the -final.mpg files to AVStoDVD when you've got all of the episodes you want to go on a single disc ready. If AVStoDVD is set to 'Keep compliant video/audio', then it won't do any converting and the disc should be authored in about 30 minutes or so, and then burned in whatever time it normally takes for your burner to do that (typically 12-15 minutes at the most, assuming a write speed of 6x).

To make it easier to keep filenames straight, I use Ninotech Path Copy to allow me to select multiple files, right-click, and select Copy Path->Copy Long Name. I can then paste the filenames directly into Notepad and build the batch script around them, instead of having to remember what the names are or worry about whether I typed them correctly.

Last edited by qyot27; 15th December 2012 at 16:54.
qyot27 is offline   Reply With Quote