Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th October 2011, 15:50   #41  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 314
Upon further testing, the 720box option is also stretching and cropping horizontally, within the pillarbox.
nhope is offline   Reply With Quote
Old 16th October 2011, 15:52   #42  |  Link
Robert Martens
Registered User
 
Join Date: Feb 2010
Location: New York
Posts: 116
Some cropping is to be expected, as PAL DV (like NTSC DV) isn't exactly 4:3, but slightly wider; if it's extreme, however, something else may be wrong. If you upload a sample somewhere (even just a still frame) I can take a look myself.

Of course, you could just force it to keep the entire frame:

Code:
SimpleSlugUpscale(size="720pbox", DARin=4.0/3.0)
DARin sets the input display aspect ratio, so you can force it to be treated as whatever you like.
Robert Martens is offline   Reply With Quote
Old 17th October 2011, 07:32   #43  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 314
The DARin=4.0/3.0 option fixes it, thanks. It would perhaps be useful to get that to happen automatically in the script. There's still some very noisy PAL DV footage here if you need something to test with.

Admittedly I'm now simply using this, which gives a very similar result:

Code:
AviSource("d:\fs.avi")
AssumeBFF()
ConvertToYV12(interlaced=true, matrix="Rec601")
BlackmanResize(1280,height)
QTGMC( FPSDivisor=2 )
BlackmanResize(width,720)
nhope is offline   Reply With Quote
Old 17th October 2011, 18:46   #44  |  Link
Robert Martens
Registered User
 
Join Date: Feb 2010
Location: New York
Posts: 116
Thanks for the clip! More test footage is always useful, I appreciate it.

With that clip I find, however, only the expected amount of slight cropping, and using the 720pbox size option works the way I'd expect it to without any extra settings specified.

Choosing the appropriate aspect ratio for the input is somewhat problematic, however, and I can't make it any more reliable than it already is; some cameras record DV at 720x480 or 720x576 treating the image as exactly 4:3, but as I understand it that's incorrect. The active area (same height but a width of about 704) is 4:3, but the full width of 720 makes the picture 15:11, which is very slightly wider, and will necessarily have its sides cropped off for output that's 4:3.

There's no way to tell which way a given piece of footage was shot, and I had to pick one or the other default AR for the input detection part of the script. It's a toss up from my perspective, but I'm operating under the assumption that most of the prosumer cameras used by the script's intended audience record a 15:11 frame, so that's the one I chose.
Robert Martens is offline   Reply With Quote
Old 18th October 2011, 10:17   #45  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 314
Ah, it's about the 704 vs 720 thing. I'd forgotten about that. So, in my situation, having shot most of my SD footage with the prosumer Sony VX2000, if I want 4:3 DV pillarboxed to 1280x720, and I want to avoid cropping the sides but keep the correct aspect ratio, it looks like I have to set the PAR of my project to 1.0667 (not the 1.0926 that Vegas gives), and then use the script I posted above. Then I get a pillarbox of 982x720 within a 1280x720 frame.
nhope is offline   Reply With Quote
Old 18th October 2011, 13:39   #46  |  Link
Robert Martens
Registered User
 
Join Date: Feb 2010
Location: New York
Posts: 116
For the script you posted, I have a couple of observations:

Code:
AviSource("d:\fs.avi")
AssumeBFF()
ConvertToYV12(interlaced=true, matrix="Rec601")
BlackmanResize(1280,height)
QTGMC( FPSDivisor=2 )
BlackmanResize(width,720)
One being that your dimensions seem to be off; as posted that will simply take your input and scale it directly to 1280x720, stretching the picture tremendously. I take it that's only a typo?

The other is that you're resizing up horizontally before deinterlacing, which is just more work for QTGMC. The preemptive horizontal resize only speeds up processing if the horizontal dimension is being reduced.

As for changing the project settings, I don't think any of that comes into play. Modifying your script a bit, you should be able to achieve your desired results with:

Code:
AviSource("d:\fs.avi")
AssumeBFF()
ConvertToYV12(interlaced=true, matrix="Rec601")
QTGMC( FPSDivisor=2 )
BlackmanResize(982, 720)
AddBorders(149,0,149,0)
1280x720 output, pillarboxed, with the center section at the appropriate aspect ratio.

