PDA

View Full Version : how to make decent DIVXs



mcon99
01-21-2003, 10:01 PM
After quite a bit of looking, poking and researching I have come up with the following setup. Use at your own risk. It works for me!

I don't know why everyone seems to love converting Tivo --> SVCD. 45 mins per CD? I wanted to stretch my budget a bit farther. I've seen some decent DIVX encoded movies fit on one cd! so why not tivo :)


The steps are:

TyTool ---> Video ---> DVD2AVI --> VFAPIConv
---> Audio ---> WinAMP save to .wav

Audio + Video ---> VirtualDub with DivX 5.02 pro codec and professional MP3 codec ---> with the final result being:

An approximately 130 meg file for 30 minutes of tv, w/o commercials.

Tips
-----

- In DVD2AVI save the video as a project with the default settings

- create the 'fake' AVI file by using VFAPIConv and the previously created d2v file

- In VirtualDub, load your audio and video. Set audio compression codec (MP3) I suggest the 128kb/s 44.1hz settings.
Then select the WAV you previously created and the AVI file. Finish by deleting lenghts of frames at your own choosing. :)

- Also in VD, set your video compression to divx 5.02. I used the pro codec - it will make for much better output.

some settings I remember:
- always use 2 pass vbr
- data bit rate was around 760
- quantizer set at high 6 low 2

search around DVD rip websites, they have tons of good configs for DIVX 5 around. use one of them.

save as AVI, let it run, reconfigure DIVX codec for second pass run, resave as AVI and let it rip!

otakucode
01-21-2003, 10:48 PM
Way too complicated man... here's what I do:

Extract with TyTool5.

Rip it apart with olaf's tydemux (since jdiner hasn't released a vsplit that maintains sync on SA tivo streams yet).

Mux those two files together with TMPEG or bbMPEG.

Feed it through Vidomi, encode at constant quality 100% using quarter pixel and bidirectional encoding.

Edit with VirtualDub if desired.

Burn a bunch of them to DVDR and then I can watch em in my Xbox (I have a modchip and Xbox Media Player, the entire reason I got a modchip, plays Divx WONDERFULLY). Encoding at constant quality 100% can have varying size output, so maybe find some other setting that gives size you like, Vidomi makes that all easy to setup.

OtakuCODE

wolkowh
01-22-2003, 12:11 AM
At $0.65 a pop - why waste time encoding and not just burn straight to DVD-R?
Howard

otakucode
01-22-2003, 10:24 AM
Waste not want not ;)

OtakuCODE

otakucode
01-22-2003, 10:39 AM
I suppose I should give some sizes when I say that CQ 100% can give varying sizes... OK, I have a 21 minute encode at 480x480 (everything is 480x480 for me, I haven't bothered with changing my Tivo record resolution or anything as I'm on cable and I doubt the quality gain would be noticeable) and it is 620MB. Pretty big. Its a show MTV ran about the making of the Lord of the Rings The Two Towers videogame. Then I have an episode of America Undercover from HBO which is 58 minutes long and 764MB, also 480x480 encoded with the same settings. Almost 3x longer and only 124MB bigger.

Widescreen content also takes up a lot less space because Vidomi has a nice "hypercrop" feature that scans your input and clips off the letterboxing. With that I have several hour-plus shows under 500MB and 2 hour movies under 800MB.

I've considered finding a good constant bitrate that gives good results, but encoding in constant quality seems to be the best choice for me, plus its only 1 pass so it doesn't take long. I typically get 20 - 25 fps when encoding on my machine (Athlon XP 1900+, 512MB PC2100 CAS2 RAM).

Oh, and the reason most people are encoding to SVCD is because they want to be able to watch it on their TV or they want to be able to share them with other people and SVCD is pretty widely accepted. I like Divx because I can play it on my TV and I very rarely ever share shows with anyone except 1 friend of mine when I see something he really need to see, then I'll just send him the divx cause he doesn't mind watching on his PC. Guess it all just depends on your circumstances.

OtakuCODE

BakCompat®
01-22-2003, 02:37 PM
01. Extract video from TiVo to your computer. I use TyTool5 from jdiner (thanks). You can use whatever you like.

02. Convert the extracted .ty file to it's element files, .m2a and .m2v (audio and video). TyTool (thanks jdiner) is great because it can be set to do this for you transparently along with step 01.

03. Convert the .m2v file to a .d2v file. The easiest method here is directly opening the .m2v with DVD2AVI. Once you add the .m2v to DVD2AVI, go through and make your preference selections.

