Log in

View Full Version : Help to convert HD to SD


steptoe
3rd December 2012, 08:32
Just looking for a quick suggestion what resizer to use for downsizing HD (blu ray) to SD (DVD)

I've tried ConvertxtoDVD, I have both the old v4 and the newer v5 but still not happy with the results

Also tried BD-RB, but the resizer can't be changed as thats hardcoded into the software. I could use another resizer but whats the point of resizing again something that already been resized to DVD specs


I normally use Lanczos, but it was suggested elsewhere that spline or blackmann resizers are better for downsizing

The sources are 1920x1080 and I want to downsize to either 720x480 or 720x576


This script was suggested on the DVD-RB forum

Sharpen(0.5, 0) #pre-sharpen horizontally to better keep hor. details
BlackmanResize(704, 576, taps=4) #for AviSynth versions before 2.58 use Spline36Resize
Blur(0, 0.6).Sharpen(0, 0.4) #mild vertical low-pass


Thanks

setarip_old
3rd December 2012, 09:45
Hi!

I've gotten what my tired old eyes perceive to be excellent results using multiAVCHD...

steptoe
3rd December 2012, 11:32
I have used multiavchd but looking and ranting don't seem to manage to get a blu-ray source to DVD

I'm looking to convert blu-ray to a DVD not a single file, mainly because kids and expensive blu-ray discs don't mix with grubby small fingers and trying insert various things into an expensive blu-ray player, but use our el-cheapo DVD player

I'm putting them on DVD for her, so when/if they get wreaked I can do them again rather than buy yet another replacement. As far as I understand it I'm not breaking any rules as I own the originals and backing up my originals and playing them in the same location as the originals just on a different format to protect my discs from damage



Currently trying out FAVC that appears to be doing what I want, after much downloading and testing various free DVD software that doesn't quite manage what I'm looking for in that I want to use avisynth with HCenc not ffmpeg so I can have control over the filters and do what I want with the result not what the software assumes all I want is a quick and dirty conversion

TheSkiller
3rd December 2012, 11:54
That script snippet you posted works good, actually I myself have written it, I guess someone has copied it from here over to another forum.

The only thing you'd need to add would be a sourcefilter at the beginning to load the video. Oh, and of course ColorMatrix (http://forum.doom9.org/showthread.php?t=82217) - very important for correct colorimetry since it differs between HD and SD.
This would be what you want:

ColorMatrix(mode="Rec.709->Rec.601", clamp=0)



Well, I personally am not a friend of "klick and forget" software, it's your choice. The AviSynth route maybe more elaborate at first, but once you're into it, it will almost work on it's own and the nice result should be worth it.


Anyway, here's unfortunately something annoying with converting BluRay movies to PAL DVD: unlike movies released on PAL DVD, movies on BluRay are always not speed-up to 25 fps but are encoded at 23.976.
So, now you either have to speed up the audio or encode your MPEG2 at 23.976 fps and add pulldown flags afterwards. The latter is probably preferable because it does not invoke having to mess with the audio. The downside would be it's not perfectly smooth like a speed-up would be but it's rather hard to notice.

manolito
3rd December 2012, 14:48
@TheSkiller

I posted the script in the DVD-RB forum, and I did give you credit as the author of the script.:)
http://forum.doom9.org/showthread.php?p=1603310#post1603310


@steptoe

FAVC is one option for you, but it is quite old now and it is not maintained any more.

As I said in the other forum, you really should give AVStoDVD a try. It uses HCenc, it lets you edit the AviSynth script, and it also takes care of the conversion from NTSC to PAL or vice versa. It even gives you the choice to convert 23.976 fps to 25 fps either by speedup (including audio speedup) or by setting pulldown flags.


Cheers
manolito

steptoe
3rd December 2012, 19:55
Tried AVStoDVD, and it does improve things but there is still some jaggies on some edges on animation but did allow me to fiddle with the final script all I want

I just have to convince it to load an external .dll now to get it to use colormatrix (which I used to use with DVD-RB so know itw orks). I used to have that aggrevation when first starting with avisynth. I know its down to the path, so I'll get it right eventually


Maybe I'm just being too picky, but it is better than before after using the script as suggested and changing the resizer to spline64 to downsize as suggested by AVStoDVD

I'll try the blackmanresizer and see if that improves the jaggies at all



So now I have a DVD encoder that actually works how I need, I'll uninstall all the others I was trying and getting nowhere with and remove more clutter from my system

TheSkiller
3rd December 2012, 20:27
I'll try the blackmanresizer and see if that improves the jaggies at allHonestly, if you see major jaggies then it's certainly not a problem caused by either BlackmanResize or SplineResize because the difference between the two is so tiny (microscopic) you will hardly ever notice.

Maybe something is indeed going majorly wrong, maybe it's just the way you view (PC?) the result that causes the jaggies you see.

