Quantcast Avisynth: Trim and Conditionalfilter? - Page 2 - digitalFAQ.com Forums [Archives]
  #21  
11-01-2004, 06:31 AM
Mental Mental is offline
Free Member
 
Join Date: Sep 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
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

# 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
__________________
Dave
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #22  
11-01-2004, 12:49 PM
muaddib muaddib is offline
Free Member
 
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
Nice script, Mental!
I'm glad you make it work!
Reply With Quote
  #23  
11-01-2004, 01:20 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
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.
Reply With Quote
  #24  
11-01-2004, 06:19 PM
Mental Mental is offline
Free Member
 
Join Date: Sep 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
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

@muaddib I couldn`t have done it without all this help
__________________
Dave
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
KVCD: Can't trim file? FFCcottage Video Encoding and Conversion 3 05-04-2007 09:22 AM
Avisynth: Is is possible to use the trim() function with audio supermule Avisynth Scripting 3 09-10-2005 03:05 AM
How can you trim kvcd without screwing it up? phuquehair Video Encoding and Conversion 5 02-01-2005 10:03 AM
Avisynth: Trim? bigggt Avisynth Scripting 13 09-04-2004 03:05 AM
Avisynth: Trim and FadeIn/FadeOut2 J-Wo Avisynth Scripting 3 06-29-2003 10:55 PM

Thread Tools



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