digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Fields to Frames and Telecine with AVISynth? (http://www.digitalfaq.com/archives/avisynth/613-fields-frames-telecine.html)

The Alvinator 07-11-2002 05:31 PM

Fields to Frames and Telecine with AVISynth?
 
Hello, all. This is my first post. Yipee!!! 8)

I want to convert a 60i 30fps video (source from a DV camcorder) to a 60P 60fps video. Anyone know how?

I know TMPGEnc can do it (in the filters settings choose Deinterlace: Even AND Odd Fields, with adaptation, this gives a 60fps MPEG) but I do NOT want to go through an MPEG intermediate. Even if I set the paramaters very high (bitrates at above 30,000kbit/sec, other settings optimized like GOP, and all that stuff), no matter what, due to the nature of MPEG encoding, there will always be artifacts, especially in the heavy primary colored areas (R,G,B).

So I want to know if there were any other applications out there that will convert 60i to 60P.

I was wondering if AVISynth can do it. I think I heard somewhere that you can write a script that will do something like this, but it wont feature any interpolation (giving that horrible low-resolution problem that comes from deinterlacing an interlaced source without doing any interpolation).

Some of you may say that no interpolation may not matter because 60fps is a fast refresh rate, and the switch between even and odd fields is so quick back and forth it will be hard to see any resolution problems (similar to how a TV does it, but in our case these will be full frames).

But it is a problem. I will later be converting the 60fps down to 24fps - therefore the refresh rate has been lowered dramatically, and the change between even and odd fields will become very noticable. The image will definitely "shimmer."

This is why I am looking for an application that will convert 60i to 60P AND include interpolation, because, even though interpolation won't remove all jaggies artifacts, it will undoubtably and significantly lessen them.

So I was wondering if this could be done with an AVISynth script. Not only would it convert fields to frames, but also feature some sort of interpolation, like bicubic interpolation or something.

Another thing is that I want to later on add the 3:2-pulldown (a.k.a. Telecine) to the 24fps so that I get 30fps interlaced (so I can export back out to camera and it will play correctly on the TV). I know that AVISynth can do inverse telecine (IVTC, which is removing interlace lines so that 30fps interlaced goes back to 24fps progressive), but can it telecine (add pulldown (Adding interlace lines so that 24fps progressive goes up to 30fps interlaced with pulldown))?

I e-mailed Kwag about this, and he said that PULLDOWN.EXE can add the interlace lines for me so that 24fps 24P converts to 30fps 60i NTSC. So I looked up on Pulldown.exe, but it says it only edits tags for MPEG2 files. What's up with that?! If Pulldown.exe can work with AVI files, then please tell me. And what does it mean by it edits the tags? Telecine works by adding interlaced frames so that 24fps converts to 60i (by doing this: 1=1,1=2,1=3,2=4,2=5 and so on, that twelve times). I don't see how editing any tags could process this and add these frames. That's why I was asking if AVISynth could do it.

Thanks in advance for all your answers.

kwag 07-12-2002 03:01 AM

Hi Alvin:
It's great to see you here. I still don't have an answer for you ( still searching! ), but I found an interesting site with an EXCELENT article about interlacing, etc.
Please take a look: http://www.100fps.com/

Regards,
kwag

The Alvinator 07-12-2002 02:01 PM

Apparently, no one has an answer to this question...

Hey Kwag - that was a good article :!: It does in fact tell you how to go from fields to frames (Avisynth script:

AVISource("Yourmovie.avi")
separatefields

)

But, what it does is it just discards fields, squeezes the horizontal height, and doubles the framerate (every other frame being every other field).

I'd have to Bob, too.

This method does work, but in order for the correct aspect ratio, the horizontal resolution has to be doubled. I know Premiere can resize video, and it does in fact feature interpolation (by choosing "better resize"), so I could try that.

I still need an answer to my pulldown.exe question: Does it only work with MPEG2 files :?:

kwag 07-12-2002 06:17 PM

