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 12th May 2007, 11:47   #1  |  Link
Ignus2
Registered User
 
Join Date: Dec 2005
Posts: 250
audio cutting

Trim() refuses to cut audio-only clips.
Is there a plugin, which can cut audio, either sample based or frame based, if given fps?
(Or preferably both? )

--
Greets,
I.

Last edited by Ignus2; 12th May 2007 at 11:53.
Ignus2 is offline   Reply With Quote
Old 12th May 2007, 12:30   #2  |  Link
~bT~
н∂-ƒαиαтι¢
 
Join Date: May 2006
Location: Bedfordshire, UK
Posts: 1,005
try the avs cutter in megui.
~bT~ is offline   Reply With Quote
Old 12th May 2007, 12:42   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
Couldn't you just use blankclip and audiodub to attach video to the clips, and then trim them? You can then use audiodub again to attach the audio to a different video, or getchannels to return an audio-only clip, I think.

David
wonkey_monkey is offline   Reply With Quote
Old 12th May 2007, 20:50   #4  |  Link
Ignus2
Registered User
 
Join Date: Dec 2005
Posts: 250
Quote:
Originally Posted by davidhorman View Post
Couldn't you just use blankclip and audiodub to attach video to the clips, and then trim them?
And how do I know the length of BlankClip to create?
Ignus2 is offline   Reply With Quote
Old 12th May 2007, 21:51   #5  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
AudioLength(clip) will return the number of samples:

Code:
a=wavsource("...")
audiodub(blankclip(audiolength(a)),a)
David
wonkey_monkey is offline   Reply With Quote
Old 12th May 2007, 22:40   #6  |  Link
Ebobtron
Errant Knight
 
Ebobtron's Avatar
 
Join Date: Oct 2004
Location: St Louis, M0 US
Posts: 364
Hello,
At 41000 or 48000 samples per secound we have a whole lot of video frames being made. Not that there is anything wrong with that. Too many video frames will just be that, should not cause anything more than confusion.

if you would like the two to match a little closer try something like.
Code:
a=wavsource("...")
audiodub(blankclip((audiolength(a)/Audiorate(a))*yourfps),a)

audiolength(a)/Audiorate(a) = nSeconds of audio
http://avsfilmcutter.com
Ebobtron is offline   Reply With Quote
Old 12th May 2007, 22:56   #7  |  Link
Ebobtron
Errant Knight
 
Ebobtron's Avatar
 
Join Date: Oct 2004
Location: St Louis, M0 US
Posts: 364
sorry try this

Code:
a=wavsource("...")
audiodub(blankclip(length=int((audiolength(a)/audiorate(a))*yourfps),fps=yourfps),a)

audiolength(a)/Audiorate(a) = nSeconds of audio
This works, I tried it.
Ebobtron is offline   Reply With Quote
Old 12th May 2007, 23:32   #8  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Code:
Function AudioTrim(clip aclip, int start, int end, float "fps") {
  rate = Default(fps, 25.0) # or 23.976, 29.97
  end = (end != 0) ? end : Round(AudioLengthF(aclip) * rate / Audiorate(aclip))
  BlankClip(length=end, fps=rate)
  AudioDub(aclip)
  Trim(start, end)
  KillVideo() # 2.5.7 feature
  return last
}

Last edited by IanB; 14th May 2007 at 10:28. Reason: AudioLenghtF -> AudioLengthF
IanB is offline   Reply With Quote
Old 13th May 2007, 18:18   #9  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
Quote:
Originally Posted by IanB View Post
Code:
  end = (end != 0) ? end : Round(AudioLenghtF(aclip) * rate / Audiorate(aclip))
Typo there. Should be AudioLengthF.
stickboy is offline   Reply With Quote
Old 14th May 2007, 10:30   #10  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Oops! Ta! Fixed!
IanB is offline   Reply With Quote
Old 20th May 2007, 23:19   #11  |  Link
Ignus2
Registered User
 
Join Date: Dec 2005
Posts: 250
Good, it seems the only thing, that made this thread surface was the fact, that I didn't know about the existence of AudioLength(), AudioRate() and the like

(For others seeking this information, like me, it's documented here: http://avisynth.org/mediawiki/Clip_properties)

Thanks.

--
Greets,
I.
Ignus2 is offline   Reply With Quote
Old 1st August 2007, 21:14   #12  |  Link
Space Hopper
Registered User
 
Join Date: Mar 2002
Location: Denmark
Posts: 42
Quote:
Originally Posted by IanB View Post
Code:
Function AudioTrim(clip aclip, int start, int end, float "fps") {
  rate = Default(fps, 25.0) # or 23.976, 29.97
  end = (end != 0) ? end : Round(AudioLengthF(aclip) * rate / Audiorate(aclip))
  BlankClip(length=end, fps=rate)
  AudioDub(aclip)
  Trim(start, end)
  KillVideo() # 2.5.7 feature
  return last
}
Thanks, that worked great!
Space Hopper is offline   Reply With Quote
Reply

Tags
audiotrim

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 15:21.


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