PDA

View Full Version : Trim() does not cut audio together with video.


jurij
6th November 2003, 16:52
hi!
i would like to know a workaround for triming audio and video together and keep them in sync.
let's say i have any audio file and a .d2v i can load them both (i can convert the audio to wav and load it in the avs script) but using trim() ith happens that the audio is not trimmed at all.
any solution for this?
i need it to cut commercials out when capturing from SAT TV.
THANX!

sh0dan
6th November 2003, 16:56
Post your script!

jurij
6th November 2003, 20:23
OK here's the script:

LoadPlugin("mpeg2dec3.dll")
video = mpeg2source("F:\sw\sw4.d2v")
audio = WavSource("F:\aa MPA T01 DELAY -396ms.wav")
AudioDub(video, audio)
trim(0,7747)+trim(13489,59549)+trim(65055,121630)


The clip is PAL 25 fps
What happens is that @ frame 7747 video is trimmed OK but audio is not exactly trimmed:
@ frame # 7747 (00:05:09)
-video is trimmed ok
-Audio is trimmed but it had a offset delay of -13 seconds
Maybe it's calculated with the wrong frame rate because trim() works with frames while audio is calculated in HH.MM.SS
hope that helped

sh0dan
6th November 2003, 20:32
What happends if you use


trim(0,7747)++trim(13489,59549)++trim(65055,121630)

Richard Berg
7th November 2003, 05:01
You should also have a DelayAudio() in there to match the filename, although that alone wouldn't produce sync errors of the magnitude you describe.

jurij
7th November 2003, 09:34
i delayed the audio wav in besweet, so it matches right, infact the 1st part before trimming is in sync

jurij
13th November 2003, 00:58
I have used:

trim(0,7747)++trim(13489,59549)++trim(65055,121630)

but nothing changed!
Please can you test the trim() function on a PAL movie with a wav source?
Thanx

h00z
13th November 2003, 05:11
I've been playing with the trim function today too. I'm having some problems getting it to play nice with the rest of my script, but I know it's something that I'm missing in the readme.

I'm trying to take an episodic DVD, combine the audio and video and then trim out each episode individually. I know it can be done, but every configuration I try brings an AVISynth error.

h00z
13th November 2003, 05:17
While I was typing that last reply I figured out my problem! w00t!

I really didn't mean to hijack your thread here... Just got excited ;)