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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st April 2006, 09:55   #581  |  Link
aichan
Registered User
 
Join Date: Feb 2006
Location: south east asia blue
Posts: 11
tritical, i encoded dvd anime the castle of cagliostro and deinterlaced it with TIVTC RC1 2pass. but why the frame on 2nd pass is fewer than 1st pass (140k vs 180k) ?

i dont remember exactly but the script was :
mpeg2source("lupan.d2v")
tfm().tdecimate() # (i forgot the parameter, but i copy exactly just like '2 pass anime hybrid' example you include on the package)
crop()
fft3dfilter() #default parameter
limitedsharpen() #default paramater

the result of 2nd pass is the video length is shorter than the source.
source : 1 hour 40 minutes
result : 1 hour 22 minutes

what is wrong with my script?
sorry, but i'm really new in encoding with avisynth
aichan is offline   Reply With Quote
Old 1st April 2006, 10:51   #582  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Second pass should always be less frames; for films it'll usually be near 1/5 less (unless it's really hybrid). But it shouldn't be shorter! Sounds like something else is setting the framerate wrong. You're muxing it with the timecode file after encoding, right?
foxyshadis is offline   Reply With Quote
Old 2nd April 2006, 08:16   #583  |  Link
aichan
Registered User
 
Join Date: Feb 2006
Location: south east asia blue
Posts: 11
no, the result file was not muxed yet. i encoded it using Megui (in x264 r477 package). encoded the first pass first, then the 2nd pass(result file). i encoded it in full length of the film so the output file was only 1 (video only).

i know 2nd pass frame is fewer cause x264 warned me that 2nd frame is fewer. i played the result and it has a shorter duration.
aichan is offline   Reply With Quote
Old 2nd April 2006, 21:32   #584  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Tritical, if you have time in the future, can you check on something for me? I get a lot of crashes using eedi2 on hi-res material ( > 500 lines or so, increasingly common the higher it goes, but sometimes it even works just fine on 2000 lines, eg, 1500x2000 images) in both yv12 and yuy2. They're not hard crashes, but Avisynth System Exception - Access Violations. I can provide samples where it consistently fails on almost every open (it usually works the first time, but not after), and if I dig around maybe less common ones. Trying it with a few large pics with imagesource should do it though.

Alternately, if it doesn't happen for you, I could try to debug, but I guess I'd need a debug avisynth? (I can make eedi2.)

fft3d does this sometimes as well, which is why I suspect it's an out-of-memory error (although I have 2gb, I'm not sure what avisynth can access), just weird that it happens at all different sizes.
foxyshadis is offline   Reply With Quote
Old 3rd April 2006, 09:21   #585  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
[link removed], changes:
Code:
  + Added pp parameter and pp modes 1, 2, and 3
  - A few minor internal changes
  - Fixed some documentation errors (field parameter)
  - do a vi.SetFieldBased(false) in constructor
  - fixed a bug causing reads past the last line and incorrect interpolation 
       of the very top or very bottom line in some cases
I'd meant to release this two months ago, but forgot about it. I would bet that that last change fixes the access violations. In a couple of routines the y checks were off by one and could lead to reading past the last line. If it still occurs let me know.

For debugging those types of errors it's probably the best/easiest if you can make a debug build of the filter + a debug build of avisynth and then open the script that causes the problem in vdub with the vs.net debugger running. Make sure it is set to break into the debugger on win32 exceptions. A debug build of avisynth also does some tracking of the values immediately before and after vfb's which can help catch outside writes.

@aichan
Did you get your problem worked out or no? The second pass having fewer frames is normal unless the entire video is hybrid like foxyshadis said. If you are doing a two pass encode with a codec then you'll need to run the first/second pass for the codec on the second tivtc script (I gather from your post that you ran the first pass on the first tivtc script and the second pass on the second script).

Last edited by tritical; 7th June 2006 at 21:11.
tritical is offline   Reply With Quote
Old 6th April 2006, 21:45   #586  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
In this thread:

http://forum.doom9.org/showthread.php?t=106837

I described the unique method I have devised for transferring film to video at a full 24 fps. The one sentence description of what is in that thread is that I remove the shutter from a 16mm film projector; videotape the output using a high shutter speed in the video camera; and then use modified IVTC software (TFM) to recover the original frames.