04. Convert the .m2a file to a .wav file. Easiest method is using winamp. Open winamp. Make sure the repeat function is not checked. Open Options, and change the output plugin from WaveOut to DiskWriter. Configure it to point the output wave file in whatever directory you want. An important consideration here is the output sample rate. It's probably best to maintain the 48 kHz, but you can downsample it to 44 kHz if you so prefer. Close option window and click the 'play button'. The file will zip throught silently, and it decodes the .m2a to a .wav. Make sure to reset your audio output to WaveOut, or next time yu play an mp3, it will be writing it to wav on yer disk.

05. Convert the .d2v to .avi. This is doen with the VFAPI codec.. VFAPIConvEN (english) is the one to use. Simple program. Load it up, and open the .d2v file. Convert it to avi and save. Then exit. At this point, we have a 'fake' avi file that can be played in pretty much any media player program as long as the original files are not deleted. This essentially allows you to load the fake avi into just about *any* avi editor to cut yer commercials, make overlays, transitions, audio enhancements, etc.

06. Edit avi. Load VirtualDub. File-Open your avi in Vdub. Under audio menu, select from wav file, and then grab the one you decoded in step 04. At this point we have our audio and video loaded, but need to chop commercials. Keeping in mind we are parsing a fake avi, which is parsing an mpeg, editing might be a little choppy. Go through and remove any commercials in your media. A one-hour program should end being approximetely 44 minutes without commercials. 22 minutes for a half-hour show. If you are doing Mtv shows, it is not uncommon to see ~20m20s shows. They often have more commercials in their programs. Generally speaking, i get about 22m10s on the average.

07. Apply Filters. This is what separates the men from the boys here. Up thill this point, yu could pretty much train a monkey to do the task. You can diretly encode here if you are lazy, but your final video will suck quality big time. The codec can only do so much with what is handed it! Probably the first thing you want to do is deinterlace the source. This depends of course on what settings you used in DVD2AVI.. Under filter menu, add a deinterlace filter. You can use the VirtualDub one, but i would go with the smart deinterlacer from Donald Graft's excellent VirtualDub filter site. Next filter to apply is a crop/resize. Select the null transform filter and crop out the black edges of your video. On my Sony T60, i usually drop about 10 lines on the left, and 2 lines on top. Your mileage may vary. Now we have a non standard size video box with a 1:1 aspect resolution. If you want to watch it, it looks like a square box, not a tv rectangle. Do a bicubic resize to 640x480. There is much argument over what type of resize to do. General rule, bicubic if increasing size, bilinear if decreasing. Of course, these are not the only types of resizing filters. You can experiment with different source video for better quality thru diff resizing. Lots of factors involved here. These are the three main filters you will want to apply on your video. At this point, some people choose to run an unsharp mask on the source to kind of soften the frames a bit. Personally, i don't think that's necessary on the stuff i do. (mostly SciFi) For other tutorials or filter info, yu can check out Donald Graft's site, Doom9, or divx-digest. Understand though, that you probably won't find TiVo specific info.. It will be aimed at either DVD rips (which bring in different considerations because the source is so damn good) or DV material from cameras. (i don't have one yet, and if i did, i would prolly trick my PC into looking at it as a drive letter rather than a video device. You can never have enough storage, right?)

08. Encode your video. Generally speaking, i do a 2-pass vbr encode. You might want to do a single pass quality based encode is time is an issue. On my XP1600+, i get like a 4h20m encode time for a 22m clip at 2-pass. That's more than 10x the time of the clip.. Hey, i never claimed it was fast!

BakCompat®
01-22-2003, 02:42 PM
VirtualDub is the best. I can't stand Vidomi, but to each his own.... As to encoding the entire video, then editing out commercials.. well, that kinda screws the whole IBP stream of frames... It's basically a hack, but doable. Personally, i want a smooth stretch of frames without the possibility of some hardware/software hiccuping on it when it expects an I but gets a P frame and skips ahead to the next I frame because it's not smart enough to interpolate it.
Yes, a lot of people would rather just go to SVCD.. Hey, cool for you.. I prefer computer based media than NTSC res on a TV.. maybe if i had a 55" plasma wall mount tv, i would change my mind.. (anyone interested in purchasing me said tv, PM me!)
Premiere can encode but not output mp3 (dumb) so you might want to frameserve it to vdub if you like the timeline in Premiere.. that way yu get the best of both worlds.. encode features of vdub, with zoomable/sound capability of Premiere. I used to do video encoding this way when i capped everything thru analog. Man, my old Phillips TiVo had a major hiss on its RCA ports!