Well I just tried pulldown.exe, and it does work with an MPEG-1 video stream! I ran the resulting .m2v through bit rate viewer, and it shows the file as 29.97 MPEG-1, even though my original file shows at 23.976.
So give it a shot!

-kwag

The Alvinator 07-12-2002 07:27 PM

I've been playing a lot with this stuff in the last few hours. I've accomplished what I want (which is to go from 60i 30fps to 30fps with pulldown, same codec used throughout all processing)! The only problem is that my way is a little slow.

What I do is import my 60i AVI into AVIsynth, here's my script:

...Actually, I can't give the exact script because I didn't memorize it (it's on another computer) and I don't memorize the code (I used AVSGen to get the core of the script).

So it's basically like this:
Warning: Non-exact code following!! But hey, it may be right. This is just a guess. Here it goes:

AVISource("pathname")
Bob
Bilinearresize(720,480)

I've found that BiLinear resize and BiCubic resize deliver the exact same results, yet Bilinear is slightly/barely faster. I also found that using Bob instead of Separatefields is better, because VirtualDub's bob filter isn't as good as AVIsynth's (and this way I could get it all at once). I decided to add the resize because it offers interpolation, and it apparently is supposed to be better than Premiere's (which I was originally going to use). When using Bob, I know that it converts fields to frames. But does it keep the horizontal resolution the same? I decided to keep the resize there, just in case it does what Separatefields does, which is decrese the horiz res. by 2. Plus, as I mentioned earlier, resize adds interpolation.

Next, I open the AVS in VDub, and convert it to an AVI (now 60fps, with interpolation, and bob already applied) so I can use it in Premiere.

Then, in Premiere, I convert the framerate to 24fps by simply dropping fields.

Now, I just figured this out... Adobe After Effects, which I own, offers the ability to do 3:2-pulldown! So I did this, but it's a little slow (renders at like 6.5fps).

Tada, there ya go.

I was wondering if there was a way to write an AVISynth script that changes framerates (from 60fps to 24fps). Is it possible? Something like this (non exact code following!):

AVISource("pathname")
Bob
BilinearResize(720,480)
convertframerate(24)

This way, I could skip Adobe Premiere (But I'd still have to use VDub to export the script as an AVI file so I could use it in other apps that don't take .AVS).

Kwag, pulldown.exe works with mpeg 1 and 2 files, but not with AVIs.

Now there's another thing I want to try: Frameserving. I saw that Virtualdub has a frameserver, and I opened up the server and everything, but I don't know any apps that will open the vdub signpost file thingy.

You know what would be awesome?

If I could find a frameserver that could accept the VDub host, and have the ability to add pulldown, and export to AVI. That would be cool - I'd be able to go from start to finish with just 1 recompress!

So, to sum it all up, I have 3 questions:
  1. Is there a way to write an AVISynth script that features framerate conversion?
  2. Are there any other programs out there that will do 3:2-pulldown on AVI files?
  3. Would frameserving speed up the process in any way?

kwag 07-12-2002 07:49 PM

Hi Alvin:

1) Try the AviSynth reference manual, and check the Telecide() and Decimate() functions.

2) If you mean pull-down removal (IVTC), converting 29.97 to 23.976, you can do that right in Vdub. After you load your AVI, go to "Video/Frame Rate" and check the type of Inverse Telecine (3:2 pull down removal )

3) Depends on the filters you've selected. Without any filters, it should be about as fast as a direct read.

And for setting up your frameserver from Vdub, there's a folder in your Vdub directory named "aviproxy". Go there and click on the file "proxyon"
Now you'll be able to read the .vdr files with TMPEG.

-kwag

The Alvinator 07-12-2002 08:59 PM

Man, I love AVIsynth! :D

I finally read that scripting reference manual for AVIsynth. Geeze - this little tool can do so much!

Check this out. My old script was pretty bad, mainly because I didn't really know anything about AVIsynth when I wrote it. Here's my new one:


AVIsource("D:/test.avi")
Bob()
Pulldown(0,2)


These precious 3 lines get me from 60i 30fps up to 60P 60fps (with interpolation), then down to 24fps. That saves A LOT of time.

Turns out that the "Bob" function already does the bicubic (or bilinear, I forgot) interpolation, thus eliminating the need for "BicubicResize(x,x)" or "BilinearResize(x,x)". "Pulldown(0,2)" does exactly what I want: It converts 60fps to 24fps by selecting every third frame, then second, then third, then second, etc. until you get 24fps. Awesome! AVIsynth ROCKS! However, I can't seem to find a difference between using "Pulldown(0,2)" or "Pulldown(0,3)". My guess is that they do the same thing, but 0,2 goes every thrid then every second, and that 0,3 goes every second and then every third. The smoothness looks the same, and either way would work. I tried 0,4, but that was just a mess. I don't know what the hell it does when it does that, but it stinks.

I'm not asking for IVTC (Inverse Telecine, a.k.a. Pulldown Removal). Just plain 'ol Telecine. The opposite of Inverse Telecine. Oh well, I guess I'll just have to stick with After Effects (from now on called "AE")... That is, if I can't find any other pulldown insertion applications.

Hey, at least I saved a LOT of time using AVISynth.

Now.... if only I found a way to go straight from AVIsynth to AE... I doubt it would work, though. AE is not a media player, so it can't stream the files. It probably wouldn't work because AE most likely looks at the file and analyzes it, and it probably wont do it if it is a script, because it's not the actual file itself, but rather instructions to tell the player while playing the file.

But I could be wrong... Maybe that AVSWrapper thing might work. I have no idea....

Man - AVISynth is a godsend. I can't believe I never tried using this little app before. It's one of the best things I've used in my entire life. And it's not even hard at all - the reference manual explains it all.

I would like to thank you Kwag for sticking beside me and helping me through this journey, and most importantly for sort of "making" me try AVISynth. I probably wouldn't have tried it if you didn't say those things about how it could solve my problems.

kwag 07-13-2002 12:14 AM

Hey thanks Alvin. Any time! :lol: I'm glad you found the answer. Let me know if you encode something with your DigiCam, and make it 24p. I'd like to know the results. I'm about to get a DigiCam myself. Still evaluating different models.

Later!,
kwag

The Alvinator 07-15-2002 07:35 PM

For anyone who's interested:

Turns out that AVISynth can in fact ADD 3:2-pulldown :!:

This is amazing - My original mission (which was to go from 60i 30fps to 30fps with pulldown all at once) has been accomplished.

I thought it wouldn't be possible, but I guess not.

I was pretty sure that there was some way that AVISynth could do telecine, because it had the "weave" feature, which can create interlaced frames. And I was right.

Take a look at this script:


AssumeFrameBased
SeparateFields
SelectEvery(8, 0,1, 2,3,2, 5,4, 7,6,7)
Weave


After this is applied to a 24fps AVI (or immediately following the script that creates a 24fps file, which is what I did), it will yeild a 30fps AVI with the correct 3:2-pulldown applied. AWESOME!

I can't believe how awesome AVISynth is... I can't get enough of it.

syk2c11 07-17-2002 09:55 AM

Kwag,
I have gone through this particular topic, I can only understand 20% of it. Well, as you said, pulldown.exe works with mpeg-1. First of all, is "3:2 pulldown" means that the movie is encoded as 23.97 but it will be running at 29.97 when being played at a DVD player?

If this is the correct interpretation, then I would like to know where can I get pulldown.exe and how it works, because my player does not like 23.97 but it plays fine with video at 29.97 Hopefully, I will be able to use your KVCD Plus with 3:2 pulldown, it would be perfect!

kwag 07-17-2002 01:01 PM

Quote:

Originally Posted by syk2c11
Kwag,
I have gone through this particular topic, I can only understand 20% of it. Well, as you said, pulldown.exe works with mpeg-1. First of all, is "3:2 pulldown" means that the movie is encoded as 23.97 but it will be running at 29.97 when being played at a DVD player?

