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. |
14th December 2008, 10:19 | #1 | Link |
Registered User
Join Date: Dec 2007
Posts: 117
|
Vertical upscaling of pure interlaced footage
Hi,
I have a problem that I'm not sure how to solve. I recorded a program that is 704x480, pure interlaced, NTSC. The video is letterboxed 4:3, and with the letterbox bars removed, a 16:9 image remains. I'm hoping to be able to somehow crop the letterbox bars, and then resize back to 480, so that I can encode in 16:9 MPEG2. My goal is to put the program onto DVD. So my workflow would go something like this: 1. Crop: 704x480 -> 704x364 2. Resize: 704x364 -> 704x480 3. Pad: 704x480 -> 720x480 But I'm not sure how to implement Step 2, as the material is pure interlaced. I did find this thread on downscaling 1080i HD to 480i for DVD, but it talks about how to optimally "throw away" image detail for the HD to SD conversion. My problem is how to interpolate 116 lines of information to go from 4:3 SD to 16:9 SD. So if anyone has any ideas, comments, or thread links, please pass them along. Thanks everybody |
14th December 2008, 14:13 | #3 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
@Avisynth_challenged,
A. SmartBob to 60p, then use NNEDI to double the height to 728, then use a normal sharp resizer to scale back 480, finally reinterlace back to 60i. B. For faster processing but with less quality, separate fields, NNEDI to double the height of the fields to 364, Interlaced resize the fields to 240 (you will need to adjust the correction factor to compensate for the NNEDI), weave. And are you really sure your source is true 60i and not 3:2 of 24p. C. If it's 24p then IVTC to recover the 24p, then use NNEDI to double the height to 728, then use a normal sharp resizer to scale back 480. Encode as 24p MPEG2 with soft 3:2 pulldown. @*.mp4 guy, 432 is 16:9 letterbox of PAL |
14th December 2008, 18:32 | #4 | Link | |||
Registered User
Join Date: Dec 2007
Posts: 117
|
Thanks for the responses IanB and *.mp4 guy.
Quote:
Quote:
Quote:
Thanks again for your help. |
|||
14th December 2008, 21:51 | #5 | Link | |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Quote:
An alternative approach that will give slightly less sharp results but will avoid problems with interfield twitter, would be to use a NNEDI based bobber and then used an interlaced resizing related technique to directly produce new fields and finally Weave. The decision depends a lot on the original source material and your own tastes. |
|
14th December 2008, 21:55 | #6 | Link |
Registered User
Join Date: Dec 2007
Posts: 117
|
Update
Did lots of reading on the forum about resizing interlaced sources, and came upon *this*, which lead me to *this*.
Based on the above, I came up with the following script: ### BEGIN SCRIPT ### LoadPlugin("C:\program files\avisynth 2.5\plugins\DGDecode.dll") LoadPlugin("C:\program files\avisynth 2.5\plugins\decomb.dll") Import("C:\program files\avisynth 2.5\plugins\mcbob_v0.3u.avs") ############ # This line loads the MPEG source MPEG2Source("Path\source.d2v") ############ # Should already be yv12, but just to make sure... converttoyv12(interlaced=true).AssumeTFF() #or AssumeBFF if necessary # crop off borders: crop(0,58,-0,-58) #Bob-deinterlace to 50p/60p mcbob() #Edge-directed interpolation to double height NNEDI(field=0, dh=true) #Make it fit Spline36resize(704,470).addborders(8,5,8,5) #Reinterlace assumetff().SeparateFields().SelectEvery(4,0,3).Weave().converttoyuy2() ### END SCRIPT ### And here are some before and after screengrabs: Source: Output: Comments, criticism, etc. welcome. Thanks, all |
14th December 2008, 22:14 | #7 | Link | |
Registered User
Join Date: Dec 2007
Posts: 117
|
Quote:
I truly appreciate this forum and the assistance that its experienced users offers to us newbies. |
|
14th December 2008, 22:15 | #8 | Link |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
This is a waste of time:
Code:
Spline36resize(704,470).addborders(8,5,8,5) Code:
Spline36resize(704,480) If you're really anal about aspect ratios, you could use crop(0,60,0,-60) in place of your existing crop - but I reckon the aspect ratio is already wrong by that much, and wouldn't worry about it. Cheers, David. |
14th December 2008, 22:28 | #9 | Link | |
Registered User
Join Date: Dec 2007
Posts: 117
|
Quote:
Thanks for the tip. But isn't there a side-benefit for padding to 720 pixels wide in that you can expose a few pixels which would otherwise be lost to overscan? I dunno, it doesn't make much difference either way, but if you can have it, why not? |
|
14th December 2008, 22:39 | #10 | Link |
Sleepy overworked fellow
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
|
Instead of bobbing and reinterlacing, wouldn't it be simpler to:
-crop the black bars -separatefields() -upscale to half vertical resolution -weave() Also, when upscaling with nnedi, don't forget to correct the registration error caused by edi upscaling. A bit of info here and at around post #71 + around here. Code:
dest_x= dest_y= # half final vertical resolution nnedi(1,true).spline36resize(dest_x,dest_y,0,-0.5,2*a.width+.001,2*a.height+.001)
__________________
AnimeIVTC() - v2.00 -http://boinc.berkeley.edu/- Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p) Last edited by thetoof; 14th December 2008 at 22:56. |
14th December 2008, 22:57 | #11 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
Okay Guitar strings they will twitter every time the strings are near horizontal.
Script should go something like this :- Code:
... MPEG2Source("Path\source.d2v") crop(0,58,-0,-58) # crop off borders: #Bob-deinterlace to 50p/60p ???bob() # pick one ConvertToYUY2() # Do this while progressive! AssumeTFF() Factor=0.5 # Need to derive the correct value for this! E=SelectEven().Spline36resize(712, 240, 0, Factor, 0, 0).AddBorders(4,0,4,0) O=SelectOdd( ).Spline36resize(712, 240, 0, -Factor, 0, 0).AddBorders(4,0,4,0) Interleave(E, O) Weave() I don't have time to derive Factor, maybe one of the other members can do it. It will be the output uncrop scaled to the input size but with no input crop from my Interlaced Resize code. |
15th December 2008, 00:40 | #12 | Link | |
Registered User
Join Date: Dec 2007
Posts: 117
|
Quote:
Thanks IanB. To calculate "FACTOR", should I use the formula you gave for "SHIFT" in this post? Thanks! Last edited by Avisynth_challenged; 15th December 2008 at 00:43. Reason: Correcting dumb newbie reasoning :) |
|
15th December 2008, 00:41 | #13 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Sanity check: want negative crop for top field, and it reduces to -0.5 if output size = input size (when it becomes Bob in reverse). Are you sure the last 0 in the resizes is right? I would expect this to be omitted (ie defaulted to Height()). |
|
15th December 2008, 02:05 | #14 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
I think Gavino has it right, and yes the last 2 zeros in the resize should be gone.
And no, FACTOR and SHIFT, are not the same, here we start with a fully progressive stream so there is no input correction required, there it is a field separated stream so there needs to be an alternating input correction. On output both need the alternating "uncrop". The geometry involved is somewhat tricky. As I said the decision depends a lot on the original source material and your own tastes. If the guitar is seldom horizontal then twitter may not be an issue and the original A method may be preferred. Experiment some! Remember to view the results an an proper interlaced display device, PC screens are crap for working with interlaced streams. |
15th December 2008, 07:00 | #16 | Link |
x264aholic
Join Date: Jul 2007
Location: New York
Posts: 1,752
|
@ajp_anton: The source video isn't supposed to be 4:3. It has a frame size of 704x480, but with 116 pixels of bordering.
__________________
You can't call your encoding speed slow until you start measuring in seconds per frame. |
15th December 2008, 07:08 | #17 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
@ajp_anton,
Yes, the source is 4:3 hard letterboxed and Avisynth_challenged wants to repair it to be proper 16:9 with the best available vertical rescaling. And I can sympathise with him, typically DVD players into 16:9 televisions play this garbage letterboxed+pillarboxed, my player offers a 1.5x zoom which helps slightly (really want a 1.333x zoom). |
15th December 2008, 12:26 | #18 | Link | |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
Quote:
I'm confused why you're now looking at separate field resizing. It would be interesting to see a comparison, but my assumption would be that a good bob (e.g. mcbob, or TempGaussMC_alpha3) would give dramatically better results. Cheers, David. P.S. - the show might be available in HD, which would make a much better source for an anamorphic 16x9 DVD. |
|
15th December 2008, 13:32 | #19 | Link |
Sleepy overworked fellow
Join Date: Feb 2008
Location: Maple syrup's homeland
Posts: 933
|
beta1 has been available for quite a while now...
You could also use TempGaussMC_beta1mod() with an additionnal parameter: mt=true #use multithreaded branch by josey_wells (1.9.7.7) mt=false #use MVTools2 (currently 2.3.0) (default) chroma correction has been disabled for MVTools2 since it has been corrected in MVTools 1.10.2.1
__________________
AnimeIVTC() - v2.00 -http://boinc.berkeley.edu/- Let all geeks use their incredibly powerful comps for the greater good (no, no, it won't slow your filtering/encoding :p) |
15th December 2008, 15:12 | #20 | Link |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
You say that as if I didn't know
http://forum.doom9.org/showthread.ph...79#post1159579 If I had a CPU capable of MT, I'd look again at beta1 to get "nearly as good" quality in a fraction of the time. TBH I (and, I think, WorBry, with very different content) felt that the default settings for beta1 were so obviously worse than alpha3 that there'd be a beta2 along soon to fix it. Cheers, David. Last edited by 2Bdecided; 15th December 2008 at 15:16. |
Thread Tools | Search this Thread |
Display Modes | |
|
|