Log in

View Full Version : motion compensated pal/ntsc converter?


hanfrunz
15th July 2002, 20:23
Hello,

i am looking for a software ntsc <-> pal converter which has the quality of professional converters like:
http://www.videointernational.com/download/4V601P001AU_Introduction.pdf

or

http://www.snellwilcox.com/internet/products/mach/index.html

hanfrunz

DJ Bobo
15th July 2002, 20:56
I havn't really looked on the documents you posted, but I tell you anyway:

The *ONLY* proper way to convert from PAL to NTSC or NTSC to PAL is accelerating or decelerating the video, this conserves perfect image quality and smooth regular motion.
This can be done in VirtualDub for example. You can then change the length of the audio file in WaveLab for example, relatively to the video.

Any other way will make image quality & motion worse, and I hate all "professionals" (they aren't worth that name!) that invented such crappy framerate conversion methods (damn them all! think about most american and japanese series aired in europe, jerky motion all the time, it's such a shame! only because they think they are intelligent and play with fields and half-images and stuff, ridiculous! damn them all!)

trbarry
15th July 2002, 21:09
That does pretty well sum it up. ;)

- Tom

hanfrunz
15th July 2002, 21:14
Hello DJ Bobo,

>The *ONLY* proper way to convert from PAL to NTSC or NTSC to PAL is
>accelerating or decelerating the video, this conserves perfect image
>quality and smooth regular motion.

You really mean to speed up a 25fps video to 29.97fps is the ONLY proper sollution??? But then the sound is 120% faster!! Have you ever seen a real professional conversion with one the better converters? Most smaller video-productions use cheap 4field or even cheaper converters, ...

And the problem were not the "professionals", but money...
they could build big HDTV, uncompressed, 3D... TVs, but who would pay them?
And the frame rate problem is coupled to the frequencies of the power-supplies and the tv-history (braun tubes, black and white compatibility...)

I prefer good old 35mm, 4perf, 24fps film it can be played all around the world :-)

TactX
15th July 2002, 22:28
Originally posted by hanfrunz
You really mean to speed up a 25fps video to 29.97fps is the ONLY proper sollution??? But then the sound is 120% faster!!

I think you mean 20%, don't you ;)

I hate talking for other people but I think DJ Bobo refered to 29.97 fps telecined, which means 23.97 fps progressive after IVTC, right ?

Then you need to speed up only by ~4% (25 / 23.97) which is propably not noticable for both eye and ear.

The same is done with 24 fps FILM -> PAL.



EDIT: These professional converters you've linked to are designed to do realtime NTSC<->PAL<->SECAM conversions for live-broadcasting. Remember World-Championship in Korea :) They shoot their stuff @29.97 fps while PAL-world needs it in 25 fps.

poptones
15th July 2002, 23:02
Well... I got pretty good results going from PAL to NTSC using the ol separatefields().selectevery() sequence. I split the garbage video down to 50fps progressive then restitched it to 60fps using the setting mentioned right in Ben's help file, and it looked pretty doggone good. I've also had good results splitting PAL videos broadcast on worldvision (which is broadcast in NTSC) down to 24fps progressive, 'tho I admit it's pretty darn tricky and I had to use my own filter for that.

OTOH, my Siouxsie and the Banshees laserdisk was almost impossible to split back up because of all the processing they put on it going from PAL to NTSC. So I would say it's easy to go PAL to NTSC, but ranges from very easy to virtually impossible to properly go the other way.

droolian01
16th July 2002, 03:26
Should be easy to get perfect results except with pal material that was originally ntsc and not properly converted, this gives blended fields and you are stuffed.

So:
nstc(30fps) -> IVTC -> film (24fps) -> speed up audio and video to 25fps = pal

and:
pal(25fps) -> slow down audio and video to 24fps -> film(24fps) ->TELECINE -> NTSC

