Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd December 2010, 16:56   #1  |  Link
Daodan
unrecognized user
 
Join Date: Oct 2005
Location: home of Stella Artois
Posts: 303
30i on top of 24p

I've looked the forums high and low, but couldn't find a thread about this particular problem, although I doubt it's new.

So let's say we have 24p scrolling images, then telecined to 30i, and on top of it overlayed a pure 30i of scrolling text.

How would one restore such a thing to a smooth motion of both the images and the text? I can only seem to manage to get 24p with proper motion in back and ok but jumpy text, or 30p with smooth text and obviously jumpy background due to duplicates.
Is there a way?
Thanks.
__________________
zzz
Daodan is offline   Reply With Quote
Old 23rd December 2010, 17:07   #2  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
Convert to 60p.
1) IVTC the background part and apply 6:4 pulldown.
2) Bob the 30i text part.
roozhou is offline   Reply With Quote
Old 23rd December 2010, 17:14   #3  |  Link
Daodan
unrecognized user
 
Join Date: Oct 2005
Location: home of Stella Artois
Posts: 303
Hm, I'm not sure I understood what you mean. It sounds like the 24 and 30 parts are separate. But they're not separate. The 30i is scrolling on top of the 24p.
__________________
zzz
Daodan is offline   Reply With Quote
Old 23rd December 2010, 17:45   #4  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
You can look at the p60to24p function:
http://forum.doom9.org/showthread.ph...547#post814547
However this may be not the best tool to achieve what you need.

The following function deinterlaces 60i credits on the top of a 24 fps telecined footage. It virtually oversamples the video to 120 fps with motion interpolation on credits only, and decimates to 24 fps. It has the advantage of avoiding footage frames interpolation, leaving them very clean, whatever the motion they contain. However, the drawback is that it requires to manually measure the origin of the 3:2 pulldown pattern (and split the clip in parts if it changes).

Code:
# Version 1.1
Function ivtc_txt60mc (clip src, int frame_ref, bool "srcbob", bool "draft")
{
	srcbob    = Default (srcbob, false)
	draft     = Default (draft,  false)

	field_ref = (srcbob) ? frame_ref : frame_ref * 2
	field_ref =      field_ref  % 5
	invpos    = (5 - field_ref) % 5
	pel       = (draft) ? 1 : 2

	src
	  (srcbob) ? last
\	: (draft ) ? Bob ()
\	:            QTGMC (SourceMatch=3, Lossless=2, tr0=1, tr1=1, tr2=1)

	clean  = SelectEvery (5, 1 - invpos)
	jitter = SelectEvery (5, 3 - invpos, 4 - invpos)
	jsup   = jitter.MSuper (pel=pel)
	vect_f = jsup.MAnalyse (isb=false, delta=1, overlap=4)
	vect_b = jsup.MAnalyse (isb=true,  delta=1, overlap=4)
	comp   = jitter.MFlowInter (jsup, vect_b, vect_f, time=50, thSCD1=400)
	fixed  = comp.SelectEvery (2, 0)
	Interleave (clean, fixed)
	Trim (invpos / 2, 0)
}
The src parameter is a 30 fps interlaced clip. The frame_ref parameter indicates on which frame begins the 3:2 pattern (first frame number of a clean-combed-combed-clean-clean sequence). Add SetMemoryMax (1500) at the beginning of your script if you are processing HD content.

I've put in this archive examples showing several common methods to deinterlace 60i credits. The one covered by the above script is correct.mp4.

If you can read french, I wrote a more detailed article about this kind of issue:
http://qualiter.fr/viewtopic.php?f=11&t=24
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding

Last edited by cretindesalpes; 9th May 2011 at 04:05. Reason: Added srcbob and draft parameters.
cretindesalpes is offline   Reply With Quote
Old 23rd December 2010, 18:39   #5  |  Link
Daodan
unrecognized user
 
Join Date: Oct 2005
Location: home of Stella Artois
Posts: 303
Sounds pretty good. The problem is it's so slow that I can't test it. Around 1 min per frame. Can't that qtgmc be replaced with smth else for speed?
__________________
zzz
Daodan is offline   Reply With Quote
Old 23rd December 2010, 18:56   #6  |  Link
TheRyuu
warpsharpened
 
Join Date: Feb 2007
Posts: 787
Quote:
Originally Posted by Daodan View Post
Sounds pretty good. The problem is it's so slow that I can't test it. Around 1 min per frame. Can't that qtgmc be replaced with smth else for speed?
Pretty sure you can just insert any random bobber there (yadif, nnedi, etc). nnedi3 is probably going to give you the best bang for your buck I guess.
TheRyuu is offline   Reply With Quote
Old 23rd December 2010, 19:03   #7  |  Link
roozhou
Registered User
 
