Log in

View Full Version : Black Rain R1 DVD Re-Encoding


EpheMeroN
27th December 2007, 03:11
Just got Black Rain DVD and the source is 4:3 letterboxed. I want to bring it back to 16:9 and get some opinions from the filtering gods here at Doom9.

Below are some images from the film. The source looks kind of poor IMHO. Grain removal perhaps? Or would this only benefit an XviD conversion and not a dvd re-encode? Filters to yield decent results when stretching the image back to 16:9?

Finally, does DVD-RB's internal AviSynth script to go from 4:3 Letterboxed > 16:9 Widescreen suffice? Or are there nicer methods of doing the transition?

http://img403.imageshack.us/img403/2329/blackrain1qy1.th.png (http://img403.imageshack.us/my.php?image=blackrain1qy1.png) http://img170.imageshack.us/img170/356/blackrain2dz0.th.png (http://img170.imageshack.us/my.php?image=blackrain2dz0.png) http://img299.imageshack.us/img299/2416/snapshot20071226180824he5.th.png (http://img299.imageshack.us/my.php?image=snapshot20071226180824he5.png) http://img299.imageshack.us/img299/4759/snapshot20071226180837sh1.th.png (http://img299.imageshack.us/my.php?image=snapshot20071226180837sh1.png)

setarip_old
27th December 2007, 04:47
Hi!

Did my suggestion regarding "InfiniFilm" solve your problem?

EpheMeroN
27th December 2007, 06:44
Hi!

Did my suggestion regarding "InfiniFilm" solve your problem?

Hey setarip_old... I was busy during the holiday season. I'll give what you said a go and post about that in the InfiniFilm thread tomorrow hopefully! :thanks:

IanB
27th December 2007, 08:39
Grain/Noise is the enemy of compression, but is the friend of your eyes. If you have the bandwidth re-encode the noise.

I take it you want to take the 720x272ish 2.35:1 image in 4:3 and resize it to a 720x360 2.35 image in 16:9. Maxing up the viewing pleasure in the process.

If time is no problem, IVTC???, Crop(720x272), MVDegrain, NNEDI->(720x544), Spline36 or Blackman(720, 360), AddGrain(fine and light to taste), AddBorders. Other favourite filters as required.

EpheMeroN
31st December 2007, 01:50
Grain/Noise is the enemy of compression, but is the friend of your eyes. If you have the bandwidth re-encode the noise.

I take it you want to take the 720x272ish 2.35:1 image in 4:3 and resize it to a 720x360 2.35 image in 16:9. Maxing up the viewing pleasure in the process.

If time is no problem, IVTC???, Crop(720x272), MVDegrain, NNEDI->(720x544), Spline36 or Blackman(720, 360), AddGrain(fine and light to taste), AddBorders. Other favourite filters as required.

I haven't scripted in a while, but I have some questions. I can understand the IVTC, then Crop, then MVDegrain, but then NNEDI>Spline36Resize step I'm curious about. There's a quality boost enlarging the image and THEN downsizing it? Instead of stretching it without NNEDI? I've never used it before. Then the AddGrain I understand to give that perceptual quality boost and encoder help for macroblock reduction, and AddBorders to letterbox the video again.

Here's what I have so far (very early stage):
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\DGDecode.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\Decomb.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\nnedi.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\mvtools.dll")

MPEG2Source("C:\Users\xxxxxxx\Desktop\VTS_01_1.d2v")

AssumeTFF()
Crop(0,48,0,-48)
Telecide(guide=1)
Decimate(cycle=5)

IanB
31st December 2007, 04:49
...but then NNEDI>Spline36Resize step I'm curious about. There's a quality boost enlarging the image and THEN downsizing it? Instead of stretching it without NNEDI?NNEDI is an excelent, state of the art, edge directed interpolator, it will accurately double (and only double!) the height of an image. It is really intended for doing the interpolation of the moving parts from 1 field of an interlaced image during a Bob. NNEDI is where you get the increased viewing pleasure, but the resulting 2*height image is now to high, so we sharp resize it back to the correct height. Yes ideally you would NNEDI directly to the new height but that is not an option.

