Log in

View Full Version : How to feed DVD-RB a 23.976fps PAL stream?


kumi
9th June 2007, 00:14
Hi,

I've got a PAL DVD9 I wish to rebuild. The main movie is interlaced, with some nasty field-blending. So I have an AviSynth Restore24() script that returns a nice 23.976fps progressive stream.

However, I can't figure out how to rebuild this DVD without re-encoding TWICE. The inefficient way is to:

1/ Demux movie, apply Restore24(), and re-encode the 25fps stream, resulting in a 23.976fps progressive .m2v.
2/ Run DGPulldown.exe on the .m2v to get a 25fps stream.
3/ Replace the main movie in the DVD9 with the new .m2v.
4/ Rebuild DVD (thus re-encoding for a second time.)


I'm hoping there is a more efficient way of doing things. Can I use my Restore24() script in the Script Editor (turning on "Disable Interlaced", of course), or will this break things, because DVD-RB might expect 25fps instead of 23.976fps?

Thanks

manono
9th June 2007, 11:27
I'm hoping there is a more efficient way of doing things.
Yes, skip step 4. You've already done the hard part. Well, if you encode it to the right size for a DVD5, you've done the hard part. Why try and force DVD-RB to do anything with it when it doesn't support framerate changes, and you (quite wisely) don't want to waste time and quality encoding it twice?

Remux it using Muxman and fit it back into the original DVD using VobBlanker. Or is what you're doing more complicated than that?

kumi
9th June 2007, 18:05
Huh, you're absolutely right. I didn't see the obvious, staring me right in the face :stupid: :p

kumi
11th June 2007, 18:40
Unfortunately, I've run into a limitation: I can't re-encode the whole film at once in HC, because of an AviSynth error (I don't have enough RAM)

The only way my system can handle this is through DVD Rebuilder, since it segments the encoding.

So I'm back to square one: is there any way to use my script that returns 23.976 progressive frames per second? Perhaps by manually editing the REBUILDER.INI OR .ECL files? Anything? :)

~bT~
11th June 2007, 20:02
^ I use the trim function quite a bit.

Split the film into a few segments from the original frames and re-encode to Lags or Huffy.

avi1
mpeg2source("D:\RI4M\VTS_01_1.d2v")
#your script
Trim(0,100000)

avi2
mpeg2source("D:\RI4M\VTS_01_1.d2v")
#your script
Trim(100001,200000)

avi3
mpeg2source("D:\RI4M\VTS_01_1.d2v")
#your script
Trim(200001,300000)

Then feed the new avi's to HC.

AVISource("avi1.avi", "avi2.avi", "avi3.avi")
#ConvertToYV12() #maybe needed??

It may be faster than you think as you will only use the filtering once.

EDIT: I think you may need to add converttoyv12() depending on what HC accepts as input.

kumi
11th June 2007, 21:17
Thanks a lot bT, I didn't think of that solution. I'll have to clear some hard drive space, but I think your way is doable. Cheers :)

~bT~
11th June 2007, 22:02
no probs mate :) it should work out fine as I use it quite a lot but with CCE.