Unfortunately most american stuff shown in the uk is crapply 'converted' (not strictly ivtc'ed) so you have to use deinterlacing.

Wilbert
16th July 2002, 10:28
@poptones,

Like I asked on sourceforge.net, but I never got a response:

Is it a good idea to add built in functions for format conversions (thus framerate conversions) ?

Thus pal, ntsc, ntsc_film --> pal, ntsc, ntsc_film (video, audio and subtitles).

I guess one could define three functions:

video_conversion(input, format1, output, format2)

with format1 = pal/ntsc/ntsc_film (corresponding to the input)
and format2 = pal/ntsc/ntsc_film (corresponding to the output)

Similar for the audio and the subtitles.

Is this possible ?

MvB
16th July 2002, 12:03
Originally posted by TactX


Then you need to speed up only by ~4% (25 / 23.97) which is propably not noticable for both eye and ear.

The same is done with 24 fps FILM -> PAL.


I think you have never had such material at home and were not able to play it back, because the difference in speed can be heard exactly. And the difference in speed is so big that I won't watch movies in PAL anymore. I prefer to convert them to NTSC (e.g. PAL DVD to NTSC SVCD or PAL DVD to nearly 24 FPS divx). At the moment I'm working on an expansion of the method of slowing down a movie for the ac3 soundtrack, too.

I you want to hear the difference between the speeds (in this case 25 vs. 23.994 FPS) visit http://www.vonbredow.de, click on DVDRIP, (assuming that you don't speak german) click on the big link on the bottom of the frame an scroll down till you see a table with two links in it: "Geschwindikeitskorrigierte Version" (thats nearly orignial recording speed) and "Version der deutschen DVD" (thats the faster PAL version, ripped directly from the DVD)

these are scenes in divx 3.11. Please don't tell me you won't hear the difference. And please don't tell me you don't notice how all feelings and the frustration in the speakers voice have gone because of the speedup.

MvB

TactX
16th July 2002, 12:26
Originally posted by MvB
I think you have never had such material at home and were not able to play it back, because the difference in speed can be heard exactly. And the difference in speed is so big that I won't watch movies in PAL anymore.

1. I live in Germany (PAL), so I'm almost only watching PAL.

2. I said "propably not noticable for both eye and ear". If you don't like watching PAL, don't do it.

3. In direct comparison you WILL definetely notice the difference ! But please don't tell me that you hear wether a movie is PAL or NTSC or whatelse if you have nothing to compare to.

4. I may assume that it is not the Video speed but the higher pitch of Audio that disturbs you ? This can be easily solved by using hq timestretching-filter in a (semi-) professional Audio-editor.

Marc FD
17th July 2002, 02:50
i aggree with TactX :)
- the 4% speed != is noticable, but it's not worse than the awfull video quality from the NTSC compared to PAL quality :
from what i could remind, the PAL luma bandwith is as big as the entire NTSC bandwith with a 25% bigger chroma channel ( or something like this) so i would NEVER see ANY NTSC movie, and i prefer use a VHS PAL movie than a DVD NTSC movie because i would have a bigger quality if i deinterlace PAL : interlaced NTSC movie are often broken, so you can't deinterlace them without a quite big quality drawbacks :(

So i don't think there is a big advantage to have only movies in an outdatted video format in order to playback them with a better audio quality !! If you have problems with the audio, audio semi-pro tools you can use now are very powerfull and far less complex to use than a NTSC deinterlacer :D

(even mpeg 2 layer 3 audio can recover an decent quality if you use the right filters !)

Just my toughts...

(yes, i live in the PAL world... :cool: )

poptones
17th July 2002, 04:22
Wilbert, as many have pointed out here there are scads of ways PAL can be converted to NTSC (and vice versa) and there's simply no way of knowing what will work in advance of seeing it. It would be nice to have a filter that automatically looked at the video and decided on the fly which to use, but I wouldn't know how to even begin writing one. Even running some video through the (very expensive) Terran media cleaner doesn't always fix such problems cleanly unless you know how to drive it.

There are lots of different methods using the tools already in avisynth, it's just a matter of knowing to try them (just like terran). What might be really helpful (for avisynth in general) is a collection of scripts to try and a convenient way to interface with them.

Wilbert
17th July 2002, 09:40
That would be really cool! Do you have some concrete ideas about that?

DJ Bobo
17th July 2002, 10:46
I think, it's not complicated at all to convert framerates:

23,976fps -> 25fps or 25fps -> 23,976fps: just use Assumefps or VD

If you have an interlaced 25fps source, deinterlace it, then decelerate to 23,976, in a way like this
FieldDeinterlace or FieldDeinterlace(blend=false) or Telecide
Assumefps(23,976)

The only remaining framerate conversion and the most complicated one will be (non telecined) 29,97fps -> 25fps.
The only way I can think about is
decimate(cycle=8) (remove this if you wanna perfect motion)
assumefps(25)
And when it is interlaced:
FieldDeinterlace or FieldDeinterlace(blend=false) or Telecide
decimate(cycle=8) (remove this if you wanna perfect motion)
assumefps(25)

hakko504
17th July 2002, 16:52
Ahem...

I wrote a collection of scripts for changeing framerate from 25 to 29.97 and back and from 23.976 to 25 and back a while ago. I haven't tested them properly yet, but I think they will work OK. They are all based on Ben RG's original NTSC2PAl conversion.LoadPlugin("C:\program\gordia~1\decomb.dll")
LoadPlugin("C:\program\gordia~1\greedyHMA.dll")
LoadPlugin("C:\PROGRAM\GORDIA~1\mpeg2dec.dll")
LoadPlugin("C:\PROGRAM\GORDIA~1\Avisynth_Spatial.dll")