I am surprised you actually need to telecide and decimate. Most of the time 2.35:1 movies are 3:4 letterboxed is for bandwidth reasons, i.e. squeeze 2 hour move onto a single layer disk. And if they do this they probably (hopefully) use progressive encoding with soft pulldown during playback. Carefully re-analyse your input source. (% film ???)

And your crop(0, 48, 0, 48, 0) seems at odds with the posted images, they have about 100 pixels of border :confused:

EpheMeroN
31st December 2007, 05:40
Whoops on my part! That crop was from another 4:3 Letterboxed movie I am trying to work on. Here's the actual crop from Black Rain that I just figured out:

LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\DGDecode.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\Decomb.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\nnedi.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\mvtools.dll")

MPEG2Source("C:\Users\Michael\Desktop\black-rain.d2v")

AssumeTFF()
Crop(8,112,-8,-112)
Telecide(guide=1)
Decimate(cycle=5)

The video has the typical 3 progressive, 2 interlaced frames when I do frame-stepping in VirtualDub. Telecide + Decimate is always how I've gotten it back to 23.976 progressive for the encoder. DGIndex reported 99% Film.

Can you give an example of how I'd insert NNEDI into my script? I can definitely see how it'd benefit this video now with the vertical stretching needed to bring it to 16:9 again.

kumi
31st December 2007, 06:07
How about TIVTC instead of Decomb:


interp = nnedi()
deint = tdeint(edeint=interp)
tfm(d2v="C:\Users\Michael\Desktop\black-rain.d2v", clip2=deint)
tdecimate()

EDIT: Oh sorry, I see now that you want NNEDI to stretch the frame? Hmm..

foxyshadis
31st December 2007, 06:56
DGIndex reported 99% Film.

At 99 you can just force film, it'll work fine and no one cares about a few black or near-black frames at the beginning or end being interlaced.

IanB
1st January 2008, 08:07
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\DGDecode.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\Decomb.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\nnedi.dll")
LoadPlugin("C:\Multimedia\Avisynth 2.5\Plugins\mvtools.dll")

# Use Force FILM!!!
MPEG2Source("C:\Users\Michael\Desktop\black-rain.d2v")
Crop(8,112,-8,-112)

# MVDegrain....

NNEDI(Field=0, dh=True)
BlackmanResize(Width(), 344)

# AddGrain(fine and light to taste)

AddBorders(8, 68, 8, 68)


Happy new year to all :D

EpheMeroN
1st January 2008, 23:01
I get this pop-up when trying to use MVDegrain1: "vector clip must be specified"

Would RemoveGrain(mode=2) give similar results?

IanB
2nd January 2008, 00:11
Seems MVTools manages to stuff up implict Last clip in script processing somehow, hence you have to specify all the clip arguments in commands.

EpheMeroN
4th January 2008, 19:13
Seems MVTools manages to stuff up implict Last clip in script processing somehow, hence you have to specify all the clip arguments in commands.

So to use MVDegrain I need to say clip="MPEG2Source(blahblah.d2v)
MVDegrain=clip.settings-for-filter-here?

IanB
4th January 2008, 21:38
Doh! :(clip=MPEG2Source(blahblah.d2v)
bvec=MVAnalyse(clip, ....)
fvec=MVAnalyse(clip, ....)
MVDegrain(clip, bvec, fvec, ...)

EpheMeroN
7th January 2008, 23:23
@IanB: Thanks for the help. My final encode looked MUCH better compared to the original I did using the simple DVD-RB method.

May I ask, how did you figure out all the resizing numbers, i.e. everything after the crop? Did you use some type of resize calc? Or is there a simple formula to figure this out?

Sagekilla
8th January 2008, 03:04
The resizing can be found by

1) Play the DVD back
2)Take a screenshot of playback
3) Check how much of black borders need to be cropped (Use a graphics editor for this)
4) Adjust the cropping and playback the avs file to see if you've completely eliminated the black bars yet.
5) Check the aspect ratio of the DVD when it's played back from the source file. Divide the width by the height to find AR.
6) Use the AR found from previous step to resize to a mod-16 resolution that's of that AR.


