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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th February 2012, 15:00   #1  |  Link
Floatingshed
Registered User
 
Join Date: Nov 2008
Posts: 324
padding audio

I have several avi files that I want to join together and save as one file. These are clips that I created some time ago. It would appear that the audio is shorter than the video as, when joined, they gradually drift out of sync. The video lags.

Is it possible with avisynth to pad the audio stream to match the length of the video?

Thanks.
Floatingshed is offline   Reply With Quote
Old 18th February 2012, 15:47   #2  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Floatingshed View Post
It would appear that the audio is shorter than the video as, when joined, they gradually drift out of sync.
Even when joined with '++' (AlignedSplice) instead of '+' (UnalignedSplice)?
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 18th February 2012, 17:36   #3  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
If they all have the same kind of tracks (with same resolution etc.), you should also be able to join them with AVI Mux GUI.
sneaker_ger is offline   Reply With Quote
Old 18th February 2012, 17:55   #4  |  Link
Floatingshed
Registered User
 
Join Date: Nov 2008
Posts: 324
I'm not joining them with avisynth. I'm using avisynth to open the avi's and resize, normalise etc. Then the saved avs scripts are processed to 264 & aac and joined externally. So "++" doesn't come into play unfortunately. I can't use avisynth to join them as there are 341 of them and I very quickly run out of memory!

If I used Trim(0,0) would that force the streams to match length?
If need be how would I chop say 10 frames from the end of each one? Without changing each script manually! (The scripts are generated in a batch, I can add any number of filters but it must be the same for each script)

Last edited by Floatingshed; 18th February 2012 at 18:39.
Floatingshed is offline   Reply With Quote
Old 18th February 2012, 20:37   #5  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Floatingshed View Post
If I used Trim(0,0) would that force the streams to match length?
Yes, in that case, if the audio is shorter than the video, it will be padded with silence to match.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 18th February 2012, 21:34   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by Floatingshed View Post
If need be how would I chop say 10 frames from the end of each one?

Trim(0,FrameCount() -1 - 10)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 19th February 2012, 02:22   #7  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Quote:
Originally Posted by Floatingshed View Post
I can't use avisynth to join them as there are 341 of them and I very quickly run out of memory
Do you mean that your harddrive is full or that your system can't open that many files at once?
If you have harddrive space you can join 25 together at a time into a lossless intermediate.

Code:
@ECHO OFF
SET maxsources=25
SET customsource="C:\Program Files (x86)\anrichan3.3\cs.avs"
SET counter=0
SET counterB=0

CD %~1

IF EXIST "spliced\" (
  ECHO Spliced files already exist. OVERWRITING?!?
  PAUSE
)
MKDIR "spliced\"

SETLOCAL EnableDelayedExpansion
FOR %%G IN ("*.avi") DO (
  IF !counter! EQU 0 (
    ECHO import^(%customsource%^) > "spliced\!counterB!.avs"
  ) ELSE (
    ECHO \++\ >> "spliced\!counterB!.avs"
  )
  ECHO customsource^("%%~fG"^) >> "spliced\!counterB!.avs"
  SET /A counter += 1
  ECHO !counterB!.!counter! %%~fG
  IF !counter! EQU %maxsources% (
    SET /A counter = 0
    SET /A counterB += 1
  )
)

ECHO Encode Files?
PAUSE
CD "spliced"

SET vdub="C:\Program Files (x86)\anrichan3.3\VirtualDub-1.9.7\vdub.exe"
SET vcf="C:\Program Files (x86)\anrichan3.3\spliced.vcf"
FOR %%G IN ("*.avs") DO (
  %vdub% "%%G" /i %vcf% "%%~nG.avi"
)
PAUSE
cs.avs
Code:
function customsource(string X){
    avisource(X).converttorgb32
    (height==216) ? addborders(0,4,0,4) : nop()
    (width==368) ? lanczosresize(320,224) : spline36resize(320,224)
}
spliced.vcf
Code:
VirtualDub.audio.SetSource(1);
VirtualDub.audio.SetMode(0);
VirtualDub.audio.SetInterleave(1,500,1,0,0);
VirtualDub.audio.SetClipMode(1,1);
VirtualDub.audio.SetConversion(0,0,0,0,0);
VirtualDub.audio.SetVolume();
VirtualDub.audio.SetCompression();
VirtualDub.audio.EnableFilterGraph(0);
VirtualDub.video.SetInputFormat(0);
VirtualDub.video.SetOutputFormat(0);
VirtualDub.video.SetMode(1);
VirtualDub.video.SetSmartRendering(0);
VirtualDub.video.SetPreserveEmptyFrames(0);
VirtualDub.video.SetFrameRate2(0,0,1);
VirtualDub.video.SetIVTC(0, 0, 0, 0);
VirtualDub.video.SetCompression(0x7367616c,0,10000,0);
VirtualDub.video.SetCompData(1,"AA==");
VirtualDub.video.filters.Clear();
VirtualDub.audio.filters.Clear();
VirtualDub.SaveAVI(VirtualDub.params[0]);

Last edited by gyth; 19th February 2012 at 02:27.
gyth is offline   Reply With Quote
Reply


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 08:01.


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