#field bob is a smartBob function based on fieldde-interlace from Decomb
#Topfield will be OK, but bottom field doesn't seem to be very different from top, so I recommend GreedyBob
function fieldBob(clip clip)
{
Top=clip.fieldDeinterlace(blend=false)
Bottom=clip.AddBorders(0,1,0,1).fieldDeinterlace(blend=false).crop(0,1,clip.width,clip.height)
return Interleave(Top,Bottom)
}

#GreedyBob is a smart Bob function using GreedyHMA to do the work
#It is much better than fieldBob and if you need bottom first it must be used.
#Parameter Topfirst = 1 (default) will use the top field as the first field
# 0 will use the bottom field as first field
function GreedyBob(clip clip, int Topfirst)
{
Top=clip.GreedyHMA(default(Topfirst,1),0,0,0,0,0,0,0)
Bottom=clip.GreedyHMA(default(1-Topfirst,0),0,0,0,0,0,0,0)
return Interleave(Top,Bottom)
}

#interlacemode have 4 valid values:
# 0 interlaced NTSC to interlaced PAL (default)
# 1 progressive NTSC to interlaced PAL
# 2 interlaced NTSC to progressive PAL
# 3 progressive NTSC to progressive PAL
#MPEG = 1 will do MPEG size conversion (240=>288,480=>576)
#Note: function will speed video slightly (30/29.97)
function NTSC2PAL(clip clip, int MPEG, int interlacemode)
{
clip1=clip.AssumeFPS(30)
im=default(interlacemode,0)
Assert((im<=3)&&(im>=0),"Wrong interlace mode")
Assert((MPEG>=0)&&(MPEG<=1),"Is it MPEG or not?")
clip2=(im==0)?GreedyBob(clip1):(im==1)?clip1.SelectEvery(1,0,0):(im==2)?clip1.fieldDeinterlace(blend=false):clip1
(default(MPEG,1)==1)?Assert((clip.height==240)||(clip.height==480),"Not a valid height for NTSC MPEG"):Assert(1,"No error")
clip3=(default(MPEG,1)==1)?clip2.BicubicResize(clip2.width,(clip2.height*288)/240,0,0.5):clip2
clip4=((im==0)||(im==1))?clip3.Decimate(6).SeparateFields().SelectEvery(4,0,3).Weave():clip3.Decimate(6)
return clip4
}

#interlacemode have 4 valid values:
# 0 interlaced PAL to interlaced NTSC (default)
# 1 progressive PAL to interlaced NTSC
# 2 interlaced PAL to progressive NTSC
# 3 progressive PAL to progressive NTSC
#MPEG = 1 will do MPEG size conversion (240=>288,480=>576)
#Note: function will slow video slightly (29.97/30)
function PAL2NTSC(clip clip,int MPEG,int interlacemode)
{
im=default(interlacemode,0)
Assert((im<=3)&&(im>=0),"Wrong interlace mode")
Assert((MPEG>=0)&&(MPEG<=1),"Is it MPEG or not?")
clip1=((im==0)||(im==2))?GreedyBob(clip,1):clip.selectEvery(1,0,0)
clip2=((im==0)||(im==1))?clip1.Separatefields().selectEvery(10,0,3,4,5,6,9).Weave():clip1.Decimate(5).Decimate(4)
(default(MPEG,1)==1)?Assert((clip.height==288)||(clip.height==576),"Not a valid height for PAL MPEG"):Assert(1,"No error")
clip3=(default(MPEG,1)==1)?clip2.BicubicResize(clip2.width,(clip2.height*240)/288,0,0.5):clip2
}

#mode have 3 valid values:
# 0 FILM speeded up to PAL
# 1 FILM add frame to PAL interlace
# 2 FILM add frame to PAL progressive (default)
#Note that film should be resized correctly BEFORE calling this function.
function FILM2PAL(clip clip,int mode)
{
m=default(mode,2)
Assert(((m>=0)&&(m<=2)),"Wrong mode!")
clip1=(m==1)?clip.Separatefields().SelectEvery(48,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,22,25,24,27,26,29,28,31,30,33,32,35,34,37,36,39,38,41,40,43,42,45,44,47,46,47).Weave():(m==2)?clip.SelectEvery(24,0,1,2,3,4,5,6,7,8,9,10,11,12,12,13,14,15,16,17,18,19,20,21,22,23):clip
return clip1.AssumeFPS(25)
}

