Friday, December 31, 2010

New AviSynth Revelations; better colors, louder audio

Capturing South Park episodes across the two half-seasons, I wondered why my older caps had "true blacks" and deeper colors, while my newer caps had slightly washed-out colors. I forgot what I did before (I used to think it was because I used DirectShowSource instead of AviSource), but after a lot of searching, all I needed to do was add this:
ColorYUV(levels="TV->PC")
Also, I noticed the low volume of my PSP captures (and pretty much everything else running from the DVDO Edge to the HDfury3 to the Intensity Pro via stereo), and after looking for an easy, consistent way to boost the volume across the videos I already made, it came back to good ol' AviSynth:
AmplifydB(7)
I'm still on the fence about amplifying the volume for TV caps; in my experience, the same PC vids played on a TV are louder, so it's safer for the volume to be "too soft" rather than "too loud." However, video games and even VHS transfers could probably use a boost. I'll still use Audacity and/or Xvid4PSP to come up with a reasonable Amplify volume boost first, then just edit the line in directly in AviSynth.

It's also worth noting that for another one of my video game projects, the intro to a game was much louder than the actual gameplay, so I had to highlight and amplify those parts separately. And of course, the sequels had their own volume differences so I had to do the same thing there. That video also turned out great.

So to summarize, my basic AviSynth script (using PSP gameplay caps, resized & cropped) looks like this:
#Echoshift - A7 Cast
#PSP-DVDOEdge-HDfury3

DirectShowSource("H:\Untitled 7.avi")
ColorYUV(levels="TV->PC")
AmplifydB(7)
ChangeFPS(59.940)
Crop(6,6,-14,-8)
Lanczos4Resize(848,480)
Trim(2683,4643)++Trim(4905,7579)

12 comments:

  1. Oh, it seems you've actually been using AVISynth for a while. (I assumed you were a novice, forgive me - I really must stop making stupid assumptions like that).

    It's good that it all worked out for you.

    I do have a question for you, since you seem to be experienced in capturing tech: which would be best for ripping a VHS? I have one I need to get and clean up for a history professor. I suppose I could do it with an existing VCR and Pinnacle Dazzle HD capture device, but I'm a bit afraid of something going wrong during capture and forcing me to restart, thus lessening the quality of the VHS I have to work with.

    ReplyDelete
  2. Whoa! Sorry about the... er, three month-late reply. I never expect comments, you see.

    For the absolute best quality, you might want to get a VCR with TBC. I'm looking into a Panasonic AG 1980, myself.

    The Intensity Pro can capture VHS tapes OK on a standard VCR, but when the picture gets messy, the Intensity Pro blacks out the picture, which could easily cause audio sync problems.

    My lower-end Winfast capture card can capture noisy tapes from beginning to end, but you'll only find out that there's sync problems when you actually play it back.

    ReplyDelete
  3. Hopefully you checked out what the black/white levels are with Histogram() first before blindly applying TV->PC. (Surely you did. Right?)

    ReplyDelete
  4. Histogram() will tell you what the current black/white min/max are. (See Image:Histogram_classic.jpg... note how the white pixels on the right *essentially* fit within the brown vertical bars. This is desired.) You can plug corrections into Levels() to stretch the min/max to the proper 16-235 range. (Media players typically do a final TV->PC conversion when displaying the video, which is why TV's 16-235 is desirable.)

    From the Levels() wiki page:
    # scales a [16,235] clip to [0,255]:
    Levels(16, 1, 235, 0, 255, coring=false) # this is the same as ColorYUV(levels="TV->PC")
    ^ can be used to give you a decent idea of what the parameters do.

    Of course, a TV->PC conversion *could* be *exactly* what you need, but I just wanted to make sure that you knew that doing TV->PC without checking if it's correct could cut off too much or too little low/high blacks/whites.

    Plus this stuff is good to know for when broadcasters air things with noticeably wrong black levels.

    Hopefully this is at least somewhat clear and relevant. ^_^

    ReplyDelete
  5. And of course you should make sure you're looking at frames with solid black and/or white when trying to determine the min/max. :)

    ReplyDelete
  6. I made a large comment.. where did it go.. >_<

    ReplyDelete
  7. I didn't do nothin'! Sorry...

    And thanks for that other Cartoon Network post. I dunno how to get email notifications for new comments. It's a miracle I even checked *this* thread today!

    ReplyDelete
  8. Damn Blogspot..

    Anyways, I really hate that the following doesn't sound nearly as good as what I originally wanted to say, but here's my attempt at recreating the comment:

    Histogram() will tell you the min/max black/white levels. (See Image:Histogram.jpg for an example.) The white pixels should *essentially* fit within the brown bars. The black space within the brown bars represents the valid 16-235 TV range of brightness. (You'll need to check various places in the video in order to find the blackest/whitest-possible blacks/whites.) Media players typically/always scale this 16-235 range to the 0-255 PC scale when displaying video which is why the TV range is desirable.

    You can use Levels() with various parameters to stretch the min/max black/white levels to the proper 16-235 range.

    From the Levels() wiki page:
    # scales a [16,235] clip to [0,255]:
    Levels(16, 1, 235, 0, 255, coring=false) # this is the same as ColorYUV(levels="TV->PC")
    ^ should give you a good idea of the parameters

    Of course, it's *definitely* possible that a TV->PC conversion is *exactly* what you need. There's just no way to really tell without actually checking.

    Hopefully that both makes sense and is relevant.

    ReplyDelete
  9. Since my reattempt at commenting disappeared after Blogspot said it was "published", I have a feeling that it's been caught by the spam filter since I included a few URLs. So you might want to check the blog's spam inbox.

    ReplyDelete
  10. So I finally tried this out, and Histogram is telling me I've been doing it wrong all this time. But then why do I prefer the colors with ColorYUV(levels="TV->PC") ? The videos I make look fine on a TV through my PS3 too... *shrug*

    ReplyDelete
  11. Scratch that, I'll just use this from now on:

    Levels(0, 1, 255, 0, 255)

    Can't help but wonder if my video encoder does stuff to the video as well, but that's a whole 'nother can of bees.

    ReplyDelete