If this is the correct interpretation, then I would like to know where can I get pulldown.exe and how it works, because my player does not like 23.97 but it plays fine with video at 29.97 Hopefully, I will be able to use your KVCD Plus with 3:2 pulldown, it would be perfect!


Grab it here!:
http://www.doom9.org/software2.htm
And then read here:
http://www.kvcd.net/forum/viewtopic....1927958bae0c19

-kwag

syk2c11 07-17-2002 08:16 PM

Hi Kwag,
Thanks for your help. I have gone through the link you gave me. So, will muxing with BBmpeg have the same effect as using pulldown.exe? If it is so, then I would prefer to use BBmpeg because it is much easier. I have downloaded the pulldown.exe I double-click it, it gives me nothing, nothing happens at all. Is it a plug-in for FitCD or what?

The Alvinator 07-17-2002 08:40 PM

syk2c11, PULLDOWN.EXE is a command line program (much like toolame.exe for TMPGEnc). You can download a FE GUI for it, called PulldownBatch.exe (or something like that). Now it will run like a normal program.

muaddib 07-17-2002 08:59 PM

Should I use any aditional options in pulldown.exe?
Or the defaut otpions (just the input and output files) will do the job of setting the 3:2 pulldown like when you encode as SVCD?
What about the rff/tff flags options? Should I care about that?

I'm asking that because I tried pulldown.exe with no luck... :(

syk2c11 07-17-2002 09:05 PM

where can I get the pulldownBatch.exe??? Thanks!

kwag 07-17-2002 10:13 PM

Quote:

Originally Posted by syk2c11
where can I get the pulldownBatch.exe??? Thanks!

Home page here:
http://guiguy.wminds.com/downloads/pulldownbatchfe/

-kwag

syk2c11 07-17-2002 11:16 PM

Sorry guys, I don't mean to bother you people so much. I am just wondering what is the correct sequence now? Is it supposed to do the followings:

(1)---encode a video stream (m1v) by using KVCD plus template

(2)---use pulldownBatch.exe to convert (to apply pulldown) m1v to a m2v file

(3)---mux the m2v (generated by pulldownBatch.exe) and mp2 (generated by headAC3he) as MPEG-2 VBR by bbmpeg, do I select 3:2 or 2:3 in the pulldown option??

(4)---burn it with Nero as a non-standard SVCD

Also, I don't know how to set up the options inside pulldown.exe, which one should be checked and which one should not.

The Alvinator 07-19-2002 07:22 PM

And I thought it couldn't get any better...

I just further improved my AVISynth, using a new command called "ConvertFPS." This script attempts to convert the frame rate of the clip to a new rate without dropping or inserting frames, providing a smooth conversion with results similar to those of professional standalone converter boxes.

It uses a different algorithm based on frame blending to make up for the missing frames, and this algorithm works VERY well.

Because the new framerate has to be at least 2/3 of the original framerate, I have to convert the 60fps to 48fps, then use the "SelectOdd" filter to go to 24fps.

There are problems with this filter, though: It renders slower than what I used to do, sharpness is decreased (due to the blending), and excessive motion blur becomes apparent (again due to the blending).

However, the results are OUTSTANDING! I couldn't believe my eyes - the motion was as smooth as if frame interpolation were used.

It's great...

kwag 07-19-2002 10:21 PM

Hey Alvinator, you must now know the AviSynth functions on the reference manual like the palm of your hand :lol:
Isn't AviSynth a little jewel? I use it exclusively for just about everything now.

-kwag

The Alvinator 07-19-2002 10:46 PM

Hehehehe :lol:

Ever since I found out how useful this little jewel was, I can't get enough of it!

Now that I pretty much memorized the reference manual, I don't think I'll be asking any more questions about AVISynth...

thanks kwag.


All times are GMT -5. The time now is 04:39 PM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.