Join Date: Apr 2008
Posts: 1,181
The scrolling credit only occupies a fixed area in the image. Cut the rectangle(top and bottom location should be mod4) off and run deinterlacer on it. Do IVTC to the rest of the image. Overlay the deinterlaced rectangle back to the original place.

Remember doing anything other than IVTC to telecined part will destroy the image.
roozhou is offline   Reply With Quote
Old 23rd December 2010, 19:53   #8  |  Link
Daodan
unrecognized user
 
Join Date: Oct 2005
Location: home of Stella Artois
Posts: 303
Quote:
Originally Posted by roozhou View Post
The scrolling credit only occupies a fixed area in the image. Cut the rectangle(top and bottom location should be mod4) off and run deinterlacer on it. Do IVTC to the rest of the image. Overlay the deinterlaced rectangle back to the original place.

Remember doing anything other than IVTC to telecined part will destroy the image.
Interesting idea. I wonder how would that look. In any case, the text is more than 2/3 of the screen so it's no use here.

@cretindesalpes, that demo sample is very good, but I can't replicate the good results here. I did a couple seconds in the end and the script did it's thing, the text is definitely shifted compared to a normal ivtc, quite interesting, but it's not 'evenly distributed' so ti's still jumpy, slightly less than before.
I should mention the text and background both scroll the same way, unlike the demo where one was vertical and the other horizontal.
__________________
zzz
Daodan is offline   Reply With Quote
Old 23rd December 2010, 21:05   #9  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Quote:
Originally Posted by Daodan View Post
Around 1 min per frame.
On which hardware ? I've got 0.75 fps with these settings (1440x1080) on a 4-core CPU, using only 50% CPU. Make sure you've allocated enough memory to AviSynth, otherwise things tend to become damn slow. QTGMC + subsequent MVTools is a real resource hog. Also, you shouldn't do any other processing in this script because of the aforementioned reasons. Load the video, trim the segment to process, call ivtc_txt60mc and save the result to a lossless file.

Quote:
Originally Posted by Daodan View Post
I did a couple seconds in the end and the script did it's thing, the text is definitely shifted compared to a normal ivtc, quite interesting, but it's not 'evenly distributed' so ti's still jumpy, slightly less than before.
Make sure the frame_ref value is correct, and constant on all the processed clip. If it still doesn't work, post a sample.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 23rd December 2010, 21:45   #10  |  Link
Daodan
unrecognized user
 
Join Date: Oct 2005
Location: home of Stella Artois
Posts: 303
Well, I have a decent c2d, but i guess memory might be a problem.
Here's a raw sample: http://ul.to/zsq2yv
Compared to normal ivtc, where i get normal jump, normal jump, normal jump, big jump (the scrolling text), with this script now I get small jump, small jump, big jump, big jump. Which makes things slightly worse. I'm pretty sure the frame ref value was good, because the background remained in same position as normal ivtc (I tried other values and it's always worse).
__________________
zzz
Daodan is offline   Reply With Quote
Old 24th December 2010, 00:15   #11  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Quote:
Originally Posted by Daodan View Post
Here's a raw sample: http://ul.to/zsq2yv
This works well with frame_ref = 0. But your input is not frame-accurate (typical with BD m2ts sources), hence the jumps. Possible workarounds:
  • Use RequestLinear() after your source. Works well during the actual processing, but your Trim may still be off by a few frames.
  • Reencode the whole stream in a single pass. Ex: x264 --preset ultrafast --tff --qp 0 --output accurate.mp4 inaccurate.avs with a single line DSS2("myfile.m2ts") in the script. Then use accurate.mp4 with a decent source filter, like FFmpegSource2().
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding

Last edited by cretindesalpes; 24th December 2010 at 00:19.
cretindesalpes is offline   Reply With Quote
Old 24th December 2010, 01:37   #12  |  Link
Daodan
unrecognized user
 
Join Date: Oct 2005
Location: home of Stella Artois
Posts: 303
Can't say I managed to improve it. I'll try some more later.
Can you upload the processed clip somewhere to see how it should turn out?
__________________
zzz
Daodan is offline   Reply With Quote
Old 24th December 2010, 10:15   #13  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Quote:
Originally Posted by Daodan View Post
Can you upload the processed clip somewhere to see how it should turn out?
(broken link)
I also had to increase SetMemoryMax to 1300.
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding

Last edited by cretindesalpes; 16th June 2011 at 09:22. Reason: broken link
cretindesalpes is offline   Reply With Quote
Old 24th December 2010, 17:19   #14  |  Link
Daodan
unrecognized user
 
Join Date: Oct 2005
Location: home of Stella Artois
Posts: 303
Thanks. Looks good. Too bad I can't replicate the results. If values are the same as in the posted script, I guess it must be a wrong filter version on my side.

Later edit: seems like I solved the problem, thanks for the help.
__________________
zzz

Last edited by Daodan; 24th December 2010 at 18:12.
Daodan is offline   Reply With Quote
Old 25th December 2010, 04:34   #15  |  Link
TheRyuu
warpsharpened
 
Join Date: Feb 2007
Posts: 787
Quote:
Originally Posted by cretindesalpes View Post
This works well with frame_ref = 0. But your input is not frame-accurate (typical with BD m2ts sources), hence the jumps. Possible workarounds:
  • Use RequestLinear() after your source. Works well during the actual processing, but your Trim may still be off by a few frames.
  • Reencode the whole stream in a single pass. Ex: x264 --preset ultrafast --tff --qp 0 --output accurate.mp4 inaccurate.avs with a single line DSS2("myfile.m2ts") in the script. Then use accurate.mp4 with a decent source filter, like FFmpegSource2().
Any of the dgavcdecode/nv/di should be fine when dealing with BD material. dss2 is ok although i've found it to not be frame accurate (or work) all the time. ffms2 sometimes works although with interlaced you do get a weird doubling framerate sometimes with interlaced content (if it even works).

Given the choice I would output it to mkv, not mp4, although h264 lossless would not be my first choice (see below).

Since the section we're talking about is probably not very big (an opening/ending perhaps), your second option to encode to some type of lossless file first is probably the best option, although I would use ut video instead of h264 lossless.
TheRyuu is offline   Reply With Quote
Old 16th June 2011, 15:40   #16  |  Link
The Showstopper
Registered User
 
Join Date: Dec 2009
Posts: 10
Hi, I'm trying to do a script but it keeps geting me the error of invalid arguments for the function "ivtc_txt60mc", here is the part where it gets the error:

Code:
Trim(0,38889).AnimeIVTC(mode=4, omode=2, pass=1) + Trim(38890,40626).ivtc_txt60mc(frame_ref=108) + Trim(40627,41089).AnimeIVTC(mode=4, omode=2, pass=1)
Is it because I didn't use the "src_bob" and "draft" parameters?? Btw the frame_ref is the frame of the entire video (in that case it would be 38908) or only of the trimmed part (it would be 108)??
The Showstopper is offline   Reply With Quote
Old 16th June 2011, 16:43   #17  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
frame_ref is a mandatory parameter (it is not enclosed in quotes in the function definition), so cannot be passed by name.

... + Trim(38890,40626).ivtc_txt60mc(108) + ...

but if your 38908 is correct, it should be 18, not 108.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 17th June 2011, 01:51   #18  |  Link
The Showstopper
Registered User
 
Join Date: Dec 2009
Posts: 10
Thanks, it worked, btw what if the background instead of being 24p, was 29p would it still work?? If not would it be possible to make a script like this for 29p parts?

EDIT: Forget about that I thought I had 29p parts but it was just that the telecine was hard to spot... Is there something that we can change on the script to obtain credits at 29,970p instead of 23,976p?? But the backgorund stays at 24p

Last edited by The Showstopper; 17th June 2011 at 16:30.
The Showstopper is offline   Reply With Quote
Old 22nd April 2016, 09:02   #19  |  Link
blank000
Registered User
 
Join Date: Mar 2016
Posts: 3
Hi, cretindesalpes

Is this function interchangeable with mvtools-pfmod2.7.0.1?
It was used by the same condition, but error

"Error requesting frame 1"
"windowsError: exception: access violation reading 0x34AEF406"

Should this question be done by other threads?

system environment
windows10_32bit
Avisynth260_x86
blank000 is offline   Reply With Quote
Old 27th April 2016, 05:23   #20  |  Link
thecoreyburton
Guest
 
Posts: n/a
If you're comfortable with having a VFR file as your output you could very comfortably IVTC the 24p sections and deinterlace the interlaced sections (albeit only to 30p) and have the resulting clip play both parts at their resulting rate.

It's not too tricky when you've done it a few times and if you want to go down this path I'd be happy to help.
  Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:42.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.