Alternately, you could try (with one caveat which I'll describe presently):

Code:
SimpleSlugUpscale(size="720pbox", modw=2)
If you're happy with the results of either of those options, you can stop reading here, the following explanation goes into a bit of detail and might be offputting.

The 720 (and all other) box modes don't actually have a hardcoded dimension associated with either the width or height of the center video or boxes. Only the overall frame size is set, and the math tries to keep as much of your video visible as possible within that.

It does, however, land the box borders on multiples of modw and modh (vertical borders hit modw, horizontal borders modh). By default SSU uses mod 8, which means the center in your case ends up being 976x720, since 982 / 8 = 122.75. At a DAR of 1.3555..., slightly less than the 1.3636... of your input, the video will be very barely cropped.

By setting the horizontal modulus to 2, you'll eliminate as much of the cropping as is possible with my approach, the caveat I mentioned being that your video still won't be 982 wide, but 980 instead. This is a limitation of the script, in that I don't use AddBorders as shown up above. In what was meant to be an optimized, cleaner way of approaching this process, I generate the background using BlankClip and then crop it as appropriate to create the box bars. A video width of 982, for 1280 output, would mean bars 149 pixels wide. Since this video is all processed in YV12, however, that width can't be achieved by a crop, so the bars must instead be 150 wide. With two bars totaling 300 pixels, 1280 - 300 = 980.

This is all necessary for the "boxbg" size options, but may be something I can address for simple solid boxes. I'll definitely be looking into this for future releases.

Last edited by Robert Martens; 18th October 2011 at 13:44.
Robert Martens is offline   Reply With Quote
Old 18th October 2011, 15:39   #47  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 314
Quote:
Originally Posted by Robert Martens View Post
One being that your dimensions seem to be off; as posted that will simply take your input and scale it directly to 1280x720, stretching the picture tremendously. I take it that's only a typo?
Should have explained that I'm frameserving from Sony Vegas, and my project settings are 960x576, PAR 1.0667. So it's entering AviSynth already pillarboxed at the correct aspect ratio. I also see on an old computer that I made a project preset of 936x576, PAR 1.0940, which achieves the same thing.

Quote:
The other is that you're resizing up horizontally before deinterlacing, which is just more work for QTGMC. The preemptive horizontal resize only speeds up processing if the horizontal dimension is being reduced.
Yikes, my brain was still in downscaling mode. Thanks for pointing that out!

The AddBorders approach that you suggest is probably more elegant than what I've been doing. Thanks for suggesting it. I'll tackle the other suggestion tomorrow. Cheers
nhope is offline   Reply With Quote
Old 29th October 2011, 06:23   #48  |  Link
Chymerix
Registered User
 
Join Date: Oct 2011
Posts: 5
Hi Robert,

Great script you have here. I noticed one issue, though. When using "box" sizes, the audio gets stripped from the file.

I believe this is happening because you are overlaying a BlankClip() (no audio) background with the main clip. The overlay takes the audio from the first clip specified, which in this case is the blank clip with no audio.

I've fixed this by adding "audiodub(center)" to the last line of your script, but I have to remove that line when selecting anything other than a "box" size.

If you know of a better way to fix this please let me know.

Thanks!
Chymerix is offline   Reply With Quote
Old 29th October 2011, 07:32   #49  |  Link
Robert Martens
Registered User
 
Join Date: Feb 2010
Location: New York
Posts: 116
I am an enormous idiot. Audio completely slipped my mind, somehow, all this time. It turns out your explanation, and solution, are both on the money, although by default I don't use Overlay but StackHorizontal/Vertical, which also follow the "audio from the first clip" rule. Off the top of my head I can't remember what it is, but I think there's a reason I use bg as the first argument for Overlay/Layer instead of the center, so it looks like AudioDub is the right answer here.

I have a test version prepared that uses AudioDub, see if this helps: http://www.mediafire.com/?1q76caze4ic42cd Disable your existing version by changing the file extension or moving the file, and stick this one in your plugins directory.

The simple solution seems to be assigning the result of the giant conditional statement to a variable, then dubbing the audio from the center clip onto that as the last step. I know you said you had to remove the AudioDub line for non box modes, but testing some clips here shows the new script retaining audio in both standard and box modes, while version 1.11 does not.

Let me know how it goes; if this test script works I'll release it as version 1.12.
Robert Martens is offline   Reply With Quote
Old 26th December 2011, 22:08   #50  |  Link
Robert Martens
Registered User
 
Join Date: Feb 2010
Location: New York
Posts: 116
Since I never heard back from Chymerix (I hope he's okay), I'm releasing version 1.12 anyway. I believe I've gotten the 'box' mode audio to work correctly, please let me know if anything is still, or newly, broken. I also made a tiny correction to my try...catch block when detecting the presence of MT Avisynth and the number of threads in use, and added more details to the appropriate comment to make sure my reasoning is clear.

On top of that, I revamped the tutorial based on the feedback I've received through this script's life. I removed some things I didn't really care for and drastically reduced the volume of text on a couple of the pages. Hopefully it won't be quite so overwhelming anymore.
Robert Martens is offline   Reply With Quote
Old 6th May 2012, 03:57   #51  |  Link
Chymerix
Registered User
 
Join Date: Oct 2011
Posts: 5
Hi Robert,

I took a hiatus from video encoding for a while, but just got myself setup again. I wanted to let you know that I started using the new version of your script today and have not run into any issues. I will definitely let you know if that changes. Thank you for updating the script and I'm sorry to have left you hanging. I hope all is well.
Chymerix is offline   Reply With Quote
Old 22nd April 2021, 06:04   #52  |  Link
color
Registered User
 
color's Avatar
 
Join Date: May 2016
Posts: 235
4k?

Is it possible for someone to add resolution for 2K and 4K?
__________________
Automatic Colorization
color is offline   Reply With Quote
Reply

Tags
qtgmc, resize, tempgaussmc, upscale

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:05.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.