#Parameters:
#PALmode 0 (default) interlaced
# 1 progressive (including fieldshifted progressive)
#FILMmode 0 leaves output at 24fps
# 1 (default) slows output to 23.976fps
#ConversionMode 0 drops frames (keeping length of movie)
# 1 (default) slows clip down (keeping framecount)
function PAL2FILM(clip clip, int PALmode, int FILMmode, int conversionmode)
{
p=default(PALmode,0)
f=default(FILMmode,1)
c=default(conversionmode,1)
Assert(((p==0)||(p==1))&&((f==0)||(f==1))&&((c==0)||(c==1)),"Not a valid mode!")
clip1=(p==0)?clip.GreedyHMA(1,0,0,0,0,0,0,0):clip.Telecide(guide=2,blend=false)
clip2=(c==0)?clip1.Decimate(cycle=25):clip1
clip3=(f==0)?clip2.AssumeFps(24):clip2.AssumeFps(23.976)
return clip3
}

Sample script for converting a PAL TV show from DVD to NTSC (both interlaced)
Import("bob.avs")
clip=Mpeg2source("bean.d2v")
PAL2NTSC(clip,1,0)
#remember to change audio rate manually

Any comments welcome.

hakko504
17th July 2002, 16:54
Forgot to disable the smileys: please replace them with :(
There are no smileys in the attachment. Just wait until it is approved.

trbarry
17th July 2002, 23:00
Why is it recently that all the attachments appear as types of .php instead of .zip or whatever. Is it some silly setting that I've got wrong?

@hakko -

What does the syntax "default(Topfirst,1)" mean? I guess I'm just having a slow day but I don't understand your scripts.

- Tom

avih
17th July 2002, 23:05
Originally posted by trbarry
Why is it recently that all the attachments appear as types of .php instead of .zip or whatever. Is it some silly setting that I've got wrong?
....
- Tom

it's a mozilla bug imo :(

TactX
17th July 2002, 23:14
Originally posted by avih


it's a mozilla bug imo :(


Opera, too !!!

dividee
18th July 2002, 01:17
Strange, I didn't notice any problem with attachments. Maybe you're right, that's a (multi-)browser bug :confused:

@Tom:
The expression "default(TopFirst,1)" returns TopFirst if it's defined else it returns 1. So the function has an optional parameter with a default value.

hakko504
18th July 2002, 10:56
There seems to be a problem with default in some versions of AVIsynth. I found the command in Edwins documentation of 1.0b5 and tested the scripts with 1.0b7d and it seemed to work OK. However when GKnot installed 1.0b6 it suddenly stopped working. :confused: I was going to install 2.01 but I haven't got around to that yet so I don't know if it works or not.

The expected behaviour is of course the one dividee explained: it is used to make variables optional by setting a default value when they are undefined.

primitive
18th July 2002, 18:43
Originally posted by avih


it's a mozilla bug imo :(

Meh.

Mozilla and Opera determine file type by the mime-type they are passed by the webserver, which is properly cross-platform. Specifically, they do NOT determine filetype by anything akin to a file extention.

If the server passes the wrong mime-type, the browser will assume that the file is of that type. Specifically, this is a server issue, not a client issue.

Resolution: make sure the mime-type you assign to each file on the server side matches what the file actually is.

Wilbert
19th July 2002, 09:53
@Hakko,

Where can I get the Avisynth_Spatial.dll plugin, and what does it do?

Maybe the functions will be added in a new version of AviSynth (but I'm not the one who decides that!). If not I will add it to the faq. If you have some time could you supply the functions with some comments (this line happens this, that line happens that, etc.).

What is best to do with the audio in these cases (NTCS2PAL, PAL2NTCS, FILM2PAL, PAL2FILM)?

hakko504
19th July 2002, 10:13
@Wilbert

The Avisynth_Spatial.dll is included in the GKnot package, I don't know where it came from originally. It is only used for the denoise function in the bob.avs file attached and is not necessary for the framerate conversions.


What happens in the conversions:
NTSC2PAL
Clip1 speeds the video from 29.97 to 30 fps-
Clip2 produces a 30/60fps progressive video
Clip3 resizes the video from 240/480 lines to 288/576 lines if it is an MPEG clip.
Clip4 decimates the result to 25 fps

PAL2NTSC
Clip1 creates a 50Hz progressive video
Clip2 reduces it to 30fps by removing whole or half frames
Clip3 resizes the video from 288/576 lines to 240/480 lines if it is an MPEG clip.
And finally video is slowed to 29.97fps

FILM2PAL
This one is easier.
Either it is just sped up to 25 fps without chnging framecount. Or 1 field is added every 12 frames, creating interlaced PAL or 1 frame is added every 24 frames creating progressive PAL.

PAL2FILM
Clip1 De-interlaces the video, either with Greedy or Telecide(corrects fieldshifts)
Clip2 Decimates the video to 24 fps
Clip3 sets desired framerate 24/23.976fps