havanahjoe
01-22-2003, 05:37 PM
I just downloaded the modified version of virtualdub that can open mpeg streams directly. Problem is, I can't find an option to crop the image so I'm back to my old method, which is extracting with tytool, muxing with tmpeg, compressing with mpeg mediator and editing with virtualdub. It's kinda fast, muxing takes about 10-15 minutes for a 2 hour show and editing with virtualdub is fast. What I would like to do is to select a range in mpeg mediator. For example, I have a movie recorded from HBO, after it finishes, the Tivo keeps recording but HBO always has some previews in between movies. In order to remove these I compress the whole mpg file and then crop it with virtualdub. The problem is that I can't use two pass encoding to obtain a specific size because of this extra video.

I have tried using vidomi but I don't like the results I get... The cropping is not so good...

So, my point is, I want a way to cut out the parts I don't want from an mpeg file or find a plugin or something for mpeg mediator that let's me choose a range.

If anyone has any suggestions, please let me know.

btw, the method that everyone seems to use, with dvd2avi and all that seems to me that it takes a long time.. doesn't it?

mcon99
01-22-2003, 06:06 PM
I don't see how everyone believes the DVD2AVI process takes a long time, unless I'm missing something.

I am using an Athalon 1800XP w/ 512 meg DDR-266 CAS 2.5

The time to get the stream using TyTool and splitting it is pretty much fixed for any process you follow.

DVD2AVI takes at most 5 minutes to process a file to a project
VFAPI takes about 2 minutes to run
WINAMP to convert m2a to WAV takes about 6 minutes for a half hour show

The longest part of this entire process is the encoding in VirtualDub. Even deleting the commerical frames out takes almost no time.

But you can't get around the encoding time for the DIVX because the DIVX codec is the same regardless of which application your using to feed it input. And since I never encode the commercials before editing, DIVX isn't wasting time on them.

Average times for me in VD for a 30 minute show (w/o commercials) is 35 minutes for the first pass and about 25 minutes for the second pass.

I understand that anytime your authoring a DVD from a Tivo stream it is going to be quicker because you're already in MPEG-II format....

chjones
01-22-2003, 11:09 PM
Originally posted by mcon99
TyTool ---> Video ---> DVD2AVI --> VFAPIConv
---> Audio ---> WinAMP save to .wav

Audio + Video ---> VirtualDub with DivX 5.02 pro codec and professional MP3 codec --->

I've been doing something similar to this for a while, but a good deal of what you're talking about here takes some interaction. A while back I wrote a batch file that does everything up to virtual dub automatically. (I.e., no selecting the same files and options over and over on virtualdub, dvd2avi, and vfapi).

Let me generalize it a bit (no one keeps files in the same place) and I'll post it if anyone's interested.

otakucode
01-22-2003, 11:29 PM
#1 - If you split with TyTool, you will lose sync. You need to use jdiners new tool or, preferably, olafs tool. I say preferably olafs tool because it repairs GOP errors... as far as I know, jdiners tool does not do this.

#2 - Editing the resulting AVI with VirtualDub does not break the GOPs at all. VirtualDub will not include any frames that cannot be compltely decoded. This means it is not frame-accurate but it will not break your GOPs either. If you try to cut on, say, a B frame, it will include the I frame before it and all the frames upto that B frame and from then on, it will not let you break a GOP.

I prefer Vidomi just because I can set it up once and then go with it, I don't have to worry about changing the codec settings or anything.

I suppose editing pre-encode is just as good and will save time, I was editing afterwards because I knew the tools at the time were having some problems with putting enough info into the MPEG to let editing programs maintain sync. I figured after encoding, plenty of info would be there to maintain sync and I haven't had any get off as of yet, but I might try editing the muxed MPEG after getting it through olafs tool and TMPEG or bbMPEG. It would save encode time for sure.

I just don't see the point of involving DVD2AVI, VFAPI, and all these extra steps... you gain no quality from it. If you like encoding with VirtualDub and setting up both passes maunally and such like that, use VDubMod which can open the MPEG-2 files just fine. That saves using any kind of frameserver that slows down encodes.

OtakuCODE

otakucode
01-22-2003, 11:35 PM
mcon99, the reply after yours sums up what people mean when they say it takes a long time... you have to BE there for the steps. It may only take 6 minutes to convert to a WAV file with winamp, but if you're at work that can be a long 6 minutes. I go straight from getting the MPEG to encoding. And for encoding, I click 3 buttons (open file, open, encode). When olafs tool comes in DLL form I plan on making a program that will just go from TY to Divx without anything in between. Sure, setting up DVD2AVI, fiddling with winamp, etc will all still work and be around the same speed processing-wise, but you'll have to be there for more of the steps...

