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 19th December 2011, 08:55   #1  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
576i upscaled to 720p - How to sharpen for YouTube?

I am upscaling PAL DV (720x576-50i) to 982x720-25p for YouTube (and maybe for Blu-ray).

Here is a second of (graded) PAL DV source.

I'm framserving in RGB24 from Sony Vegas, then using this basic script:

Code:
AviSource("d:\fs.avi")
AssumeBFF()
ConvertToYV12(interlaced=true, matrix="PC.709")
QTGMC( FPSDivisor=2, EdiThreads=2 )
NNEDI3_rpow2(rfactor=2, cshift="spline36resize", fwidth=982, fheight=720)
Here is the same video after that processing (in uncompressed RGB).

And here is a screenshot:



It needs some sharpening, but I have little experience in this area. I know that too much sharpening can cause problems with compressing, in particular as my main target is YouTube. I tried adding the following line to my script:

Code:
LSFmod(defaults="slow",strength=500)
And here is the result on YouTube (watch in 720p!!), along with some typical underwater footage that I need to process. It looks OK but:

- Is LSFmod a sensible way to sharpen upscaled footage such as this?
- In your opinions is it too much or too little sharpening?
- Any suggestions for other ways to sharpen this?
- Am I gaining much by using LSFmod over, say sharpen(0.75,0.75)

Thanks!
nhope is offline   Reply With Quote
Old 19th December 2011, 09:10   #2  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,620
Youtube always reencodes, and the upscaling will be even more visible. And anyway, who wants quality does not use youtube, instead file-exchange servers, like (no advertisment here ) rapidshare, megaupload, fileserve etc.
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 19th December 2011, 09:15   #3  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
Thanks, but YouTube pay me, file-exchange servers don't, and I like my videos to reach the widest audience possible.

Anyone have an opinion on the sharpening?
nhope is offline   Reply With Quote
Old 19th December 2011, 09:28   #4  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
First of all, the footage is too bright. Blackpoint seems to be at 30~32 RGB, which is too high. Depending on the RGB<>YUV conversion standard, this is either 16 points too high ("Studio RGB"), or 32 points too high (sRGB).
With levels corrected, you'll find the footage has more overall contrast, and less need for sharpening. (Perhaps it could be sharpened a 'lil bit, but then, it would be beneficial if the already-present "edge-enhancement" (dark halos beneath bright features) would be removed prior to that.)
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 19th December 2011, 09:56   #5  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
Thank you Didée.

Quote:
Originally Posted by Didée View Post
First of all, the footage is too bright. Blackpoint seems to be at 30~32 RGB, which is too high. Depending on the RGB<>YUV conversion standard, this is either 16 points too high ("Studio RGB"), or 32 points too high (sRGB).
Do you say this based on the screenshot, or the original DV, or the upscaled avi, or the YouTube video (or all 4)?

For the streetseller, the footage is more or less what came out of my Sony VX2000 on auto-exposure. After clipping to 16-235 with a curve, my histogram in Sony Vegas Pro looks like this:



I suppose the part below 32 may be mostly noise, but to me the levels look pretty good once the Adobe Flash Player has mapped them out to 0-255 on the YouTube page. There are no true blacks here anyway.

Quote:
With levels corrected, you'll find the footage has more overall contrast, and less need for sharpening. (Perhaps it could be sharpened a 'lil bit, but then, it would be beneficial if the already-present "edge-enhancement" (dark halos beneath bright features) would be removed prior to that.)
How would you recommend I do that? Perhaps a different resizing kernel in the NNEDI_rpow2 function, instead of Spline36? Ot is there a filter that can do it?

To me, the video with the LSFmod sharpening looks vastly superior to that without, before sending to YouTube.
nhope is offline   Reply With Quote
Old 19th December 2011, 12:47   #6  |  Link
markanini
Registered User
 
Join Date: Apr 2006
Posts: 296
I had a look at the screenshot through 2.4 pure gamma calibrated 3DLUT and I agree a 32 black point looks more like intended. Keep in mind due to the sharpening inherent to the source, levels will exist outside of 32-235. Doing processing before mapping to 0-255 will make for a higher quality end result though, especially with some mt_convolution magic.

