digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: Trim and ConditionalFilter? (http://www.digitalfaq.com/archives/avisynth/12752-avisynth-trim-conditionalfilter.html)

Mental 11-01-2004 06:31 AM

Success!
 
Yippeee :!:

Thanks to the help here, I managed to get it working just right and tried it on some samples and two full length films to see if it caught any false scenechanges but it seems to be just right.

When shown in vdub the framerate appears anything up to a second out but plays okay so I don`t mind. For those who might find a use for a script that converts to 3D anaglyph format here`s the script I ended up with. Thanks again for this :D

# START OF SCRIPT
# Load audio source
audio=AVISOURCE("C:\AVI\video_data\video.avi")

# Load video file to convert to 3D
source=AVISource("c:\AVI\video_data\video.avi")

# Make a copy but one frame behind
source2=trim(source, 1, 0)

# Now convert them to RGB so we can adjust them
source=ConvertToRGB(source)
source2=ConvertToRGB(source2)

# Adjust files so one is red and one cyan
red =RGBAdjust(source, 1,0,0,1)
cyan=RGBAdjust(source2, 0,1,1,1)

# Overlay these two images together with a slight offset so that when
# there is no movement between frames to create true 3D a pseudo
# 3D effect will still be visible
video=Overlay(cyan,red,-4,-4,opacity=0.5,output="YV12")

# Tweak the output to brighten and make it more visible
video=Tweak(video, sat=2,bright=4,cont=2)

# Make lst = most recent frame
lst=Trim(video,1,0)

# Check for difference between this frame and next. If different
# replace with alternative
x=ConditionalFilter(lst, video, lst, "VDifferenceToNext()", ">", "16")

# Dub on the audio after resampling it
audio=SSRC(audio, 48000)
film=audiodub(x, audio)

# Speed up the film if needed to pal framerate
film=AssumeFPS(film, 25.000, true)

# Return amended file
return(film)
# END OF SCRIPT

muaddib 11-01-2004 12:49 PM

Nice script, Mental!
I'm glad you make it work! :D

incredible 11-01-2004 01:20 PM

The logic:

AssumeFPS(25,true)
ssrc(48000)

... means:
FIRST do the fps conversation incl. keeping audio in sync by using "true" and THEN afterwards using ssrc to get that synced audio to its desired khz samplerate. The other way around like you did it, wont work correct.

Mental 11-01-2004 06:19 PM

I didn`t think it made a difference whether ssrc came before or after as I thought it altered the sample rate only, but will try the other way :oops:

@muaddib I couldn`t have done it without all this help :)


All times are GMT -5. The time now is 04:36 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.