Here is a link to a 5-second AVI sample of what the raw capture from the projector looks like. This is a free server, so the link will only be good for seven days.

http://download.yousendit.com/4769F7937CBF6A84

This film transfer process always guarantees two good fields of video for each frame of film. The field immediately after the two good fields can either be:

1. A third duplicate (rare, but can happen).
2. A good field of the next frame of film.
3. A "bad" field showing the film in motion between frames.

The TFM portion of TIVTC.dll is absolutely awesome, and the new parameters -- especially the metrics parameter -- have gotten me to the point where everything is almost working.

However, I need help in two areas.

First, is there a way to have TFM make its decisions on a modified version of the clip, but then operate on the original clip? Much of the film I am transferring has sections that were poorly exposed (low contrast). TFM's comb detection, which on normally-exposed film works well, fails on the portions that are low contrast. A solution to this problem is to use "Levels" to increase the contrast. (Actually, this improves detection even for normally exposed film.) However, I don't want to do the exposure correction in AVISynth, because I can do a far better job later in Vegas (my video editing program). Thus, I want TFM to do its detection based on a modified version of my clip, but than do its frame recovery on the original clip. Perfect comb detection is essential to this process because the only time it occurs is when a video frame contains a field that was captured during pulldown (#3 in my list above). If you download the clip, you'll see that these are normally very easy to see visually, and with normal contrast material, TFM catches them quite easily (although if the pulldown has just barely started, the combing can be pretty slight).

I think I can write values to a file in one pass (using the "output" parameter) and then read them back in the next pass (using "input"), but I thought I'd ask if there is an easier way to handle this. The "clip2" parameter seems like it might be designed to do this, but I am not quite sure whether it can do what I am trying to do.

Second, decimation in my film transfer system cannot strictly be "1 of n" because the ratio of the projector speed to camera capture speed is not synced and is not absolutely, perfectly constant. I can get pretty close using cycleR=9,cycle=44 in tdecimate, but I still end up with a few duplicate frames (obviously I want to err on the side of having duplicates rather than drops). My current solution is a real kludge: I write parameters to a file, and then based on those parameters, create a file that can be read by MultiDecimate. Given that AVISynth has to know the total number of frames when it loads a file, this may be the only way to make arbitrary decimation work, but I'd thought I'd ask.
johnmeyer is offline   Reply With Quote
Old 6th April 2006, 22:35   #587  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
johnmeyer,
A little offtop, but do you know about my GetDups plugin?
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 6th April 2006, 22:49   #588  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
A little offtop, but do you know about my GetDups plugin?

No I don't, which is surprising because I thought I had used everything you've ever written. I'll go right now to check and see what it does.
johnmeyer is offline   Reply With Quote
Old 6th April 2006, 23:20   #589  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Very interesting plugin. It is close to what I was looking for, but it appears to be "hard-wired" for 16.67 fps. The projector I am using uses a synchronous motor that is set for 24 fps. Because of belt slippage, etc., it actually doesn't run precisely at that speed, so the decimation can't make any assumptions.

Even though I may not be able to use GetDups, I found HotSpot, which may help me eliminate the residual hot spot from the condenser/aerial lens arrangement I am using.
johnmeyer is offline   Reply With Quote
Old 7th April 2006, 01:30   #590  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,545
@johnmeyer

The clip2 parameter allows you to use deinterlaced frames from another source instead of using TFM's own postprocessing. I typically use this feature to postprocess my clips with EEDI2.

However, it doesn't allow you to process a different video than the one you analyse.

I'm not a programmer, but I don't think it would be too hard for Tritical to add this. Just go to his website and you can find his email at the bottom of the page.
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.
Revgen is offline   Reply With Quote
Old 7th April 2006, 01:51   #591  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
I think I just about have this figured out. With all the new controls in the latest versions of TFM, coupled with the "new" (to me) "Output" capability, I can output all the TFM decisions to an external file. From this, using my own software, I create an input file that MultiDecimate can use in the second pass. Since the whole thing has to be two passes, I use the Levels filter to increase the contrast on the first pass in order to get MUCH improved field matching and comb detection. I then, in the second pass, use the identical script, but without the Levels filter, but WITH the Multidecimate filter, using the external file I created as input.

The only thing I haven't yet figured out how to do is to get TFM to use all the decisions that it made during the first pass. The problem is that without the Levels filter, TFM wants to choose different fields. I'm still stumped on that.

Also, I'm posting elsewhere about a separate, smaller problem, namely that the film apparently wiggles sideways in the gate in the projector, sometimes causing the two good captured fields to not align. I need to figure out how to take each recovered frame from TFM and then re-align the two fields using Depan. I can get this to work field-to-field-to-field, but I don't want it to work between the second field of one frame and the first field of the next frame; I just want it to line up the two fields from one frame.

Last edited by johnmeyer; 7th April 2006 at 02:15.
johnmeyer is offline   Reply With Quote
Old 7th April 2006, 02:55   #592  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
input=YourOutputFile.txt

Thus, the results of the first pass are imported and no testing takes place (faster that way, too!).

I'm glad to know I'm not the only one who does things to filters they were never meant for.
foxyshadis is offline   Reply With Quote
Old 7th April 2006, 04:30   #593  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
input=YourOutputFile.txt
I'll work on that tonight and tomorrow morning and see how it works. Thank you!!

Yes, I'm definitely using this in a way that wasn't intended. I have a "Workprinter" for transferring 8mm movies, but when it came time to do 16mm, I couldn't bring myself to spend $2,000 for the equivalent machine in the larger format. I started to build my own, but after I took out the projector's shutter and started to think about things, it became clear that once the projector shutter is gone, if you captured using a REALLY fast video camera shutter speed (e.g., 1/1000 second), you would be absolutely assured of getting two consecutive fields of video for each frame of film. As I looked at the timing diagrams I drew, they looked identical to the IVTC problem, and that's how I ended up here.

The darn thing really works: "Workprinter" discrete frame film transfer, but at full 24 fps, including sound. My next step is to do the transfer with my HDV camera, something that cannot be done with workprinter (because HDV uses long GOP and therefore you cannot do frame-by-frame "grabs").
johnmeyer is offline   Reply With Quote
Old 8th April 2006, 01:20   #594  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Running tfm with output="" on the adjusted clip and then using the generated file as input when processing the normal one will work (it will use the matches and combed frame decisions from the input file). The one thing you will probably have to do is adjust the crc value stored in the file as it most likely wont match the non-adjusted clip. To get the crc for the non-adjusted clip use the output="" option to generate a file for it (it doesn't need to process any frames, just load the script in vdub and then close it). Once that file is generated just copy the crc value from it into the other output file. The crc value is computed from the first 15 frames of the clip.
tritical is offline   Reply With Quote
Old 8th April 2006, 02:13   #595  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Or just delete it like I do.

Anyway, Tritical, so far the new EEDI2 hasn't crashed on me yet, so I guess that was it. Thanks! I haven't strenuously tested it, if I do happen to catch anything later I'll give you a heads up.
foxyshadis is offline   Reply With Quote
Old 8th April 2006, 05:15   #596  |  Link
aichan
Registered User
 
Join Date: Feb 2006
Location: south east asia blue
Posts: 11
@tritical
my 2pass problem not worked out yet, alternatively i used 1 pass NTSC hybrid. when i compare the picture quality,2 pass tivtc is better than 1pass. btw, 2pass tivtc script is mkv vfr right? but i used it on mp4, is that okay?

i think yes, Megui detected it as hybrid film interlaced.

i'm going to try your suggestion, doing the 2nd pass with 2nd tivtc script. but if i do this, what about the 1st pass tivtc script?

thx
aichan is offline   Reply With Quote
Old 8th April 2006, 21:01   #597  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
I forgot that deleting it would also work. For backwards compatibility with super old versions a crc value isn't strictly required to be present .

@aichan
Quote:
btw, 2pass tivtc script is mkv vfr right? but i used it on mp4, is that okay?
The 2 pass vfr mode will only work when muxing to mkv as the final container because the a/v sync is maintained by using the generated timecode file when you mux the video. Even though mp4 supports vfr, there is no way to do this when creating an mp4 file (that is, there is currently no way the user can directly specify frame durations for individual frames in the same way you can with an mkv timecode file). AFAIK, the only ways to create an mp4 file with this type of vfr are:

1.) encode each fps section separately to mp4 and then concatenate them.