EDIT: So you plan to recieve payment for this footage? A free download link to those that helped would be in order :P
I'll have to remind myself about the board rules...

Last edited by markanini; 19th December 2011 at 13:02.
markanini is offline   Reply With Quote
Old 19th December 2011, 14:18   #7  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
Thank you markanini.

Quote:
Originally Posted by markanini View Post
I had a look at the screenshot through 2.4 pure gamma calibrated 3DLUT and I agree a 32 black point looks more like intended. Keep in mind due to the sharpening inherent to the source, levels will exist outside of 32-235.
*kicks self for presenting an ambiguous example*

Quote:
Doing processing before mapping to 0-255 will make for a higher quality end result though, especially with some mt_convolution magic.
I am rather lost with mt_convolution. I just tried DeHalo_alpha at default settings, right before the LSFmod, and it did reduce the halos while softening the footage.

Quote:
EDIT: So you plan to recieve payment for this footage? A free download link to those that helped would be in order :P
I'll have to remind myself about the board rules...
I'm a YouTube partner so I receive a share of the revenue received when viewers click ads on or around my videos. Is this a strictly amateur forum? I didn't see anything on the board rules that forbids me participating. Only that spamming and advertising is forbidden. I am very happy indeed to credit those that help. What exactly do you mean by a "free download link"?
nhope is offline   Reply With Quote
Old 19th December 2011, 14:41   #8  |  Link
markanini
Registered User
 
Join Date: Apr 2006
Posts: 296
Quote:
*kicks self for presenting an ambiguous example*
Don't worry about it, we're here to learn. I believe Didée was right(when is he not?) about 32 black point being correct. Now, It might look better in some ways with a 16 blackpoint, depending on your monitor settings. I think the reason is high contrast and saturation pre-applied by the camera. Check if it's possible to adjust these in the camera for future projects. Same goes for sharpening.

If it was my project besides sticking with 32 black point I'd reduce contrast and saturation with Smootlevels, just before mapping to 0-255. Hang on I'll post an example just for fun.

Quote:
I am rather lost with mt_convolution. I just tried DeHalo_alpha at default settings, right before the LSFmod, and it did reduce the halos while softening the footage.
Nothing beats mt_convolution for quality. Maybe someone will come along with some advice on parateter to use. It's certainly has a learning curve. Wish I could help with this one but I havent sunk my teeth into mt_convolution yet.

Quote:
I'm a YouTube partner so I receive a share of the revenue received when viewers click ads on or around my videos. Is this a strictly amateur forum? I didn't see anything on the board rules that forbids me participating. Only that spamming and advertising is forbidden. I am very happy indeed to credit those that help. What exactly do you mean by a "free download link"?
You're right, while a majority are amateur it's not a strictly amateur forum and discussing commercial projects hasn't been disallowed as far as I can recall. Sorry about the confusion. Free download link or not is up to you, it was a tongue-in-cheek comment.

Last edited by markanini; 19th December 2011 at 14:56.
markanini is offline   Reply With Quote
Old 19th December 2011, 15:09   #9  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
Quote:
Originally Posted by markanini View Post
If it was my project besides sticking with 32 black point I'd reduce contrast and saturation with Smootlevels, just before mapping to 0-255.
A little bit of confusion here. I don't want to map to 0-255. I send YouTube 16-235 x264 files. The Adobe Flash Player maps it out to 0-255 during playback (for the vast majority of playback scenarios). If I send YouTube x264 at 0-255, everything outside of 16-235 gets clipped, just like in the broadcast/DVD/TV world. Example.

Quote:
Free download link or not is up to you, it was a tongue-in-cheek comment.
Well, it's YouTube, so it's all free to view anyway. Maybe I should send a free DVD to whoever nails the mt_convolution settings

The majority of my footage is underwater, so haloing is generally not as severe as it is on that streetseller.
nhope is offline   Reply With Quote
Old 19th December 2011, 16:13   #10  |  Link
markanini
Registered User
 
Join Date: Apr 2006
Posts: 296
My bad, I already played a bit with your screenshot:

SmoothLevels(input_low=32,output_low=235,chroma=150,TVrange=false,Lmode=1,darkSTR=50,brightSTR=50)
My point was that you could abuse the Chroma and Lmode settings to reduce the somewhat excessive contrast and saturation in a quick and dirty way.

Obviously underwater footage has different concerns. I remember some VirtualDub plugin examples that looked fantastic. I'll try to remember what that was and come back to you.
markanini is offline   Reply With Quote
Old 19th December 2011, 16:25   #11  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
Perhaps yes, perhaps no ... main interest = halo removal, sharpening not seriously considered:



Code:
# removegrain.dll
# medianblur.dll
# mt_masktools.dll

avisource("982x720-QTGMC-NNEDI-Spline36.avi")
pointresize(984,720,0,0,984,720) # need mod4 ...
converttoyv12( matrix="PC.601" ) # ... for YV12
o=last

small = o.bicubicresize(984-96,432,-.4,.2)
o.mt_makediff(mt_makediff(small,small.removegrain(20).removegrain(11)).bicubicresize(984,720),U=2,V=2)
o.repair(last,13)
o.repair(last,13)
xx=removegrain(11)
last.merge(last.sbr(),0.751).mt_adddiff(mt_makediff(xx,xx.minblur(3)),U=2,V=2)
last.mt_lutxy(o,"x y < x 1 + x y > x 1 - x ? ?",U=2,V=2)
smoothlevels(30,1.0,240,16,235)
interleave(o,last)

return(last)


#=====# Helper Functions #=====#

