Log in

View Full Version : IVTC - Again...


Pete_In_Oxford
4th October 2005, 17:28
People -

Some time ago I asked about converting NTSC telecine material to PAL. I got pointed in the direction of the Decomb package, which works wonderfully. But I'm still puzzled by the sound resampling business, and the problem of when to apply de-noising filters. Here's the script I'm using:

# NTSC telecine input

OpenDMLSource("V:\telecine3.2 source.avi").ConvertToYUY2(interlaced=true)

# Tidy up the video quality before we muck about with the picture
# to make it PAL instead of NTSC.

# Deal with somewhat "shifted" Chroma...

Chromashift(c=-6,L=-3)

# Try FFT denoise/sharpening, all 3 planes...

FFT3DFilter(sigma=2, sharpen=0.4, plane=0, interlaced=true)
FFT3DFilter(sigma=5, sharpen=0.1, plane=1, interlaced=true)
FFT3DFilter(sigma=5, sharpen=0.1, plane=2, interlaced=true)

# Blacken out "flag-waving" at top and bottom of frame

Letterbox(0,11,6,10)

# Deal with 3:2 telecine and drop dups leaving 24fps(?)

Telecide(order=0,guide=1,post=2,vthresh=30,show=false)

Decimate()

# 4% speed up for PAL

AssumeFPS(25)
Weave()

# Sort out the sound. But how ???

-- Essentially I'm not sure when best to apply the FFT denoiser (before/after IVTC - after should be better as fewer frames to process, shouldn't it?) Also there's a function somewhere which averages the duplicated frames for better S/N ratio - is this easy to get/use?

And what on earth does one do with the audio? I tried the following segment from the ResampleAudio page and got an "Invalid Argument" error message:

# Exact 4% speed up for Pal telecine
Global Nfr_num=25
Global Nfr_den=1
Ar=Audiorate()
ResampleAudio(Ar*FramerateNumerator()*Nfr_den, FramerateDenominator()*Nfr_num)
AssumeSampleRate(Ar)
AssumeFPS(Nfr_num, Nfr_den, False)

As Avisynth tells me nothing about what the invalid argument actually was, I'm no better off! In fact that's part of a general moan/suggestion: could the error messages not be more consistently helpful, if you see what I mean? If resampleAudio kicked out with:

* Here's what I don't like about the rate you provided
* Here is the rate you provided
* Here's what I think the current Audio sample rate is

... I'd be much better off.

Any help would be very gratefully received!

Cheers,

Pete.

Guest
4th October 2005, 19:24
IVTC will give you 23.976fps, not 24fps.

If your final output is intended to be MPEG2, e.g., a DVD, you might consider just reflagging it using DGPulldown, 23.976->25fps. That way you do not even have to touch the audio.

This will work only if the source was pure 3:2 pulled down progressive.

[As a Cantabrigian, I really shouldn't help you, but you sound like a fine chap. :)]

Mug Funky
5th October 2005, 02:10
you could skip the assumesamplerate stage by changing "assumefps(25)" to "assumefps(25,true)", as this will chage the samplerate to exactly keep up with the framerate.

not touching the sound like DG says is a good idea if you're working from an already lossy source - lossy->lossy audio transcoding is IMHO more destructive than lossy->lossy video transcoding, due to the way audio codecs exploit human hearing to squeeze out more compression. paradoxically the more clever and efficient the audio codec, the worse the transcoded quality will be. this is sort of why (high bitrate - 256+) mp2 or DTS transcodes well - because they don't make full use of human hearing's shortcomings and tend to contain more info than they need.

of course, if your source is really old video where the sound is lo-fi to begin with, you can get away with transcoding and making the video smoother.

sorry for the rambling - i'm a massive geek with both audio and video :)

Pete_In_Oxford
5th October 2005, 05:05
Yeo Ho Ho! Sound in sync! (using the AssumeFPS(25,True) trick). Well done those men :-)

So far so excellent. Now to the other bits and pieces, if I may. The source is indeed VHS video (via a Canopus ADVC100 to DV), and (oddly) so is the target (hence the interest in getting to 50i). I don't plan on mucking about with the audio separately as, well, life's too short. The final audience is unlikely to be critical of the audio; my self-respect won't let me hand out a noisy picture :-)

But there's the business of averaging the multiple frames in IVTC processing - can anyone provide a pointer (I've lost it - in other contexts too...)? It might help the FFT transform a bit. And (sorry to be a nag!) where is the FFT denoiser best put? Will

Source-> FFT denoise (i/laced) -> Telecide -> Decimate -> AdjFPS -> Target

work any better than

Source -> Clever Telecide/Decimate with averaging -> FFT denoise -> ADJFps ->Target ?

I can see that the latter _should_ be quite a lot faster (fewer frames for FFT to denoise, and less noise in the first place). But would welcome advice.

[A Cantabrigian, eh? The one near Boston or the windy one in the Fens?]

Again, heartfelt thanks for your help!

Cheers,

Pete.

Guest
5th October 2005, 05:21
But there's the business of averaging the multiple frames in IVTC processing - can anyone provide a pointer (I've lost it - in other contexts too...)? I don't think it's worth the bother. It will help only one frame out of four anyway, which could cause a strobing effect.

A Cantabrigian, eh? The one near Boston or the windy one in the Fens? The one on the river Cam, approximately between Mill Pond and Jesus Lock.

Pete_In_Oxford
5th October 2005, 06:00
Ah, OK. Fair enough. That just leaves the question of where to stick FFTDenoising - before or after the decimation. I'll give it a try and see (bet I can't tell the difference visually) ... [later] and he's right, no visible difference but doing the denoise after decimation is lots faster.

That's brilliant, people, thanks a million!

Pete.

[The one in the Fens, eh? Nothing ever changes - I was there a month or two ago and the lamppost in the middle of Parker's Piece _still_ says "Reality Checkpoint" on it!]