Boulder
12th June 2007, 17:41
Unfortunately, I've run into a limitation: I can't re-encode the whole film at once in HC, because of an AviSynth error (I don't have enough RAM)HC shouldn't use any extra RAM even if the clip it encodes is longer. You might want to post the error message you get and your script so we can check them out. Using Avisynth v2.5.8 alpha should help with RAM consumption in any case.

kumi
12th June 2007, 21:08
Thanks Boulder. I tried 2 scripts (with various different SetMemoryMax values), and they both fail to complete. It's very frustrating, because the scripts plays perfectly in vdub, and encoding 1-5% samples works fine. Here's some info on my system:

Windows XP SP1
512 MB RAM
Sempron 2400+ CPU
AviSynth 2.5.6.0
DGDecode 1.4.9
HC 0.21.0.0

The source .m2v video specs are
PAL, Interlaced, 25.000 fps, Aspect_Ratio=16:9,Picture_Size=720x576, 152775 total frames, 5.13 GB filesize

Here's the first script I tried. The HC error messages was "Avisynth message: invoke environment error", after the first pass reaches 100% (this appears in the HC window, but not the HC .log file):
SetMemoryMax(256)
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain\Repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain\RemoveGrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ReduceFlicker\ReduceFlicker.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp Package\warpsharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LeakKernelDeint\LeakKernelDeint.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools-v1.5.8\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\avisynth_c\avisynth_c.dll")
LoadCPlugin("C:\Program Files\AviSynth 2.5\plugins\SmartDecimate\SmartDecimate.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TIVTC\TIVTC.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TDeint\TDeint.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\Restore24 RC1\restore24_RC1_WIP.avs")

LoadPlugin("C:\Program Files\dgmpgdec\DGDecode.dll")
MPEG2Source("G:\NIGHTMARE DETECTIVE PROJECT\DVD9 DEMUX\VideoFile.d2v",idct=7)

Restore24(r24deint=3, numr=2997, deno=6250)

After this failed, I tried a different script, thinking it was Restore24's fault. With the script below, HC managed to get into the second pass, but exits mysteriously after having written only about 1/4th of the output file. No errors in the HC .log file, it just exits. Memory consumption (virtual) was pretty high on this one, about 1.8GB near the end:
SetMemoryMax(256)
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools-v2.0\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ReduceFlicker\ReduceFlicker.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TDeint\TDeint.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LeakKernelDeint\LeakKernelDeint.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\C_Package\Mrestore.avs")

LoadPlugin("C:\Program Files\dgmpgdec\DGDecode.dll")
MPEG2Source("G:\NIGHTMARE DETECTIVE PROJECT\DVD9 DEMUX\VideoFile.d2v",idct=7)

ord = last.getparity() ? 1 : 0
d= leakkernelbob(ord,4,true,true)
tdeint(mode=1, type=2, link=0, mthreshl=6, mthreshc=6, sharp=true,tryweave=false)
Mrestore(quality=2,mlimit=0.5,numr=2997,denm=6250,dclip=d)


And for reference, here's the HC.INI I used on both scripts, called from the command line with start /low HCenc_021.exe -ini "c:\ndproject.hc.ini":
*INFILE G:\NIGHTMARE DETECTIVE PROJECT\DVD9 DEMUX\VideoFile.avs
*OUTFILE D:\NIGHTMARE DETECTIVE PROJECT\HC OUTPUT\videofile.m2v
*LOGFILE D:\NIGHTMARE DETECTIVE PROJECT\HC OUTPUT\videofile.log
*BITRATE 5241
*MAXBITRATE 7200
*FRAMES 0 152775
*PROFILE best
*AUTOGOP 12
*BIAS 20
*MASK_SHIFT 2 0 0
*MATRIX mpeg
*CPU mmx
*WAIT 20

FYI: the reason I said originally it's a RAM issue is because of this post (http://www.videohelp.com/forum/archive/error-using-avisynth-to-hcgui-t320514.html).

kumi
13th June 2007, 00:06
I just found a most intriguing post (http://forum.doom9.org/showthread.php?p=990202#post990202) by Neuron2 that might solve the problem of feeding DVD-RB non-standard framerates:
DGPulldown never even looks at the original frame rate encoded in the MPEG stream. So you can do AssumeFPS() in your script to any legal value and then do the MPEG encode at that value (say, 25fps, it doesn't matter). You need the AssumeFPS() so that the encoder doesn't try to convert the framerate. Then just lie when you enter the input frame rate in DGPulldown and enter the real rate

So, with that in mind, I'm going to try plugging in one of those scripts in my previous post into DVDRB Filter Editor, with an additional line at the bottom:
AssumeFPS(25)
Hopefully DVD-RB will accept the script output and not mangle it. Then I'll demux the rebuilt movie, apply DGPulldown.exe to it, and replace it back in with VobBlanker.

It's a long shot, but it might work :)

~bT~
13th June 2007, 00:46
^ I very much doubt it will work..

kumi
13th June 2007, 02:22
Alas, I just don't have enough space to encode into lossless, so this is the only only option if I want to get this done anytime soon.

Boulder
13th June 2007, 03:25
It won't work because DVD-RB doesn't like anything changing the number of frames in the video. It might do something but I'm quite sure rebuilding will be a mess.

Using Restore24 for doing a longer multipass encode is one sure way of getting problems. Out of interest, did you use tritical's SmartDecimate build?

kumi
13th June 2007, 04:54
Nope, actually I used http://kevin.atkinson.dhs.org/avisynth_c/avisynth_c-0.15.zip and http://kevin.atkinson.dhs.org/tel/SmartDecimate-0.23.zip

Boulder
13th June 2007, 09:17
You might want to try these dlls then: http://bengal.missouri.edu/~kes25c/smartdecimate_avisynthc.zip

kumi
13th June 2007, 22:12
Thanks, I will. I'll try the mrestore script first, this time with AviSynth 2.5.8 alpha.

EDIT: No go, the script crashes about 1/2 through the second pass. I'm going to give up on this project for now. 9+ hours each time I want to test a setting is tying up my computer too much ;)