View Full Version : NTSC->PAL Try This
Xesdeeni
7th January 2004, 22:02
I can't view PAL directly, so I'm hoping that someone playing with NTSC to PAL conversions can take a look at the results of this script on high motion video (maybe sports) and see if it's horrible or not. This is for NTSC video (i.e. interlaced content), not film:# NTSC input
AVISource("LiveTest.avi")
# Bug workaround for SmoothDeinterlacer
SeparateFields()
Weave()
# Convert to 59.94 progressive fps
SmoothDeinterlace(doublerate=true)
# Convert to 120 progressive fps using duplication. One frame every
# 500 is duplicated twice to make up the fraction from 59.94, but
# the majority of the stream is just frame pairs.
ChangeFPS(120)
# Create second stream by trimming the first frame. The creates
# streams that look like:
# 00112233445566778899...
# 0112233445566778899...
second = last.Trim(1,0)
# Sum the two streams, creating a sequence of frames where every
# other one is a single frame and the others are 50:50 from two:
# 0 0&1 1 1&2 2 2&3 3 3&4 4 4&5 5 5&6 6 6&7 7 7&8 8 8&9 9...
Layer(second,op="fast",use_chroma=true)
# Select 5 frames out of every 12 to get to 50 progressive fps. The
# choice is one interpolated and four non-interpolated frames.
SelectEvery(12,0,2,5,8,10)
# Obligatory resize to PAL resolution
LanczosResize(720,576)
# Convert back to an interlaced output by taking even lines from one
# frame and odd lines from another. Normally (4,1,2) works for DVDs
# (top field first) while (4,0,3) works for DV (bottom field first).
SeparateFields()
SelectEvery(4,1,2)
Weave()Any feedback greatly appreciated.
Xesdeeni
Mug Funky
8th January 2004, 14:34
this looks interesting.. i've just tried out scharfis_brain's hybrid NTSC > PAL script. you might want to take a look at that
i haven't got the CPU time available to try this out just yet, but i'll give it a shot when i can. if the motion is smooth enough from this as opposed to convertfps, then i'll try and whack this into scharfis script to help kill blends
scharfis_brain
9th January 2004, 02:01
Nice work
...but
Without doing tests on that script I will anticipate that the result is much more jerky than the simple convertfps-solution.
reasons:
- You are only having Fractional and half fractional(blends of neighbors) Frames to put into the resulting 50 fps-stream, while convertfps is doing a weighted blending of nearby frames to simulate the time between two Framesto achieve a smoother motion
- your 5 out of 12 selection isn't blanaced:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# # # # # # # # # #
the blanaced one would look like this:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# # # # # # # # # #
your selectevery(12,...) can be easily replaced by changefps(50), because it uses exactly the same pattern, like the blanced selection.
btw. on NTSC -> PAL conversion you can choose between 3 types of framerate-conversions:
1) Jerky, but crisp and blendfree:
bobber().changefps(50)
2) less jerky, but introduces blending:
bobber().convertfps(50)
3) even more reduced jerkyness, but introduced motionblur:
bobber()
layer(last.trim(1,0),last,"fast").convertfps(50)
Xesdeeni
9th January 2004, 15:53
Originally posted by scharfis_brain
Without doing tests on that script I will anticipate that the result is much more jerky than the simple convertfps-solution.
reasons:
- You are only having Fractional and half fractional(blends of neighbors) Frames to put into the resulting 50 fps-stream, while convertfps is doing a weighted blending of nearby frames to simulate the time between two Framesto achieve a smoother motionWell, every conversion has its drawbacks. I find the interpolated frames of ConvertFPS() much more annoying than the "jerk" of ChangeFPS(). But I'm trying with this script to improve the ConvertFPS() version.
Since you are normally converting from 59.94 fps to 50 fps, there is always an interpolation of frames, due to the constant fractional differences. The professional "4-field" converters don't have interpolation on every frame. I don't know exactly how they do what they do, but I suspect they don't deal with the fractional portion all the time. Instead, they probably convert from 60 fps to 50 fps and deal with the drift elsewhere.
When you do 60->50, you can choose to get two solid, non-interpolated frames every group of 6 (source; 5 destination):0 1 2 3 4 5 6 7 8 9 A B...
0 a b c 4 5 a b c 9...The interesting part is what you do with the three other destination frames.
For purposes of this test, I chose to map 'a' and 'c' to the nearest input frame and interpolate only b. But I can't tell what this will look like without a PAL TV, so I'm asking someone to take a look.
- your 5 out of 12 selection isn't blanaced:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# # # # # # # # # #
the blanaced one would look like this:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# # # # # # # # # # It's not meant to be balance. It's meant to pick out the specific frames mentioned above.your selectevery(12,...) can be easily replaced by changefps(50), because it uses exactly the same pattern, like the blanced selection.No. Because the input is a fraction, ChangeFPS() will always interpolate (well, every 1000 frames it will not). If I did an AssumeFPS(60) before the ConvertFPS(50), then the pattern would be similar to what I outlined above, except that there would be three interpolated frames out of every five (actually, I'd have to look closer at ConvertFPS(), it's possible that all the frames would be interpolated, depending on how they do the math, since each PAL frame represents the time of one full NTSC frame plus a fraction of another.) But if I used AssumeFPS(60), I'd then have to figure out how to deal with the 1 in every 1000 frame sync error. This error is in the input, and in the output would be 3 frames every 2500. More importantly, to fix it, I'd have to drop frames in the output, which would potentially drop needed information and be visible as a "jerk" every 16 2/3 seconds.btw. on NTSC -> PAL conversion you can choose between 3 types of framerate-conversions:
1) Jerky, but crisp and blendfree:
bobber().changefps(50)
2) less jerky, but introduces blending:
bobber().convertfps(50)
3) even more reduced jerkyness, but introduced motionblur:
bobber()
layer(last.trim(1,0),last,"fast").convertfps(50)What the heck is "bobber?"
Xesdeeni
scharfis_brain
10th January 2004, 01:16
Ah. Now I understand, what you wanna do!
We really need something like this:
[dreaming mode on]
convertfps(newfps,blend-threshold)
newfps -> this value should be known, hehe
threshold -> only blend two frames together, when the weight of the lower weighted frame is higher than the threshold.
example:
the new frame is between two frames of the input stream and their weights are:
20% and 80%, if I set the threshold to 30%, only the 2nd frame will be in the output.
If I choose a threshold of zero, the output-frame will be a 20:80 - blend of its neighbors.
If you set this imaginary threshold to 45%, only those frames are getting blended, whose temporal position is close to the middle of its neighbors, all other frames are just copies of their nearest neighbors (like changefps does)
this woulkd probably solve your problem.
[dreaming mode off]
btw: the 59,94 vs. 60 difference is IMO not that important.
(it is only a deviance of one frames in 1000.)
all standalone-converters are doing their conversion directly from 59,94 to 50 with weighted blending like convertfps, but some converters seem to use a threshold of 0 (nearly all frames contain blends) of even thresholds up to 30%.
well I'll try your script next time I am sitting in front of a faster machine.
bobber() is a placeholder for any fullframerate-deinterlace you like: bob, dgbob, ibob, kernelbob
btw: I am a smoothness-freak, I extremely dislike jerkyness
Xesdeeni
12th January 2004, 15:57
Originally posted by scharfis_brain btw: I am a smoothness-freak, I extremely dislike jerkynessI'm not a big fan of jerks myself ;-) Oh, you mean in video :-)
For myself, I find that the strobing and backwards motion effect of the interpolation method is much more annoying than the slight hitch in replication. That's why I wanted to try the scipt above. It minimizes the interpolation, but doesn't go all the way to replication.
Xesdeeni
Letricheur
13th January 2004, 02:09
@Xsdeenie
As an aside, could you suggest a script for PAL DV to 23.976 interlaced DV using this type of method? I tried the script in the readme file of smoothdeinterlacer but could never get rid of the jerkiness, despite endless permutations of tff=false, SeparateFields(), Weave() at the beginning, AssumeBFF(), etc. I plan to put the resulting DV file into CCE, then run pulldown and correct the field order to BFF, then make a DVD for TV (NTSC) viewing. I can tolerate motion blurring but not jerkiness.
Much apreciated.
Xesdeeni
13th January 2004, 02:48
Originally posted by Letricheur@Xsdeenie
As an aside, could you suggest a script for PAL DV to 23.976 interlaced DV using this type of method? I tried the script in the readme file of smoothdeinterlacer but could never get rid of the jerkiness, despite endless permutations of tff=false, SeparateFields(), Weave() at the beginning, AssumeBFF(), etc. I plan to put the resulting DV file into CCE, then run pulldown and correct the field order to BFF, then make a DVD for TV (NTSC) viewing. I can tolerate motion blurring but not jerkiness.
Much apreciated.There really isn't such a thing as 23.976 Fps interlaced DV. DV must always be 29.97 interlaced fps. For films, this means the dreaded 3:2 pulldown, a.k.a. telecine.
I'm making a big assumption here, that your source material is a 25 Fps progressive film that you captured via PAL DV. If that's the case, then there is no need for SmoothDeinterlacer at all. Here is what I recommend:
1. Start with the following AVISynth script:AVISource("PAL-25Fps-DV.avi")
2. Load the AVISynth script into VirtualDub and step through it. If you see no interlacing, proceed to step 4. If you do see interlacing when there is motion, modify the script to the following:AVISource("PAL-25Fps-DV.avi")
SeparateFields()
Trim(1,0)
Weave()3. Try again with VirtualDub. If you still see interlacing, let me know, because we'll have to do a further analysis of your video...it's "special."
At this point, you can take one of three directions. You can slow the video to 23.976 and use telecine to convert to NTSC, you can just telecine the 25 fps and leave the audio alone, or you can interpolate frames (and also leave the audio alone). If you are really sensitive to jerkiness, you might prefer the first (although all film is telecined, and isn't too much better than the second). I personally prefer the second (and have used it several times), and I think the last will look the worst. But I highly recommend you try all three and see what you think...and please let us know:
SLOW DOWN (cont. from 3)
4. Add the following to your script (note that this handles the audio slow down as well):AssumeFPS(23.976, true)
ResampleAudio(48000)
SeparateFields()
SelectEvery(4,0,1,0,3,2) # or SelectEvery(4,1,0,1,2,3)
Weave()
TELECINE (cont. from 3)
4. Add the following to your script:ChangeFPS(59.94)
SeparateFields()
SelectEvery(4,0,3) # or SelectEvery(4,1,2)
Weave()
INTERPLATE (cont. from 3)
4. Add the following to your script:ChangeFPS(50) # ConvertFPS() can't go from 25 to 59.94
ConvertFPS(59.94)
SeparateFields()
SelectEvery(4,0,3) # or SelectEvery(4,1,2)
Weave()
5. Load the script into VirtualDub and save out the file using the DV codec. Double-check the polarity on a test clip by viewing it on your TV (you can't view with your PC to check this polarity). If it's wrong (things dance back and forth when they move, but look OK when they are still), try the alternate version of SelectEvery() above.
Let me know which one you like best.
Xesdeeni
Letricheur
13th January 2004, 05:53
@Xesdeeni
Thanks for the quick and detailed reply. I'm sorry but I wasn't really clear about the source. It is PAL analogue video (camcorder), captured through Dazzle Hollywood Bridge as PAL DV, so interlaced from the start. This is clear in VirtualDub, including using this script:
AVISource("PAL-25Fps-DV.avi")
SeparateFields()
Trim(1,0)
Weave()
Does this change the scripts you suggested?
Also, AssumeFPS will slow down the audio but won't the pitch change by 4%?
Xesdeeni
13th January 2004, 16:11
Originally posted by Letricheur
I'm sorry but I wasn't really clear about the source. It is PAL analogue video (camcorder), captured through Dazzle Hollywood Bridge as PAL DV, so interlaced from the start....Does this change the scripts you suggested?Yes, because for an interlaced source, you want an interlaced destination.
When you convert 50 fields/sec to 25 frames/sec (prior to converting to 23.976 frames/sec), you have to do one of two things:
1. You deinterlace based on one field. If the other field hasn't moved much, you can use it to reconstruct the missing lines. But if there is motion, you have to make up the missing lines, normally with interpolation.
In this case, you have effectively removed half of the "instants of time." Now, in general, this wouldn't be a bad thing. If you captured 25 frames/sec, the video would be OK. But you didn't capture 25 frames/sec, you captured 50 fields/sec. The camera's aperature was set so that 50 fields/sec looks good. When you remove every other "instant of time," you introduce gaps in the motion of the video. The resulting video will strobe.
2. You deinterlace each field and then blend the resulting frames together. In this case, you get parts of two source "instants of time" in each destination frame. This will look like ghosts whenever anyone moves. It's supposed to simulate lengthening the exposure time to blur the image, but since it's really two separate images that are being combined, it looks more like moving ghosts. I personally hate this and would prefer option 1.
But the best bet is to just go from interlaced to interlaced:AVISource("PAL-50fps-DV.avi")
SeparateFields() # Fix a problem with...
Weave() # ...SmoothDeinterlacer
SmoothDeinterlace(doublerate=true)
ChangeFPS(59.94) # or ConvertFPS(60) -- see note
SeparateFields()
SelectEvery(4,0,3) # or SelectEvery(4,1,2)
Weave()To ensure the right input polarity, start with a script of the first four lines only. Look at the output in VirtualDub and make sure the motion is smooth. If not, add ComplementParity() before SmoothDeinterlace(). For the right output polarity, create a test clip and view it on your TV (not PC). SelectEvery(4,0,3) should be correct for DV. If not, use SelectEvery(4,1,2).
Note: You can use ConvertFPS(59.94). However, since 59.94 has a fractional component, the source and destination frame timing will only line up every 1000 frames. Every single one of the other frames will be interpolated. Using ConvertFPS(60) ensures that only 5 of every 6 frames are interpolated. However, your encoder and authoring software might not like 60 fields/sec. If that's a problem, add an extra ChangeFPS(59.94) after the ConvertFPS(60) to drop one frame every 1000.Also, AssumeFPS will slow down the audio but won't the pitch change by 4%?Yup. That's why I hate changing the speed of the video. Some people don't notice the pitch change, and in fact PAL TV used this with their film->video for many years before there was technology to avoid the pitch shift, and people didn't complain. But I find it obvious and annoying. So I will put up with slightly less smooth video so I don't have to muck with the audio.
Xesdeeni
scharfis_brain
13th January 2004, 17:16
what will those lines do???
SeparateFields()
SelectEvery(4,0,1,0,3,2) # or SelectEvery(4,1,0,1,2,3)
Weave()
do they the 24p -> 60i pulldown conversion?
is this the same like
selectevery(2,0,0,0,1,1)
separatefields
selectevery(4,0,3)
weave
???
Clown shoes
13th January 2004, 17:54
Xesdeeni, I am a big fan of your standards conversion scripts. I work for a post production company and we use it as a regular alternative to hiring an Alchemist. I am just testing out this new script, but was wondering if you have also adapted your PAL to NTSC version?
One other thing, I noticed you just mentioned 4,0,3 being best for DV wheras at the beginning of this post you mentioned 4,1,2 being best for DV is this related to the direction the conversion is going (PAL to NTSC or NTSC to PAL) or is it a typo ;)
Thanks again for all your hard work
Clown Shoes
(P.S are you planning to update your webpage soon to incorporate these script changes)
Xesdeeni
13th January 2004, 18:45
Originally posted by Clown shoes
I work for a post production company and we use it as a regular alternative to hiring an Alchemist.Cool! For some strange reason standards conversion has been a passion of mine since I first started working with digital video almost 20 years ago. I'm glad someone is getting some use from this, and I'm always interested in hearing feedback so I can think about improvements.I am just testing out this new script, but was wondering if you have also adapted your PAL to NTSC version?PAL to NTSC is a bit trickier. I'm trying to work out how to deal with the fraction in that direction. If I try something like this:AVISource("PAL.avi")
SeparateFields()
Weave()
SmoothDeinterlace(doublerate=true)
ChangeFPS(100)
second = last.Trim(1,0)
Layer(second,op="fast",use_chroma=true)
SelectEvery(10,0,2,3,4,6,8)
LanczosResize(720,480)
SeparateFields()
SelectEvery(4,1,2)
Weave()I get a 60i output. The pattern is something like 0 1 1&2 2 3 4. But I need a 59.94i output. To do that, I need to drop one frame every 1000 in the 60p domain (before interlacing):AVISource("PAL.avi")
SeparateFields()
Weave()
SmoothDeinterlace(doublerate=true)
ChangeFPS(100)
second = last.Trim(1,0)
Layer(second,op="fast",use_chroma=true)
SelectEvery(10,0,2,3,4,6,8)
LanczosResize(720,480)
ChangeFPS(59.94)
SeparateFields()
SelectEvery(4,1,2)
Weave()But I have a 5/6 chance of dropping a frame's information completely. That could be a very noticable glitch. I would rather drop the interpolated frame in that case. I still haven't worked out how to pinpoint that frame.One other thing, I noticed you just mentioned 4,0,3 being best for DV wheras at the beginning of this post you mentioned 4,1,2 being best for DV is this related to the direction the conversion is going (PAL to NTSC or NTSC to PAL) or is it a typo ;) Yup. That's a typo. I've corrected the first post accordingly. No wait...that wasn't a typo....I did that on purpose, to see if anyone was paying attention...yeah, that's the ticket ;-)(P.S are you planning to update your webpage soon to incorporate these script changes)I do have some plans for a complete overhaul. I just can't complete the entire matrix as I had envisioned. So instead, I intend to be more analytical, so people can handle their particular combination without relying on it having been exclusively addressed by me. I also want to add (H)DTV into the mix. Unfortunately, I'm swamped at work as well as at home (a 3-month-old, and a 2 1/2-year old, plus a new house), so it's slow going right now.
Xesdeeni
Clown shoes
13th January 2004, 19:07
There is one thing I have noticed that I can't seem to stop, no matter which script I use. It is a combing effect that appears only during dissolves. Are you familiar with this and if you are, is there anything that can be done about it? Cheers mate.
Clown Shoes
Xesdeeni
13th January 2004, 20:11
Originally posted by Clown shoes
There is one thing I have noticed that I can't seem to stop, no matter which script I use. It is a combing effect that appears only during dissolves. Are you familiar with this and if you are, is there anything that can be done about it?Yes, I believe this is a side effect of the deinterlacer. It is possible to tweak the deinterlacer, but I strongly suspect what will give a good result for fades and dissolves will cause the rest of the video to look worse. If you want to take the time to create a custom AVISynth script, you can isolate the fades and dissolves and use a tweaked deinterlacer on that section, or just use Bob() for that section.
Xesdeeni
Letricheur
13th January 2004, 21:53
This is great discussion guys, I am learning a lot.
@Xesdeeni
So, from your scripts, you seem to be recommending conversion from 25 to 29.97, rather than to 23.976 and using pulldown. Am I reading this right?
Also, is there any need to use tff=false or assume bff for the DV source?
Letricheur
14th January 2004, 07:50
@Xesdeeni
I tried the final script you suggested, throwing in some filtering with convolution 3d, and the result is brilliant!! - no jerkiness in panning and the audio is in sync. Thank you so much. This does seem better than slowing to 23.976 and then running pulldown.
Xesdeeni
14th January 2004, 16:21
Originally posted by Letricheur
So, from your scripts, you seem to be recommending conversion from 25 to 29.97, rather than to 23.976 and using pulldown. Am I reading this right?It's important to determine exactly what type of source you have before deciding what conversion to do (this will be the aim of my re-vamped page...if I ever get it updated). Maybe a table would help:
PAL 25p: Convert to 24p; slow down audio
Convert to 30i; leave audio alone[/list=a]* I personally prefer b.
** It is possible for a source to be 25p but show up interlaced in VirtualDub, if the wrong pairs of fields are being combined. Trim one field if this happens to reclaim the 25p.
PAL 25i:[list]Convert to 30i; leave audio aloneNTSC 24p (or telecined film): Convert to 25p; speed up audio
Convert to 25i; leave audio alone[/list=a]* For telecined NTSC, reverse the telecine first, to reclaim the 24p.
** B causes a noticable bump/jerk every half second, so a is probably better here.
NTSC 30p:[list]Convert to 25i; leave audio alone* It is possible for a source to be 30p but show up interlaced in VirtualDub, if the wrong pairs of fields are being combined. Trim one field if this happens to reclaim the 30p.
NTSC 30i:Convert to 25i; leave audio alone
Also, is there any need to use tff=false or assume bff for the DV source?SmoothDeinterlacer will auto-detect the polarity from the codec. If the codec reports the correct polarity, there is no need to deal with the polarity at all. However, you should check the input polarity to be sure, by just feeding the output of SmoothDeinterlace(doublerate=true) into VirtualDub and ensuring the video has smooth motion.
Xesdeeni
ppera2
14th January 2004, 17:31
@Xeesdeni
I never saw NTSC (30 fps) progressive video, at least not on DVD's.
I guess that you may see something like this only as result of conversion. Or maybe they make some TV spots progressive in America?
Could you give here some examples?
Xesdeeni
14th January 2004, 17:52
Originally posted by ppera2
I never saw NTSC (30 fps) progressive video, at least not on DVD's.
I guess that you may see something like this only as result of conversion. Or maybe they make some TV spots progressive in America?
Could you give here some examples?I think this is two questions:
1. Where do you get 30p source?
2. Can you put 30p source on a DVD?
1. There appear to be more and more 30p sources every day. The first was of course VCDs. But at the low resolution, I'll ignore that.
More recently, many NTSC camcorders can capture 30p. Mine does. The goal is to provide video that is easy to convert to online/PC formats, which do best with progressive. But there is a method to my madness of using this mode to capture the second year of my daughter's videos. See below :-)
The 30p NTSC camcorders don't really provide the highest quality, and often fudge to get widescreen. But the new HD camcorders from JVC (I think) have 1280x720@30p. In addition to reasonable HD (not 60p like 1280x720 is supposed to be, but good nevertheless), this is also a great source for high-quality, widescreen DVDs. And it's 30p.
2. The short answer is "yes."
DVDs can actually be encoded in a number of ways. And the encoding may or may not directly relate to the format of the video.
You can encode a DVD as interlaced. For NTSC this means 60 fields/sec (actually 59.94, but I'm using the shorthand here). But the source material could be interlaced, or it could be telecined film. And it could be 30p.
Obviously, encoding 30p or 24p as 60i is silly. You have to encode twice as many "units" (frames/fields), which adds overhead. And the DCT (Discrete Cosine Transform) must deal with vertical discontinuities due to the missing lines in each field. This means the quality suffers.
You can also encode a DVD as progressive. For NTSC this means 30 frames/sec. But the source material could be interlaced, telecined film, or of course, 30p.
60i encoded this way can sometimes be the best choice for maximum quality. If there is very little motion, then the movement between fields won't be too bad. The encoder can then do a better job with half as many "units." But if there is much motion, the encoder will spend too many bits dealing with the vertical discontinuities of motion.
[I was having some issues with my DVD encodes from my camcorder. Mostly these were due to the noise in consumer-level devices. But I decided that encoding 30p for my next DVD would compensate for this, so I've been using this over the last year and a half.]
24p encoded this way is just about as bad. You have two out of every five frames made up of fields from two different "instants of time." It's not as bad as 60i, but it means the encoder has to deal with the time difference.
[Note: There is a way to do a modified telecine that puts only one video frame out of five with fields from two film frames. This is used in the Panasonic 24p camcorder. But the results aren't as smooth as normal telecine.]
And of cource you can encode 24p. The flags indicate which fields to replicate to do the telecine. And obviously this is only appropriate for 24p content.
[I'm not positive at this point, but I believe it also may be possible to encode 48i. But I'm not sure how to verify this, and it's obviously of little value, since you don't have 48i content.]
Xesdeeni
ppera2
14th January 2004, 18:56
Thanx Xeesdeni. I know that 30p is possible to put on DVD.
But here nobody has NTSC DV camera, PAL area.
VCD can't be interlaced (not talk about playback)... and is obsolete.
Is there some anime, which is made 30 fps, progressive. I mean made, not some blended conversions.
Leak
14th January 2004, 22:52
Originally posted by ppera2
I never saw NTSC (30 fps) progressive video, at least not on DVD's.
Could you give here some examples?
Well, Geneon's US release of Haibane Renmei is 30FPS progressive, except for the credits which overlay interlaced scrolling text with a progressive background animation... but that's nothing TomsMoComp can't take care of.
np: Monolake - Stratosphere (Edit) (Momentum)
scharfis_brain
15th January 2004, 02:01
@xesdeeni:
I would like to include your ideas of framerate-conversion into my automatic NTSC -> PAL - converter, but I am currently very busy with other real-life things.
Maybe you could take a look at my script.
It currently detects film as 24p and video as 60i, but detects 30p as 24p. (has someone a idea on this?)
My Idea is, to create a fully automatic script, that:
1) recognises the type of input - clip:
23,976 fps -> NTSC Film -> convert to PAL
29,97 fps -> NTSC Video (maybe Hybrid) -> convert to PAL
25 fps -> PAL VIdeo (maybe Film / Hybrid) -> Conver to NTSC
this means NTSC <-> PAL conversion should be choosen automatically, based upon the input clip
2) has options for type of Framerate conversion:
- simple Frame duplicating/dropping (changfps)
- blending Frames (convertfps)
- your conversion method
3) choosable deinterlacer
- simple bobbing ( bob() )
- dgbob, kernelbob, tmcbob... (whatever you like)
4) desired output format:
a) with runtimechange
I) Speedup (NTSC -> PAL)
- interlaced (video-parts become interlaced, film parts become progressive)
- full progressive film parts are staying progressive, video parts are getting deinterlaced to 25p
II) Slowdown (PAL -> NTSC)
- interlaced (video-parts become interlaced, film parts become telecined (3:2) )
- full progressive film parts are staying progressive, video parts are getting deinterlaced to 24p
b) without runtimechange
I) NTSC -> PAL
- always interlaced. film parts are converted using changefps avoid blends, video parts are converted using the conversion mode of choice
II) PAL -> NTSC
- always interlaced. film parts are converted using changefps avoid blends, video parts are converted using the conversion mode of choice
this could be a real monstrum of script, but it will be able to do all desired conversions nearly fully automatic.
The Idea to script this is already in my mind, but as mentioned above, I am busy....
Letricheur
15th January 2004, 06:22
@Xesdeeni
Thank you again. So far it's working like a charm on my PAL DV to NTSC DV conversions. Can't wait to try the reverse.
DSP8000
15th January 2004, 07:58
Can you post your script please? I followed the whole thread but I'm confused which script to use as Xesdeeni said that he'll look again into PAL->NTSC conversion to add some improvements.
TNX.
DSP8000
Xesdeeni
15th January 2004, 14:40
Sorry, I missed this one...
Originally posted by scharfis_brain
what will those lines do???SeparateFields()
SelectEvery(4,0,1,0,3,2) # or SelectEvery(4,1,0,1,2,3)
Weave()do they the 24p -> 60i pulldown conversion?
is this the same likeselectevery(2,0,0,0,1,1)
separatefields
selectevery(4,0,3)
weave??? Yes, it looks like they do the same thing.
The script idea is interesting, but I don't know how you'd determine the actual input format automatically.
Xesdeeni
aklendathu
15th January 2004, 14:45
Originally posted by Xesdeeni
I think this is two questions:
1. Where do you get 30p source?
2. Can you put 30p source on a DVD?
1. There appear to be more and more 30p sources every day. The first was of course VCDs. But at the low resolution, I'll ignore that.
...
@Xesdeeni:
Could you elaborate a bit more on this ? I am currently struggling with VCD to DVD conversion of some of my favorite TV shows (NTSC TV standard).
http://forum.doom9.org/showthread.php?s=&threadid=68699
and found that straight conversion leads to async audio. I don't know whether I can explain this using the proper language, but one possibility seems to be that somehow audio is 30 fps and video 29,97 fps. After 10-15 minutes playback of the MPEG-2 file, a noticeable audio/video delay is apparent - audio plays ahead of video. That's why I found interesting your mention of VCD as 30fps material.
Other people in this forum have made suggestions, but I'd like to have your opinion as well.
TIA,
Pedro.
Xesdeeni
15th January 2004, 14:54
Originally posted by aklendathu
I am currently struggling with VCD to DVD conversion of some of my favorite TV shows (NTSC TV standard).
http://forum.doom9.org/showthread.php?s=&threadid=68699
and found that straight conversion leads to async audio. I don't know whether I can explain this using the proper language, but one possibility seems to be that somehow audio is 30 fps and video 29,97 fps. After 10-15 minutes playback of the MPEG-2 file, a noticeable audio/video delay is apparent - audio plays ahead of video. That's why I found interesting your mention of VCD as 30fps material.First, I was really using 30 fps and 29.97 fps interchangably, mostly because I was being lazy. But you need to verify that the video is indeed 30 fps and not 29.97 fps.
But an aside comment would be that you should not re-encode the video at all. Part of the DVD format is MPEG-1 at VCD resolution. You should only have to re-encode the audio, to switch from 44.1KHz to 48KHz (and possibly from MPEG audio to AC3 if you want to be absolutely certain all NTSC DVD players will play the audio). Of course, that probably doesn't affect your audio sync issue....
VirtualDub can load the MPEG-1 directly, without AVISynth. What does it tell you about the audio and video frame rates and durations?
Xesdeeni
aklendathu
15th January 2004, 15:59
If I open the MPEG-1 file directly with VDUB, File Info is as follows (excerpt):
Video:
Frame size, fps: 352x240, 29.97 fps
# of frames, time: 76979 (42:48)
Audio:
Format: 44kHz stereo, 224 kbps Layer II
# of frames: 98235
If I open file in VDUB using AVS script (DirectShow Filter w/audio):
Video:
Frame size, fps: 352x240, 29.97 fps
# of frames, time: 76979 (42:48.53)
Audio Stream:
Sampling Rate: 44100 Hz
...
Layout: 53 chunks, 0.0 s preload
Length: 113270933 samples (42:48.50)
...
Data rate 1411 kbps
This particular file I have not yet tried to convert to DVD but I have had examples of other files where the a/v durations match closely and still upon conversion audio gets out of sync (plays ahead) with video.
I've also tried to author a DVD using MPEG-1 video streams and 48kHz resampled audio tracks but had the same async problem. Is it possible that the audio resampling could introduce sync loss between audio and video ?
Pedro.
scharfis_brain
15th January 2004, 16:32
the script idea is interesting, but I don't know how you'd determine the actual input format automatically
I just look at the framerate of the input-clip:
23,9 to 24,05 -> NTSC Film -> convert to PAL
29,9 to 30,05 -> NTSC Video -> convert to PAL
24,95 to 25,05 -> PAL Film/Video -> convert to NTSC (either Film or Video)
I'd like to choose framerate ranges, because testing equality isn't a good thing when dealing with float.
kle500
16th January 2004, 23:58
Xesdeeni, i tried your new script on NTSC->PAL interlaced material, and is indeed better than your original one, on fast camera movement.
I allways do conversions from NTSC mpeg2 files from DVD'S
I am in PAL land and i was allways a big fan of Standards Conversion proccess. Allthough i am not familiar with the technical proccess during conversion, i was allways wanted to do it myself. I allways dreamed to get close to an Alchemist, just to see with my own eyes the quality of the output.
Anyway, all i had seen are conversions from, Converter Boxes (TENLAB...) and VHS converters (AG-W1, SHARP, SAMSUNG SV-5000), until i saw the avisynth solution and the Procoder.
Allthough i tryied the avisynth with your script and the quality was quite good, but i had big problems with orizontal distortion (interlaced) lines during up-down movement. I think «EyesOnly» had the same problem in the past.
Notice that if i use:
SmoothDeinterlace(doublerate=true), i get those lines as i describe, but if i use:
SmoothDeinterlace(doublerate=true,lacethresh=1,staticthresh=20), the picture is ok.
I have this problem since day one on all my NTSC->PAL conversions, on many different machines, with endless OS instalations.
Right now, after allmost one year since your first script, i use your script, but with the above modification.
I am possitive that a lot of people have the same problem too.
I also tryied the PROCODER EXPRESS, and i can say that the quality is very good, but the output is softer than the original.
I managed to capture 2 same frames from Procoder Conversion and your script, and there is a difference. The PCE is softer than using your script, but movement with PCE seems a little better.
Overall i prefffer using your script, because of the sharpnes i get using avisynth.
BTW, is it possible, technically to Change the framerate even higher with the ChangeFPS & ConvertFPS, so we can achieve ever better movement?
What do those Snell&Wilcox machines have inside to make them unique?
Isn't it possible to achieve same results using software? even waiting days for encoding.
Thank's for everything.
Xesdeeni
19th January 2004, 15:02
Originally posted by kle500
...but i had big problems with orizontal distortion (interlaced) lines during up-down movement. I think «EyesOnly» had the same problem in the past. Notice that if i use: SmoothDeinterlace(doublerate=true), i get those lines as i describe, but if i use:
SmoothDeinterlace(doublerate=true,lacethresh=1,staticthresh=20), the picture is ok.
Did you add SeparateFields() and Weave() before the SmoothDeinterlace() line? There is some issue I have not been able to find that this fixes. If that is not the case, please make a small test clip available. You should not have to make such radical adjustments to the default values. The only case I've seen where it might be necessary is on video that has a lot of fog or haze, and on some fades. This makes the objects appear with very little contrast, so SmoothDeinterlacer has a hard time telling the difference between parts of the image in motion and parts that are not.BTW, is it possible, technically to Change the framerate even higher with the ChangeFPS & ConvertFPS, so we can achieve ever better movement?The process used by the script makes new frames, but it doesn't actually create any new "instants of time." When you have an NTSC video, you have 60 fields, each taken at a different time. The script converts this to 60 frames using the deinterlacer. This is just guessing at the missing information based on the information that is already there. Then we convert the 60 frames to 50 frames and scale appropriately. That invovles either throwing out frames or averaging between them. Then we interlace the 50 frames back to 50 fields.What do those Snell&Wilcox machines have inside to make them unique?In order to make more frames, or in order to get frames that are between the frames of the source in time, you have to do something much more complex. The less expensive Snell & Wilcox device do something similar to the script. The more expensive ones use motion estimation to analyze the image. Then they try to figure out where an object would have been if the destination format timing had been used to capture the video.
For example, NTSC fields are captured 1/60 second apart (actually 1/59.94 second, but let's round for simplicity). So the fields are at times: 0, 16.7ms, 33.3ms, 50ms, 66.7ms, 83.3ms, etc. PAL fields are captured 1/50 second apart. So the fields are at times: 0, 20ms, 40ms, 60ms, 80ms, etc.
For NTSC to PAL conversion, notice that we could directly convert the first field of NTSC to the first field of PAL: 0 -> 0. But where do we get the second PAL field, at 20ms? There is an NTSC field at 16.7ms, and another at 33.3ms. 20ms is between these two fields. But although 16.7ms is close, it isn't exactly at 20ms.
What our script does, when you use ConvertFPS(), is average the 16.7ms image with the 33.3ms image, with more weight given to the 16.7ms image. (When you use ChangeFPS(), the 16.7ms frame is used as is.)
The Snell & Wilcox (and other companies) expensive systems will analyze the image. When they find something moving between 16.7ms and 33.3ms, they will try to estimate where that object would have been at 20ms. They try to reconstruct what the scene would have looked like if a frame had been snapped at 20ms.Isn't it possible to achieve same results using software? even waiting days for encoding.
Thank's for everything.Sure, but two are three issues:
1. If you had enough knowledge to do this, and if you had done all that work, would you give it away for free?
2. As you said, it would probably take days to make a small conversion on even today's fastest processors. The first system I saw do this from Snell & Wilcox cost $250,000 and consisted of four separate DSP cards.
Xesdeeni
kle500
19th January 2004, 22:34
Thank's for the answer Xesdeeni.
Did you add SeparateFields() and Weave() before the SmoothDeinterlace() line?
Yes i allways put these two, since your first script (1 year ago), so this is not the case.
I think «EyesOnly» had the same problem in the past.
I am sorry, it was «easy2Bcheesy»
Whatever clip i use (NTSC m2v) from demuxed DVD, i allways have the same problem.
I also see the same problem using DGBOB:
dgbob(order=1, mode = 1)
ChangeFPS(50)
LanczosResize(720,576)
SeparateFields()
SelectEvery(4,0,3)
Weave()
I can post 3 frames from the same source.
1 frame from original NTSC, another same frame using SmoothDeinterlace(doublerate=true) and a third one with SmoothDeinterlace(doublerate=true,lacethresh=1,staticthresh=20), so you will see what i mean.
BTW, i tryied the automatic script from scharfis_brain, on interlaced NTSC material, but i have audio synch problems.
So i am not sure if this method is wokring on Pure Interlaced material, for NTSC(DVD)->PAL(DVD) conversion.
This script didn't produced the problem i described, but was totally out of synch with the audio.
Kle500
Letricheur
20th January 2004, 01:27
@DSP8000
Sorry to be so long replying. I haven't been back to this thread for a while. Here is the script I use for PAL DV captures of PAL camcorder video to convert to NTSC DV; it is based entirely on Xesdeeni's work.
AVISource("G:\Temp\AVI.avi")
LoadPlugin("C:\DVD\Filters\SmoothDeinterlacer.dll")
LoadPlugin("C:\DVD\Filters\Convolution3D.dll")
SeparateFields()
Weave()
SmoothDeinterlace(doublerate=true)
ChangeFPS(100)
second = last.Trim(1,0)
Layer(second,op="fast",use_chroma=true)
SelectEvery(10,0,2,3,4,6,8)
CropBottom(8)
LanczosResize(720,480)
ChangeFPS(59.94)
SeparateFields()
odd=SelectOdd.Convolution3D(0, 32, 128, 16, 64, 10, 0)
even=SelectEven.Convolution3D(0, 32, 128, 16, 64, 10, 0)
MergeChroma(Blur(0, 1))
SelectEvery(4,1,2)
Weave()
I have just added the mergechroma line based on a discussion about PAL lines in this forum.
scharfis_brain
20th January 2004, 01:59
a few comments ti this script:
- do you noise-filtering BEFORE any Deinterlacing and Framerate conversion.
- use DGbob or Kernelbob instaed of Smoothdeinterlacer.
You'll get higher quality and speed
- your actual denoising deos not take any effect, because the assigned varibles are not reused
- the PAL-Color-blurring is not needed for DV-Video and totally senseless after all conversion (framerate, deinterlacing resizing) has been done
this would be the better working one:
AVISource("G:\Temp\AVI.avi")
LoadPlugin("C:\DVD\Filters\DGbob.dll")
LoadPlugin("C:\DVD\Filters\Convolution3D.dll")
SeparateFields()
MergeChroma(Blur(0, 1))
odd=SelectOdd.Convolution3D(0, 32, 128, 16, 64, 10, 0)
even=SelectEven.Convolution3D(0, 32, 128, 16, 64, 10, 0)
interleave(even,odd)
weave()
DGbob(order=1)
a=last
b=Layer(a,a.trim(1,0),op="fast",use_chroma=true)
interleave(a,b)
SelectEvery(10,0,2,3,4,6,8)
CropBottom(8)
LanczosResize(720,480)
ChangeFPS(59.94)
Separatefields()
SelectEvery(4,1,2)
Weave()
Letricheur
20th January 2004, 03:31
@Scharfis_brain
Thanks for the tips on this script. I will try yours. I use smoothdeinterlacer because I do not use avisynth 2.5x.
DSP8000
20th January 2004, 06:51
Thanks Letricheur, I've tested the scipt and compared with Canopus Procoder Express:
Canopus:faster,softer,jerky video
The script:clean,good quality,soo slow
I'm not in hurry,as long as I can learn something from this forum, I dont mind waiting for answer,like I said thx.
DSP8000
Xesdeeni
20th January 2004, 15:39
Originally posted by Letricheur
I use smoothdeinterlacer because I do not use avisynth 2.5x.A 2.5x version is available at http://www.avisynth.org/warpenterprises/.
Xesdeeni
scharfis_brain
20th January 2004, 15:43
@Xesdeeni:
he seems to use AVISynth 2.0x
this means, DGbob or kerneldeint are not available for 2.0
thats why he's using smoothdeint.
Xesdeeni
20th January 2004, 20:39
Originally posted by scharfis_brain
@Xesdeeni:
he seems to use AVISynth 2.0x
this means, DGbob or kerneldeint are not available for 2.0
thats why he's using smoothdeint.I may have misunderstood, but thought he meant he stuck with 2.05 because of SmoothDeinterlace. Either way, I believe the above site has all the best filters, so I don't know of a reason to stick with 2.05.
Xesdeeni
Letricheur
20th January 2004, 21:40
Sorry to be the source of confusion. I haven't switched to Avisynth 2.5x because I had not yet investigated whether all the plugins I have used with 2.0x were compatible. I am pleased to hear there is a 2.5 version of smoothdeinterlacer, though.
Xesdeeni
20th January 2004, 23:00
Originally posted by Letricheur
Sorry to be the source of confusion. I haven't switched to Avisynth 2.5x because I had not yet investigated whether all the plugins I have used with 2.0x were compatible. I am pleased to hear there is a 2.5 version of smoothdeinterlacer, though. Check out the site above and see if there are versions for all of your plugins for 2.5.x. All of mine were there, including a SmoothDeinterlacer port that I didn't do! :-)
Xesdeeni
aklendathu
21st January 2004, 16:39
@scharfis_brain:
I've used your simpler script to convert some AVI FILM movies to PAL DVD. It works very well but it produces interlaced output from non-interlaced input. I don't know whether it makes sense, but is it possible to adapt your script to produce progressive output instead of interlaced ? How does the interlaced output look like on a 100 Hz PAL TV ?
Just a wild guess from a newbie: Would there be any advantage in doing changefps(100) instead of changefps(50)?
TIA,
Pedro.
scharfis_brain
21st January 2004, 23:45
@aklendathu:
which script do you mean? I've made a lot of scripts....
please post the script, You've used.
It works very well but it produces interlaced output from non-interlaced input. I don't know whether it makes sense, but is it possible to adapt your script to produce progressive output instead of interlaced ?
I assume, that you want to convert from 24fps to 25fps (PAL)
If you want to get progressive video, you need to speedup the movie.
If you don't want to speedup the movie, it has to get interlaced for lowest jerkyness.
How does the interlaced output look like on a 100 Hz PAL TV ?
Depends on 100Hz-TV. Everyone handles the incoming 50i-Video in another way.
some only to stupid bobbing, others do threshold-based deinterlacing, better ones have motion compensating and even better ones are able to reconstruct pregressive frames internally with fieldmatching
Just a wild guess from a newbie: Would there be any advantage in doing changefps(100) instead of changefps(50)?
No Anser here, but some simple questions to you, hehe:
Which media does you allow to store 100fps content?
Which 100Hz-TV has a 100fps-progressive input?
Which devices are able to put out 100Hz progressive (exept of PC's)
all questions have to be answered with the same result.
aklendathu
22nd January 2004, 01:50
Originally posted by scharfis_brain
@aklendathu:
which script do you mean? I've made a lot of scripts....
please post the script, You've used.
...
No Anser here, but some simple questions to you, hehe:
Which media does you allow to store 100fps content?
Which 100Hz-TV has a 100fps-progressive input?
Which devices are able to put out 100Hz progressive (exept of PC's)
all questions have to be answered with the same result.
It's the simple 24 -> 25 fps script, not the convert one:
AVISource("I:\File.avi",audio=false)
LanczosResize(704,470)
AddBorders(8,5,8,5)
ChangeFPS(50)
# Convert to PAL interlaced output by taking even lines from one
# frame and odd lines from another. Normally (4,0,3) works for DVDs
# (top field first) while (4,1,2) works for DV (bottom field first).
SeparateFields()
SelectEvery(4,0,3)
LanczosResize(352,288)
Weave()
AssumeFPS(25)
My question about the 100fps was really whether a smoother motion could be obtained in the resulting video by interpolating frames across a wider range when you change back to 25 fps - maybe this doesn't make much sense to you, but like I said, I'm a newbie with AVISynth...;)
Pedro.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.