Since I have no idea what AVStoDVD is doing because I never used it, I can't tell you whats going wrong.

steptoe
3rd December 2012, 20:47
Just doing some more reading, it appears I am suffering from aliasing that's caused by downsizing and is a known issue, hence anti-aliasing filters

I'll give them a try and see if it improves things on the source I'm testing it on

manolito
3rd December 2012, 21:24
You probably should post some screenshots before/after conversion to give us a better impression of the problems...

I just have to convince it to load an external .dll now to get it to use colormatrix (which I used to use with DVD-RB so know it works)

The ColorMatrix.dll is included with AVStoDVD (it is in the "Lib" folder), and normally it is used automatically if needed.

Any AviSynth filter DLL which is stored in the AviSynth\Plugins folder will be automatically loaded when it is called by the AviSynth script. So you can use just any AviSynth filter within AVStoDVD as long as the DLL resides inside the Plugins folder.



Cheers
manolito

steptoe
3rd December 2012, 21:58
Worked that out after a while of playing with the menus, just the paths as I thought it would be

It looks like I can apply anti-aliasing, but they are all very very slow calling multiple external filters and even slower functions, so I'll give other methods a try as I don't really have an infinite amount of time


The main thing is that I'm getting somewhere now, as I used to use DVD-RB but DVD-RB doesn't accept external video unless its a DVD, but I am trying to go back to a DVD (which I can no achive thansk to AVStoDVD)

Thanks for the help, and I'll go back to playing with the scripts and functions I used to use but forgot how to set-up as they called so many external filters/functions to perform multiple operations in one function



I'll see if this next script makes a difference (to me), and post the screen shots of before and after which should hopefully show what I can see

Didée
3rd December 2012, 22:17
Downsizing with a standard resizer will, by itself, not introduce Aliasing. If you need shoot after the downsize with an Antialiasing filter, then something is going wrong.

Looking forward to see some screenshots. Not that "interlacing" is somehow coming in the way, in form of "interlaced resize", or whatever.

turbojet
4th December 2012, 06:03
Isn't sharpen then blur counterproductive?
Personally I'd use the obscure spline144 from http://www.wilbertdijkhof.com (http://www.wilbertdijkhof.com/) and forget the sharpens and blur, probably get a sharper picture. Except for the name it's very different from spline16/36/64.

steptoe
4th December 2012, 10:36
Here are snapshots I've done this morning, using PotPlayer with all video settings at defaults and no additional video filters running, using Win7 with NO extra 'codecs packs' installed just what comes with Win7 Utimate

Laczos4Resize (no colormatrix)
http://imageshack.us/f/541/slife199801.jpg

BackmanResize taps=4 (with colormatrix)
http://imageshack.us/f/27/slife199802.jpg

Original Blu-Ray
http://imageshack.us/f/194/slife199803.jpg

I had to use ImageShack due to uploading images as attachments had them resized and reduced in size automatically, so going via ImageShack allowed me to upload without any restrictions, apart from having to convert to JPG due to the source filesize being to large. But you can still see the effects



You can plainly see the aliasing around the edges of the bird and the right eye, when compared to the original from the blu-ray of 'Disney's A Bug's Life'

Obviously I don't expect the exact same quality due to the massive reduction in bitrates and going from 1920x1080 to 720x480 or 720x576 depending on source, but some improvement would help and also help me in future projects and ideas or scripting

Didée
4th December 2012, 11:17
It seems you have discovered that digital video is made up of discrete pixels. To me, those pictures are basically fine. If THAT is what you call aliasing, try a softer resizer like e.g. "bicubicresize(720,480, 0.5,0.25)".

With pixel-based images there is always a trade to make, between sharpness/blurriness and aliasing. If a pixel-based image is made "perfectly" free of aliasing, then most people will complain "that is way too blurry!!" To achieve a convenient level of sharpness, some minor aliasing in the picture is required.

When zoom largely into those pictures, I'd say that the "per-pixel-characteristics" are more or less the same in the SD shots as in the HD shot, i.e. the HD picture actually has the same sort of "aliasing". It's just the big framesize that hides, and the fact that it's usually displayed at 1:1 pixel presentation. Whereas the SD ones of course will be enlarged when viewed on a Full-HD Display, hence you can see the pixel structure much more easily.

pandy
4th December 2012, 11:32
To avoid flicker (interlace) some Blur in vertical direction can be applied to source image, to improve sharpness some pre-sharpen effect can be applied in horizontal direction to source image, to improve perceived sharpness some small amount of the fine noise (Blue noise for example) can be add do video after resize and before encoding (and this in unavoidable way will raise overall bitrate however some positive effect is banding reduction).

henryho_hk
4th December 2012, 17:22
1) is the Bluray interlaced or film-based?
2) what is the DVD target bitrate?

henryho_hk
5th December 2012, 00:42
BTW, there are two threads on HD-to-SD conversion:

1) Aspect ratio: http://forum.doom9.org/showthread.php?t=163700
2) Chroma Placement for Interlaced-to-interlaced conversion: http://forum.doom9.org/showthread.php?t=139102

*.mp4 guy
8th December 2012, 05:42
Downscaling does create aliasing. if it didn't we could all be using sinc interpolation and getting nigh perfectly reconstructed output. However, this is not the case, and the input aliasing will induce the sinc kernel to ring uncontrollably, forcing the use of less naively optimal kernels. 5 seconds of attention paid to the frequency response graph of any of the linear interpolators would be enough to understand that they cause aliasing even when downscaling.

Case in point: aliasing from 4 tap blackman interpolation put through a sinc interpolator (http://www.imagebam.com/image/188ebf224624931).

Compare to this sinc interpolation (http://www.imagebam.com/image/2a3ce5224624916) derived from a downscale using a kernel that does not leave significant aliasing.

Both examples were interpolated in an identical manner, the only difference is the downscaling used. Aliasing (http://www.imagebam.com/image/cb5571224626698) vs. no aliasing (http://www.imagebam.com/image/0b83ca224626711). The non-aliased image was created using the "noalias4" and the "maxflat8" kernels from this thread (http://forum.doom9.org/showthread.php?t=166080).

SeanYamazaki
9th December 2012, 08:28
Compare to this sinc interpolation (http://www.imagebam.com/image/2a3ce5224624916) derived from a downscale using a kernel that does not leave significant aliasing.

Both examples were interpolated in an identical manner, the only difference is the downscaling used. Aliasing (http://www.imagebam.com/image/cb5571224626698) vs. no aliasing (http://www.imagebam.com/image/0b83ca224626711). The non-aliased image was created using the "noalias4" and the "maxflat8" kernels from this thread (http://forum.doom9.org/showthread.php?t=166080).

Your eyes are better than mine. I had to blow up the image by a factor of 2 to see what you were talking about. But thanks for pointing it out, I now know what aliasing is.

*.mp4 guy
10th December 2012, 01:02
To be fair, the image with aliasing in it has such a small amount of it that it would generally be considered to be free of artifacts (i.e. perfect). Part of the reason for this is the difficulty of removing aliasing from images in a way that is pleasant to look at. As it is generally not possible to remove all of the aliasing in an image while retaining a sharp and detailed look, many people prefer to live with a certain amount of artifacting.

My point was mostly along the lines of saying "just because it is very difficult to do better than we are right now, does not mean that what we have is perfect". It is always possible to do better. Whether removing all of the aliasing in this case is better then leaving it is perhaps a matter of taste, though I would lean towards removing it.

SeanYamazaki
10th December 2012, 04:18
Did you downscale that anti-aliased image in two steps, E.G. 1080 using "noalias4" -> X using "maxflat8" -> 720?

I want to reproduce your result with a similar movie, but it looks firniture has to be called twice in the script.

Regards,

Sean

*.mp4 guy
10th December 2012, 05:01
Yes, it is done in two steps, but you have the order backwards. It is maxflat8->1440 noalias4->720.

In fact, if you want to reproduce the results exactly you need to use this script and uncomment the two calls to "dfir":Dest_X = 720
Dest_Y = 304

firniture(Dest_X*2, Dest_Y*2, kernel="maxflat8", gamma=false)
#dfir(kernel="lowpass9")# unreleased function, uses dithertools to run FIR filters without decimation.
#dfir(kernel="binomials6")# unreleased function, uses dithertools to run FIR filters without decimation.
firniture(Dest_X, Dest_Y, kernel="noalias4", gamma=false)

In order to avoid destroying the page layout I'm putting the function on pastebin (http://pastebin.com/FFTkqviP). Unless you actually intend to use sinc as an interpolator, you can probably omit the calls to dfir without changing the output all that much. "lowpass9" is the same kernel as "maxflat8", it is used to remove some very minor residual high frequency aliasing that sinc doesn't like, "binomials6" does some slight sharpening to counteract blurring from using "lowpass9". If for some reason there actually is demand for this sort of thing, these steps could be combined into a single interpolation kernel

[edit] For completeness here is the call used to execute the sinc interpolation from the examples:Dither_convert_8_to_16.Dither_resize16(width*2, height*2, 0, 0, 0, 0, kernel="sinc", kovrspl=2, taps=16).DitherPost

SeanYamazaki
10th December 2012, 05:36
Thank you for the trouble. Claiming I want to reproduce your results is a stretch for me at this point. I'll still need to learn the concept of interpolation and the myriad of other tools you are using in that script.

I wish I could have started out in this field and learned this like you did. Especially after you provide and point out examples, your attention to detail is amazing, honestly.

Regards,

Sean

*.mp4 guy
12th December 2012, 02:49
If you need help with filter syntax, etc. you should try the #avisynth channel on freenode (irc (http://en.wikipedia.org/wiki/Irc)).