VideoHelp Forum
+ Reply to Thread
Page 2 of 5
FirstFirst 1 2 3 4 ... LastLast
Results 31 to 60 of 122
Thread
  1. does exist an avisynth function to "convert" 4:3 into 16:9 so that image is "stretched" to fullscreen, even if cropped/risezid and loss of quality?
    Quote Quote  
  2. Originally Posted by marcorocchini View Post
    does exist an avisynth function to "convert" 4:3 into 16:9 so that image is "stretched" to fullscreen, even if cropped/risezid and loss of quality?
    Yes, that is trivial. You just use any of the dozen or so AVISynth resize functions. Even easier, just do it using your TV set's aspect ratio button. It would be really dumb, however, to permanently change a 4:3 into a 16:9 video because you are distorting it permanently. Most people don't want to make their video look worse.
    Quote Quote  
  3. I'm force to do that with old SD footage because my station want it ^_^ how I have to do? hello_hello and raffiriff script are ok to generate the fuzzycat effect for all the rest of the sources that are not 16:9 and 4:3, but at the moment I cannot find a script for avisynth 64bit that do crop/resize to get fullscreen images 4:3 into 16:9. I know the loss of quality but even old SD, almost ever (comprared to HD) are of good quality. Please can someone help a cat?
    Quote Quote  
  4. Most of the television stations here, when using 4:3 sources, either add the fuzzy version to the sides or sometimes add geometric video to the sides, keeping the full 4:3 version in the middle. If you insist on cropping it to make it 16:9, then you crop and resize. What's so hard about that? And you might try to teach your superiors how to do it the right way and not lose 25% of the picture.

    That is, crop roughly 12.5% from both the top and bottom, or some combination that adds up to 25%. For example, for a 640x480 source:

    Crop(0,60,0,-60)#120 rows of pixels=25% of the source 480 rows
    nnedi3_rpow2(rfactor=2,cshift="lanczosresize",fwid th=1280,fheight=720)#Resize to whatever 1.78:1 ratio you like using whatever resizer you like
    Quote Quote  
  5. Originally Posted by manono View Post
    Most of the television stations here, when using 4:3 sources, either add the fuzzy version to the sides or sometimes add geometric video to the sides, keeping the full 4:3 version in the middle. If you insist on cropping it to make it 16:9, then you crop and resize. What's so hard about that? And you might try to teach your superiors how to do it the right way and not lose 25% of the picture.

    That is, crop roughly 12.5% from both the top and bottom, or some combination that adds up to 25%. For example, for a 640x480 source:

    Crop(0,60,0,-60)#120 rows of pixels=25% of the source 480 rows
    nnedi3_rpow2(rfactor=2,cshift="lanczosresize",fwid th=1280,fheight=720)#Resize to whatever 1.78:1 ratio you like using whatever resizer you like
    ok thanks but if my source is 720x576 SD 4:3 what is the right script?
    Quote Quote  
  6. Originally Posted by marcorocchini View Post
    ok thanks but if my source is 720x576 SD 4:3 what is the right script?
    It's trivial math. What's wrong with you? Here's a hint: what's 25 percent of 576?
    Last edited by jagabo; 19th Oct 2017 at 19:29.
    Quote Quote  
  7. Originally Posted by marcorocchini View Post
    hicats please does exist a 64bit version of autotocrop.dll?
    http://avisynth.nl/index.php/AviSynth%2B_x64_plugins

    Originally Posted by marcorocchini View Post
    does exist an avisynth function to "convert" 4:3 into 16:9 so that image is "stretched" to fullscreen, even if cropped/risezid and loss of quality?
    I hate stretched video. If you must stretch there's a plugin (called something like WarpResize) that stretches the edges more than it stretches the middle, making the distortion a bit less painful, but I think cropping from the top and bottom for a 16:9 aspect ratio works better than stretching, although it's usually better to crop a bit more from the bottom than from the top. If cropping 4:3 to 16:9 crops too much picture, reduce the top and bottom cropping and add smaller borders instead.
    This should give the desired result for a 4:3 DVD using my script.

    c=last
    CropResizeBorder(704,396, CB=round(c.height/12.0), InDAR=15.0/11.0, Cthresh=120, Cstart=250)

    The upshot should be any black is auto-cropped (adjust Cthresh if need be), then cropped to 16:9 with a little more cropped from the bottom than the top, then resized to 704x396 (or specify your preferred 16:9 dimensions).

    An NTSC 4:3 DVD (not resized, so it's 720x480):


    If auto-crop doesn't get all the black, and you need to crop additional pixels from each side, (as an example)
    c=last
    CropResizeBorder(704,396, CL=16, CT=0, CR=10, CB=round(c.height/12.0), InDAR=15.0/11.0, Cthresh=120, Cstart=250)


    This would only crop the picture to an aspect ratio of 1.6, therefore it crops less picture from the top and bottom and adds borders for 16:9.
    c=last
    CropResizeBorder(704,396, CL=16, CT=0, CR=10, CB=round(c.height/20.0), InDAR=15.0/11.0, PicDAR=1.6, Cthresh=120, Cstart=250, Cmode="RB")


    PS I just realised in post #19 I said cropping should be done with the script like this:
    CropResizeBorder(704,396, 16, 3, -10, -4)
    which I've changed as it was wrong. All cropping values should be positive. I've changed that behaviour to match the Avisynth Crop() function for the new version of the script I'm working on, so the right and bottom cropping values will need to be negative, but I forgot for the current script all cropping values are positive.

    PS And stealing manono's idea for a cropping and resizing calculator below, there's always this one:
    https://files.videohelp.com/u/210984/YodaResizeCalculator%200.4.0.1.zip
    Last edited by hello_hello; 20th Oct 2017 at 01:46.
    Quote Quote  
  8. Originally Posted by raffriff42 View Post
    hello_hello, I'm coming around to your point of view. I added in a cross-blending argument to the script above.
    I've only just come back to the thread so I haven't played with the new version yet, but thank you, I shall. However......

    I was watching some "extras" from a DVD yesterday that were 16:9, and when they showed 4:3 sections from the original episodes, they surround them with a still picture rather than black borders. That was quite effective as it gave the impression of 16:9 without the borders being distracting as they were static, which got me thinking.....

    What if you took the first frame of a scene change and used the edge pixels to create the border, much as we're doing already, except the borders would remain unchanged until the next scene change, when they'd take pixels from the first frame of the new scene to create the borders which would remain unchanged until the next scene, and so on.

    Only I can't work out how to do it, or if it's even possible. Using an example from the Avisynth help files and conditional filtering:

    This will replace the last frame before a scene change with the first frame after the scene change:
    ConditionalFilter(last, last, last.trim(1,0),
    \ "YDifferenceToNext()", ">", "10", true)


    Would be along the lines of what I'm thinking of (at least when it comes to selecting the frame to use for creating borders), but it only replaces one frame on a scene change. What would need to happen is the frame chosen by the conditional filter on a scene change would then need to be looped until the next scene change, when a new frame is chosen to use for the borders, and so on. That part, I can't work out how to do, but I think it might be less distracting than continually changing borders.

    Hopefully that makes sense, but as I said, I don't know if it's possible. It'd probably require extracting a frame number at a given point in time, or something like that.

    Anyone clever enough to work out how to do it, assuming it's possible?

    PS. And I still think incorporating jagabo's GreyRamp function in some way (from post #22) would be a good idea if it could be used as a mask to give your borders a sense of depth. I can probably add that part. I'll give it a try later.

    Cheers.
    Last edited by hello_hello; 20th Oct 2017 at 00:25.
    Quote Quote  
  9. I've thought about doing something like this (have something only happen after a scene change, and then stay that way until the next scene change). MVTools2 exposes its scene change logic, so that would be my first choice for generating the state variable. I'm not sure, however, of how to have the results of the calculation on the first frame of a scene hold over for subsequent frames until the next scene change. Since you've done all the other work, I think that is the one main challenge.

    FWIW, I would try to use something other than the first frame of a new scene. I do a lot of film transfer work, so I am sensitized to the fact that the exposure on the first frame or two of an amateur silent film is ALWAYS over-exposed. A similar thing happens with amateur camcorder video because the person very often pushes the button while bringing the camera up to his/her eye, so you often get video of the ground at the beginning of the scene. So I'd use the fifth frame (or something like that).
    Quote Quote  
  10. I think for it to work, the border change and the scene change should happen at the same time, but I guess if you don't want to use the first frame on a scene change for the borders you could use (for example) the fifth, then delay the picture relative to the borders by five frames, or better still, apply a negative delay of five frames to the borders relative to the picture, assuming any of it's do-able anyway.....
    Quote Quote  
  11. Originally Posted by marcorocchini View Post
    ok thanks but if my source is 720x576 SD 4:3 what is the right script?
    I use GKnot for this sort of thing. Note in the picture the source (720x576), that it's set for PAL 4:3 Input Pixel Aspect Ratio, the amount of cropping done (104 from top and bottom) for the desired final resolution (1280x718 which you make 720 in your script). It should be noted that in the Options tab I have it set for ITU resizing. With non-ITU you'll crop differently.
    Image Attached Thumbnails Click image for larger version

Name:	GKnot.jpg
Views:	136
Size:	71.8 KB
ID:	43439  

    Quote Quote  
  12. Originally Posted by raffriff42 View Post
    BTW I'm growing less fond of temporal blur, depending on the source, but the noise is needed: without fixed pattern noise, heavy blurring has really nasty banding problems at times.
    Also BTW.... while I was messing around with your original script I thought I'd try to modify it a bit to my taste, which meant darkening the borders a little, making them textured (thanks for the AddGrainC idea), toning down how noticeable the movement is, and changing the colour so it doesn't exactly match the picture edges (I seem to prefer the picture to have distinct edges, even if the borders aren't black). ColourYUV(autowhite-true) seems to help there, even if I'm not smart enough to always understand the result (I assume it effects the colour blue more than any other colours). Rather than darken the borders as much next time I play around, I might try to incorporate jagabo's GreyRamp function.

    I didn't use your function in the normal way because I found it easier just to make changes to the function itself for the moment, but these are the bits I changed:

    ### EXTRACT LEFT & RIGHT EDGES
    Background1 = c.crop(0, 0, -(c.width-12), 0)
    Background2 = c.crop((c.width-12), 0, -0, 0)
    L=Overlay(Background1, Background2, Opacity=0.5).ColorYUV(autowhite=true).Tweak(sat=0. 5, cont=0.75) # for anime, sat=1.0 for video
    R=L.FlipHorizontal

    ## BLUR
    ## (almost can't have too much blur) <--- You're definitely right about that.
    L=(blur<0.5) ? L
    \ : L.QGaussBlur(blur, blur).QGaussBlur(blur, blur).QGaussBlur(blur, blur).QGaussBlur(blur, blur)
    R=(blur<0.5) ? R
    \ : R.QGaussBlur(blur, blur).QGaussBlur(blur, blur).QGaussBlur(blur, blur).QGaussBlur(blur, blur)
    StackHorizontal(L, R)

    ## ADD FIXED NOISE ('FROSTED GLASS')
    ## (enough to hide any banding from mega-blur, but no more)
    (noise==0) ? Last
    \ : AddGrain(var=Float(50), hcorr=0.0, vcorr=0.0, constant=1>0)

    and this is the result. Sorry, I'm still comparing your original script to the version I fiddled with as I haven't played with your new script yet, but it's just to see if anyone else likes the concept, even if it can be improved.

    Original script:


    Modified version:


    I think it works better for video than for animation, as video is far less likely to have solid blocks of colour at the edges of the picture:
    Last edited by hello_hello; 20th Oct 2017 at 03:29.
    Quote Quote  
  13. This is very helpful post!
    Quote Quote  
  14. With the blurred pillarbox bars, one thing I found that helps, is to make the edges reflections of the image (still blurred, darkened, and desaturated) rather than an enlargement of the image. Sorry, I threw out the samples I was playing with so I have no images.
    Last edited by jagabo; 20th Oct 2017 at 06:44.
    Quote Quote  
  15. Yes, when I originally played around with this, at the dawn of 16:9 television fifteen years ago, I found that reflected edges worked much better.

    With certain types of material, you can sometimes get amazing results, at least for a few frames at a time, by reflecting the image. For instance, when I transfer 8mm film, very often there is "unseen" material between the sprocket holes that no one has ever seen because the camera exposes that area, but no one wants to look at sprocket holes (which are actually over-exposed white) when the movie is projected.

    Here is a frame that illustrates the issue, but with the sprocket holes inverted to black so they are less obnoxious:



    Here is what it looks like after my automated replacement is applied:



    Surprisingly, the sprocket hole fix looks almost this good about 80% of the time because many scenes have sky at the top and grass at the bottom. Also, 8mm film has such a small amount of resolution that the lack of detail makes it easier to get away with this fakery. A pillar bar is tougher, of course, because it extends the entire height of the frame. My point is that, based on experience, reflected is the way to go.

    Finally, while I always look at delivering the film this way, in order to get the "bonus" of, in this case, seeing the client's father who is otherwise lost off the edge of the frame, I usually end up cropping the frame, and throwing away that which was never seen anyway. And, because 8mm is almost perfectly square instead of being 4:3, the resulting pillar bars on a 16:9 TV are actually much bigger than what you normally see with true 4:3 material on a widescreen TV.

    If the client pays for a hard drive, I usually include a version that still has the sprocket holes. I figure that some day, software will advance to the point where predictive algorithms will be able to fill in the missing information, probably using a library of similar images.
    Last edited by johnmeyer; 20th Oct 2017 at 08:40. Reason: punctuation error
    Quote Quote  
  16. I've added my latest effort to the attached version of the CropResizeBorder script. Once again when borders are enabled, it won't add black borders, only the coloured ones. There's no options for the borders yet either. The borders are created mostly using a dumb-downed version of raffriff42's function, but I'm not too unhappy with how they look.

    Pretty simple to use.
    This would take any (square pixel) image, crop it to 4:3 and add borders for 16:9:
    CRB(960, 540, PicDar=4.0/3.0)

    And this would take any (square pixel) image, crop it to 16:9 and add borders for 4:3:
    CRB(960, 720, PicDar=16.0/9.0)

    The edges aren't made from an enlarged version of the image, just from 12 pixels at the left and right edges (or top and bottom), merged together and then blurred and stretched etc.
    I tried adding a gradient to the borders, but it never seemed to work in practice the way it worked in my head, so I gave the gradient idea the flick.
    Image Attached Thumbnails Click image for larger version

Name:	A.jpg
Views:	118
Size:	22.8 KB
ID:	43441  

    Click image for larger version

Name:	B.jpg
Views:	107
Size:	27.2 KB
ID:	43442  

    Image Attached Files
    Last edited by hello_hello; 20th Oct 2017 at 09:40.
    Quote Quote  
  17. but please hello_hello your avsi does do - by request - the crop/resize without fuzzycat effect?

    I mean is there a way to avoid to do calculation? Is there a script that auto-crop at the best the 4:3 source so that final output is well-adapted to the 16:9 fullscreen 1920x1080?

    For autocrop.dll seems to me I cannot find the 64bit version
    Last edited by marcorocchini; 20th Oct 2017 at 16:25.
    Quote Quote  
  18. Originally Posted by marcorocchini View Post
    but please hello_hello your avsi does do - by request - the crop/resize without fuzzycat effect?

    I mean is there a way to avoid to do calculation? Is there a script that auto-crop at the best the 4:3 source so that final output is well-adapted to the 16:9 fullscreen 1920x1080?
    Do you mean like the example in post #37? By default the script doesn't add borders.

    Originally Posted by marcorocchini View Post
    For autocrop.dll seems to me I cannot find the 64bit version
    Do you mean the link in post #37 isn't working for you?
    Last edited by hello_hello; 21st Oct 2017 at 00:27.
    Quote Quote  
  19. http://avisynth.nl/index.php/AviSynth%2B_x64_plugins

    but at this link seems to don't find the 64 bit version of autocrop.dll

    I mean your CropResizeBorder function, can be apply without the resize-crop calculator?
    Quote Quote  
  20. I've renamed my script to SuperSexyWidescreen - because, why be so serious?

    BTW a good way to use it (or any pillarbox filter) is through ffdshow. Now all your videos are super widescreen!

    Image
    [Attachment 43447 - Click to enlarge]


    (and of course do not encode this effect, or any type of border)
    Quote Quote  
  21. Originally Posted by marcorocchini View Post
    I mean is there a way to avoid to do calculation? Is there a script that auto-crop at the best the 4:3 source so that final output is well-adapted to the 16:9 fullscreen 1920x1080?
    You didn't see my post 41 where you just plug in your source, choose your final resolution, and do the cropping? It accepts D2V input (easy to make using DGIndex), AVS input and AVI input. That means (with a D2V, for example) that you already have a video to help you with the cropping. You can even get the script it makes for you after you do the crop and resize, for use later.

    Sure these other guys are cluttering up the thread with unrelated subjects and pictures, but it's your job to read what's been written to help you. Otherwise why should we waste the time if you're just going to play stupid?
    Quote Quote  
  22. Code:
    x = float(width) / float(height)
    LanczosResize(round(x * 1080.0),1080)       
    SuperSexyWidescreen(1920, 1080)
    exactly I don't know why but it's necessary the 2 lines x = float(width) / float(height)
    LanczosResize(round(x * 1080.0),1080) to get the correct result. Or is there a way to avoid they?
    Quote Quote  
  23. Originally Posted by marcorocchini View Post
    exactly I don't know why but it's necessary the 2 lines [...] to get the correct result. Or is there a way to avoid they?
    No way to avoid them; SuperSexyWidescreen only adds borders on the sides, not top or bottom, and it does not resize your videos. Your solution looks reasonable except you probably want your new width to be modulo 4:
    Code:
    x = float(width) / float(height)
    LanczosResize(m4(x * 1080.0),1080)
    ...
    
    ## @ author Didée 
    function m4(float x) {
        return( x<16?16:int(round(x/4.0)*4)) 
    }
    EDIT the "(1920, 1080)" arguments only set the RATIO, not the absolute size
    Last edited by raffriff42; 20th Oct 2017 at 22:23.
    Quote Quote  
  24. So after another look this morning, I decided fiddling with the border colours too much was a bad idea and ColourYUV's Autowhite=true probably sucks, so I toned it all down and the version of the script attached now looks like this (as opposed to the screenshot in post #46).
    Image Attached Thumbnails Click image for larger version

Name:	c.jpg
Views:	89
Size:	22.0 KB
ID:	43448  

    Click image for larger version

Name:	D.jpg
Views:	67
Size:	22.0 KB
ID:	43449  

    Image Attached Files
    Quote Quote  
  25. Originally Posted by manono View Post
    Sure these other guys are cluttering up the thread with unrelated subjects and pictures....
    I dunno... the thread title is about adding borders.

    And the replies are all in response to marcorocchini's question in post #3.
    Quote Quote  
  26. Originally Posted by marcorocchini View Post
    Code:
    x = float(width) / float(height)
    LanczosResize(round(x * 1080.0),1080)       
    SuperSexyWidescreen(1920, 1080)
    exactly I don't know why but it's necessary the 2 lines x = float(width) / float(height)
    LanczosResize(round(x * 1080.0),1080) to get the correct result. Or is there a way to avoid they?
    Make you own function that does it all for you. This is trivial.
    Quote Quote  
  27. And one last fiddle before I give up playing with borders. I decided to lean back in raffriff42's direction so I unblended the left and right borders a little so they're usually pretty similar, but not always exactly the same.
    Image Attached Thumbnails Click image for larger version

Name:	E.jpg
Views:	107
Size:	24.5 KB
ID:	43452  

    Image Attached Files
    Last edited by hello_hello; 21st Oct 2017 at 00:26.
    Quote Quote  
  28. Originally Posted by marcorocchini View Post
    http://avisynth.nl/index.php/AviSynth%2B_x64_plugins

    but at this link seems to don't find the 64 bit version of autocrop.dll
    You must be foolin with me. It's the fourth plugin on the list.
    http://www.mediafire.com/download/mzddfmjjdyx/autocrop_3-14-2010.rar

    Originally Posted by marcorocchini View Post
    I mean your CropResizeBorder function, can be apply without the resize-crop calculator?
    That's what it's designed to do.

    CR(1280, 720) will crop a video to 16:9 and resize it to 1280x720
    CR(1280, 0, PicDAR=1.777777) will do exactly the same thing.
    CR(PicDAR=1.77777) will crop a video to 16:9 without resizing it (unless it's an anamorphic source such as a DVD, in which case you need to specify the correct Input DAR and it resizes the width for square pixel dimensions).

    The difference between using CR() and CRB() is CR(1280, 720) works as I described above, whereas CRB(1280, 720) doesn't crop extra picture to achieve the desired resizing, if need be it adds borders instead.

    The only other thing you need to be aware of is for anamorphic video, in order for the script to crop and/or resize correctly, you need to specify the correct source display aspect ratio. I'd use InDAR=15.0/11.0 for 4:3 DVDs and InDAR=16.0/9.0 for 16:9 DVDs.

    The script's quite versatile and does all that without you having to calculate anything. If that's not the sort of thing you're wanting to do, I don't know what you're asking.
    Quote Quote  
  29. Originally Posted by hello_hello View Post
    I dunno... the thread title is about adding borders.
    Then you also know that later on he lost interest in doing that and switched his questions to how to turn 4:3 video to 16:9 video without using added pillarbars. Even I had chimed in earlier by saying adding some sort of borders (blurred video as pillarbars or geomatric patterns) is how I most commonly see it when using 4:3 sources in 16:9 broadcast videos. But after that he made clear he wasn't interested in doing it that way, any longer. Maybe his boss told him how he wanted it done. I don't know.

    Originally Posted by marcorocchini View Post
    I'm force to do that with old SD footage because my station want it ^_^ how I have to do? hello_hello and raffiriff script are ok to generate the fuzzycat effect for all the rest of the sources that are not 16:9 and 4:3, but at the moment I cannot find a script for avisynth 64bit that do crop/resize to get fullscreen images 4:3 into 16:9. I know the loss of quality but even old SD, almost ever (comprared to HD) are of good quality. Please can someone help a cat?
    It seems obvious to me he wants to know how to crop from the top and bottom and then resize to turn 'fullscreen' video to 'widescreen' video. Which makes all those scripts and pretty pictures after that post off topic. Do you disagree?
    Quote Quote  
  30. Originally Posted by manono View Post
    Originally Posted by marcorocchini View Post
    I'm force to do that with old SD footage because my station want it ^_^ how I have to do? hello_hello and raffiriff script are ok to generate the fuzzycat effect for all the rest of the sources that are not 16:9 and 4:3, but at the moment I cannot find a script for avisynth 64bit that do crop/resize to get fullscreen images 4:3 into 16:9. I know the loss of quality but even old SD, almost ever (comprared to HD) are of good quality. Please can someone help a cat?
    I think after the second cat reference I must have blocked that post out, although only a couple of posts later I posted a link for the 64 bit autocrop.dll (so my script could be used) and a second bunch of examples (with screenshots) of how to use the script to achieve the desired result, and then some more examples two posts ago, because it can be used as a solution for both questions.

    Originally Posted by manono View Post
    It seems obvious to me he wants to know how to crop from the top and bottom and then resize to turn 'fullscreen' video to 'widescreen' video. Which makes all those scripts and pretty pictures after that post off topic. Do you disagree?
    Well..... if someone asks a second question, must all discussion of the original question cease? I'm not sure what the rule is once the genie's out of the bottle. Given the thread title though, I'd be thinking technically.... it's the question you quoted that's off topic, and technically.... after he/she lost interested in discussing the topic of this thread, he/she should have started a new one to ask it.
    Last edited by hello_hello; 21st Oct 2017 at 02:58.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!