2.) use my tc2cfr program with the timecode file that tdecimate generates as input to generate a 120fps avi file. Then mux that avi file into mp4 which should remove the null frames. Of course, this method requires the video to be in the avi container.

I would recommend reading http://www.avisynth.org/VariableFrameRateVideo if you haven't already.

Quote:
i'm going to try your suggestion, doing the 2nd pass with 2nd tivtc script. but if i do this, what about the 1st pass tivtc script?
My statement wasn't very clear. I just meant the relationship between tivtc passes (for 2 pass vfr) and codec passes (when doing a 2 pass encode with xvid/x264/etc...) needs to be:

1.) run 1st tivtc script - no codec pass
2.) run 2nd tivtc script - codec first pass
3.) run 2nd tivtc script - codec second pass

which you were probably already doing.

Last edited by tritical; 8th April 2006 at 21:04.
tritical is offline   Reply With Quote
Old 9th April 2006, 19:22   #598  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
[link removed], changes:
Code:
TFM:
   + minor field matching improvements
   + optimized postprocessing (mmx/sse2 cubic/blend deint, mmx/sse2 motion
          map creation, mmx/sse2 clip2 mask copy, faster link/denoise routines)
   + added ovr help information listing to bottom of output file
   - call setcachehints for clip2 when used

TDecimate:
   - fixed opt parameter not be respected in the blurring functions used
        when predenoise=true