That's what I do anyway. After a while though you learn that for 2.35:1 movies you can use generally the same resolution (like 864x368) and just adjust the cropping of the top and bottom accordingly. Likewise, for 16:9 movies you usually never have to do cropping and just resize to 864x480 or 848x480. It just takes practice on different sources, you'll figure out cropping and resizing eventually.

kumi
8th January 2008, 03:12
I suggest the very handy Crop Editor inside of AvsP:
http://avisynth.org/qwerpoi/Video.html#crop-editor

It shows you cropped areas overlaid on the video, aspect ratio, WMOD and HMOD, etc.

Sagekilla
8th January 2008, 03:25
I suggest the very handy Crop Editor inside of AvsP:
http://avisynth.org/qwerpoi/Video.html#crop-editor

It shows you cropped areas overlaid on the video, aspect ratio, WMOD and HMOD, etc.

Nifty, I prefer straight up notepad editing though. But, EpheMeroN, I suggest you take a look at this and try it out. It would be a lot easier than my method.

IanB
8th January 2008, 13:12
May I ask, how did you figure out all the resizing numbers ...It is really very simple once you realize the AR of 16:9 pixels are 4/3 times the AR of 4:3 pixels and we are only changing the height, leaving the width the same i.e. all the width numbers cancel.

After the crop we have a 256 pixel high image. 256*4/3= 341.33, round to a multiple of 8 gives 344. DVD height is 480 so total borders are 480-344=136, i.e. 68 top and bottom.

EpheMeroN
9th January 2008, 05:08
Does that only work for 2.35:1 movies? Because I'm doing a 4:3 Letterboxed to 16:9 again but the movie was originally 1.85:1 and the formula is giving a height of 512 which is well over 480. Crop is (0,48,0,-48).

IanB
9th January 2008, 08:31
Okay a 1.85:1 movie letterboxed in 4:3 should be approx 346 pixels high with approx 67 pixel top and bottom borders.

Re-letterboxed to 16:9 as in the previous example gives 346*4/3=461.33, round to multiple of 8 gives 464, total borders 480-464=16, i.e. 8 pixels top and bottom.

Now 1.85:1 is pretty close to 16:9 (1.77:1) so the above makes sense.

Now I think you are saying Oheight*4/3=512 => Oheight=512*3/4=384 i.e. 48 pixel top and bottom borders in a 4:3 letterbox. If this is the case then the movie is not 1.85:1 but is 1.6875:1 (approx 15:9). If this is the case then you need to rethink you solution and either pillarbox the sides or crop a little extra top and bottom to start with so the image is cropped to 16:9

It helps with these discussions to provide all the information up front, like height, width, letterbox top and bottom, pillerbox left and right, display and/or pixel aspect ratio.

EpheMeroN
9th January 2008, 10:16
http://img522.imageshack.us/img522/7504/40000fi5.th.png (http://img522.imageshack.us/my.php?image=40000fi5.png) http://img522.imageshack.us/img522/5800/50000aj8.th.png (http://img522.imageshack.us/my.php?image=50000aj8.png)

IanB
9th January 2008, 13:12
Yeah, so the image is as I guessed, 384 high, 1.6875:1.

16:9 images letterboxed in 4:3 are 360 high.

So choice 1 is crop an extra 24 pixels to 360 high and resize that to 480 high. You loose a small amount of image, but the AR is maintained

Choice 2 is just resize the full 384 to 480 distorting the AR 6%, but you keep all the picture.

Choice 3 resize 720x384 to 676x480 and pillarbox 22 pixels left and right. Keeps the AR, keeps all the picture, mashes the horizontal resolution slightly.

Choice 4 some compromise between cropping a bit, pillarboxing a bit and distorting the AR a bit. i.e. crop 4*2, pillarbox 8*2, AR 4%

Personally I'd go with option 2.