OtakuCODE

chjones
01-23-2003, 12:06 AM
Originally posted by otakucode
mcon99, the reply after yours sums up what people mean when they say it takes a long time... you have to BE there for the steps. ... Sure, setting up DVD2AVI, fiddling with winamp, etc will all still work and be around the same speed processing-wise, but you'll have to be there for more of the steps...


Exactly what I'm saying. You're absolutely right, also, about going straight from MPEG to encoding---when that's possible, it's most definitely the way to go. However, I actually do need
frame-level editing, and often have to add a filter or two (i.e., get rid of the closed captioning artifacts at the top of the images). I actually only use virtualdub because I like the interface (I know, I'm in the minority)---and when you are transcoding, you actually can get frame-accurate (as opposed to GOP-accurate) editing.

That's why I did my best to automate the whole process. I can't say it was easy, but I finally found command-line tools to do everything except the commercial cutting (which, so far at least, has to be done by hand). Fixed everything up into a batch file and go from WestWing.ty to WestWing.avs (an avisynth script, with cc data blacked out and audio at the proper offset and sample frequency) which I can edit and do with as I please (DIVX, huffyuv, whatever). I can't say it's perfect, but it works for me.

I end up telling my computer to convert a buttload of these; when I feel like it I cut out commercials of 5 or 6 at a time, and save them all---then it's almost all processing time. I fix my "interaction time" (which I consider much more important than processing time) at about 4 minutes per hour episode (of course, not counting the original time I put into learning how to slap everything together ;-)

BTW---anyone have a better way of getting rid of closed captioning data (the broken white lines at the top of SA tivo recordings) than simply blacking out the top few lines? They actually *do* show up on my tv (probably since I transcode) and they leave some mildly noticable artifacts even when I black them out.

Hope that helps...
CDJ

otakucode
01-23-2003, 04:13 AM
chjones, since you're converting this into Divx, it should be OK to change the resolution, right? Why not clip the frame? I know avisynth has filters for that... Not sure what you play the AVIs back with on your TV, would doing such a thing screw up your aspect ratio or something?

OtakuCODE

chjones
01-23-2003, 10:36 AM
Originally posted by otakucode
chjones, since you're converting this into Divx, it should be OK to change the resolution, right? Why not clip the frame? I know avisynth has filters for that... Not sure what you play the AVIs back with on your TV, would doing such a thing screw up your aspect ratio or something?


Actually, I'm not making DivX's---I'm making DVD's. I know, I know, I can do it without the long path, but this is the best way I can get frame-accurate cutting, stay in sync, etc. GOP-accurate cutting *always* leaves me with a slice of commercial or cuts a bit of the program (think some channels cut their commercials in too quickly, personally), and the Maestro chapter trick doesn't work for me since I'm really pushing the limits already on DVD-R capacity. I'll shut up now since this isn't the proper thread for DVD-making. ;-) The only thing I find interesting about my automated workpath is that it ends up in virtualdub---a decent place to branch into whatever direction (reencoding, filters unavailable in avisynth, divx, whatever).

CDJ

otakucode
01-23-2003, 02:49 PM
Ok, so you would definitely want to maintain a certain resolution to stay within spec obviously. You could always use AVISynth to both clip the frame and then do a resize... since you're only cutting off a few pixels this shouldn't introduce any noticeable quality loss at all... you could probably even use nearest neighbor or whatever the fastest resize avisynth offers, I seriously doubt you would notice any quality degradation...

OtakuCODE

chjones
01-23-2003, 04:06 PM
Originally posted by otakucode
... You could always use AVISynth to both clip the frame and then do a resize... since you're only cutting off a few pixels this shouldn't introduce any noticeable quality loss at all... you could probably even use nearest neighbor or whatever the fastest resize avisynth offers, I seriously doubt you would notice any quality degradation...


Definitely an option. I'll give it a shot and make sure the quality doesn't suffer.

In the meantime, can anyone tell me: Is the artifacting produced by the closed captioning (not the obvious white lines, but the slightly "faded" areas around them) a product of TiVo's encode? I assume so, as I have a SA and I assume it encodes all the video (CC included) that comes into it. However, if this were not the case....

CDJ

chjones
01-25-2003, 12:17 AM
Okay, just because a couple of people asked me about it, I posted my little ty2avi batch file and supporting stuff. I assumed that would best go in another thread, so it's at:
http://www.dealdatabase.com/forum/showthread.php?s=&threadid=21349

Hope that helps,
CDJ