RequestLinear:
   - fixed not testing if n <= rlim if the current request was <= to the last
        request (it was only testing if rall=true)
The ovr help info that gets added to the end of tfm's output files lists the following:
Code:
1.) detected combed frames
   a.) frame #, mic value
   b.) ranges allowing small breaks with non-combed frames

2.) possible missed combed frames
   a.) frame #, mic value

3.) u/b and against order (either n or p) matches
   a.) frame #, match

Last edited by tritical; 8th May 2006 at 13:57.
tritical is offline   Reply With Quote
Old 10th April 2006, 10:08   #599  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
[link removed], changes:
Code:
   + optimized combed frame detection functions (now match tivtc)
   + added second spatial combing metric and "metric" parameter (same
         as tfm and is/showcombeditvtc)
   + optimized denoise routines
   + improved the field comparison routine (now equal to slow=0 in tfm)
   + mode 2 uses the field comparison routine instead of full frame
         subtract for determining the best matching frame (more accurate)
   - directly assign frames from emask clip (no need to copy)
   - changed blim default to -2.0 (disabled)
   - call setcachehints for emask/edeint clips when used
While working on tdeint I noticed a bug in one of tivtc's mmx routines that is used during combed frame detection on yuy2 clips in tfm/iscombedtivtc. It will only be used if you do not have a processor which supports isse or sse2... a workaround is to use opt=0 in tfm and iscombedtivtc. The bug will be fixed in the next version of tivtc.

As far as tdeint/tivtc go, the following are left on the list of things to do:

tdeint:
1.) possibly add slow=1/2 and mchroma field matching functionality so that tdeint matches tfm
2.) html doc

tivtc:
1.) hclip for tdecimate hybrid=1/3
2.) fix bug in mmx routine
2.) html docs

I would like to get that stuff done and release final versions sometime soon. I've made some improvements to eedi2 so there'll be a new version of that as well. After that I'm planning to finally get back to making a motion masking filter capable of producing longer masks (8 or more fields) to be used with tdeint via the emask parameter.

Last edited by tritical; 5th October 2006 at 01:49.
tritical is offline   Reply With Quote
Old 10th April 2006, 18:11   #600  |  Link
malouf
Registered User
 
Join Date: Sep 2004
Posts: 4
Hi,

I have a problem with TDeint. I'm using it to deinterlace an interlaced video, captured from a videogame with a capture card.

It works wonderfully, except on some frames (pretty rare), that I found are normal interlaced frames, but repeated 2 times or 3 times, probably a bug when the stream was captured.

The problem is that the 2 identical frames are interlaced, and handled like 2 different frames by tdeing, and it generates some very ugly artifacts... And if I just delete them, I have a sound that keeps getting more out of sync.

Is there any parameter that can be used to not have this problem, or something I can do on the video before deinterlacing it? A perfect thing would be a parameter on tdeint that tells it to ignore a frame when it is perfectly identical to the last, and just output a duplicate deinterlaced frame (to keep sound sync).

Anybody had this kind of problems?

Thanks.
malouf is offline   Reply With Quote
Reply

Tags
tdeint, tivtc

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 17:26.


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