function sbr(clip o) 
{
rg11=o.removegrain(11)
rg11D=mt_makediff(o,rg11)
rg11DD=mt_makediff(rg11D,rg11D.removegrain(11)).mt_lutxy(rg11D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?")
o.mt_makediff(rg11DD,U=2,V=2) 
}

function MinBlur(clip clp, int r, int "uv")
{
uv   = default(uv,3)
uv2  = (uv==2) ? 1 : uv
rg4  = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200

RG11D = (r==0) ? mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
 \    : (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
 \    : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
 \    :          mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D  = (r<=1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2)
 \    : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U=uv2,V=uv2)
 \    :          mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U=uv2,V=uv2)
DD    = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 19th December 2011, 20:32   #12  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
That's looking pretty good Didée. It seems to remove halos just a little bit more than DeHalo_alpha(). What do you reckon to LSFmod(defaults="slow",strength=500) after this? Too strong? Admittedly this girl is starting to send me blind.
nhope is offline   Reply With Quote
Old 20th December 2011, 09:05   #13  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,248
My own opinion is that the more you sharpen the poorer the quality and the more artifact-ridden it'll be after YouTube gets done with it. They don't do any quality-based encodes, but just bitrate encodes based entirely on the final height (360p, 480p, 720p, etc.) and use bitrates most of us here consider way too low. An LSFmod strength of 500 is pretty high. Maybe make two encodes and 2 uploads, one with a 500 strength and one without any sharpening, or maybe with a strength of 100. Then compare the results. You may (or may not) decide the softer one looks better overall.
manono is offline   Reply With Quote
Old 20th December 2011, 15:31   #14  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
...and even more controversially, you might find the version with halos looks far better on the 240p/360p/480p downscales that your new version without.

Are the stats for how many people use each resolution (when a choice is available) published anywhere?

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 20th December 2011, 15:57   #15  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
I haven't seen such stats David, but I suspect far more people would watch the lower resolution versions, for now. As far as I know, you still even have to manually change your YouTube settings if you want videos to default to HD at full screen. Just tried it on my girlfriend's account and it was staying at 480p despite choosing full screen.

As most of my footage doesn't exhibit as much haloing as the streetseller clip, I've tried dropping the dehaloing routine completely, switching from spline36 to bicubic (in an attempt not to make the haloing worse), and used a moderate LSFmod strength of 200.

Code:
AviSource("d:\fs.avi")
AssumeBFF()
ConvertToYV12(interlaced=true, matrix="PC.709")
QTGMC( FPSDivisor=2 )
NNEDI3_rpow2(rfactor=2, cshift="bicubicresize", fwidth=984, fheight=720)
LSFmod(strength=200)
I've uploaded another video here containing a typical mix of my DV footage upscaled this way. I would welcome any opinions or suggestions on it regarding deinterlacing/resizing/halos/sharpening.

I'm not too sure about Adobe Flash Player's upscaling. My offline media players seem to be better at it.
nhope is offline   Reply With Quote
Old 20th December 2011, 16:21   #16  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,830
Quote:
Originally Posted by nhope View Post
As far as I know, you still even have to manually change your YouTube settings if you want videos to default to HD at full screen. Just tried it on my girlfriend's account and it was staying at 480p despite choosing full screen.
Not true

http://www.youtube.com/v/nhWBCoMzva8&hd=1

Some old YT tips & tricks guides (some might be outdated)

http://www.techairlines.com/2010/08/...be-url-tricks/
poisondeathray is offline   Reply With Quote
Old 20th December 2011, 16:51   #17  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 1,008
Quote:
Originally Posted by nhope View Post
I've uploaded another video here containing a typical mix of my DV footage upscaled this way. I would welcome any opinions or suggestions on it regarding deinterlacing/resizing/halos/sharpening.
I can give you some tips I gathered from observation on own experience.

I wouldn't do a nnedi3 upsize after QTGMC deinterlace. It adds a too "antialiased" look (nnedi3 twice). You can either use a different resizer or try the lossless/sourcematch feature of QTGMC although by doing the latter your script would get really slow.

Since footage is mostly underwater I think it would benefit from the dither tools in order to help soothe quantization banding, and upload an already h.264 encoded file rather than lossless file, although I doubt you did this. By some reason at low quality encodes it seems to retain more quality a h.264HQ->h.264LQ than lossless->h.264LQ.

I would do most of the sharpening inside QTGMC too
Dogway is offline   Reply With Quote
Old 20th December 2011, 17:16   #18  |  Link
nhope
partially-informed layman
 
Join Date: Jan 2002
Location: Bangkok, Thailand
Posts: 309
Thanks for the replies.

Quote:
Originally Posted by poisondeathray View Post
Not true
I think you may have misread my message, or I wasn't clear enough. I meant the default resolution when someone clicks the full screen symbol at the bottom right of a video. It appears to be controlled by this YouTube setting, which is off by default:



Of course if you have great bandwidth and are in a more developed part of the world, you may well get HD anyway at full screen. Here in Thailand we were getting 480p at full screen until checking that box. By the way the link you gave me was for a YouTube video to fill the browser, not the screen.

Quote:
Originally Posted by Dogway View Post
I wouldn't do a nnedi3 upsize after QTGMC deinterlace. It adds a too "antialiased" look (nnedi3 twice). You can either use a different resizer or try the lossless/sourcematch feature of QTGMC although by doing the latter your script would get really slow... ...I would do most of the sharpening inside QTGMC too
I take your point about 2 x NNEDI3. Aren't lossless/sourcematch/sharpening going to be rather wasted in QTGMC because that detail would be somewhat lost in the subsequent upscale from 720x576 to 984x720? I thought I should be doing sharpening after upscaling?

Quote:
Since footage is mostly underwater I think it would benefit from the dither tools in order to help soothe quantization banding, and upload an already h.264 encoded file rather than lossless file, although I doubt you did this. By some reason at low quality encodes it seems to retain more quality a h.264HQ->h.264LQ than lossless->h.264LQ.
Actually I did upload a crf18 x264 file (I put the upscaled UT-video clip back on my timeline to add the text, then rendered out in MeGUI). What dither tools do you mean?
nhope is offline   Reply With Quote
Old 22nd December 2011, 21:37   #19  |  Link
SSH4
Registered User
 
Join Date: Nov 2006
Posts: 90
Try eedi3_rpow2 on some source i have better upscale result than last nnedi3. After nnedi3 edges looks a little bit plastic

Last edited by SSH4; 22nd December 2011 at 21:40.
SSH4 is offline   Reply With Quote
Reply

Tags
lsfmod, qtgmc, sharpen, sharpening, 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 04:21.


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