Avisynth: Joining files using avisynth?
Hi All,
To Join 4 SVCD files to create one KVCD Plus 704x480 output file, I used the following script. My problem is trying to use TRIM to control the frames selected for each video. It doesn't seem to work. I get no errors from avisynth, but when previewed in tmpgenc the command is ignored. If you have any suggestions let me know. :) LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\MPEG2Dec\MPEG2DEC2.dll") # video=mpeg2source("D:\Temp\avseq01.d2v") audio=AVISource("D:\Temp\avseq01.wav") clip1=AudioDub(video,audio) #trim(clip1,0,5000) # video2=mpeg2source("D:\Temp\avseq02.d2v") audio2=AVISource("D:\Temp\avseq02.wav") clip2=AudioDub(video2,audio2) trim(clip2,30,0) # video3=mpeg2source("D:\Temp\avseq03.d2v") audio3=AVISource("D:\Temp\avseq03.wav") clip3=AudioDub(video3,audio3) #trim(clip3,0,5000) # unalignedsplice(clip1,clip2,clip3) # BicubicResize(704,480,0,0.6,0,0,480,480) #TemporalSmoother(2,1) AddBorders(0,0,0,0) Thanx |
hey black prince,
I don't know if you already know this or not- but the '#' before a command will make avisynth skip the command because it's a remark. In your script you have a # before 3 of the Trim commands- you need to remove those. ren |
hey ren,
look at the statement "trim(clip2,30,0)" It's uncommented. When I made this svcd movie over a year ago, I started the second svcd with 30 seconds of the end of the first svcd. With "TRIM", I wanted to remove this so the movie appears to have no gaps. By the way, the re-encodes of svcd to kvcd Plus are not only coming out with excellent quality, but the size is even smaller than DVD to KVCD. I am re-encoding "The Green Mile" which is a 3+ hrs using 704x480 and the size was 1.5GB without credits. I just finished viewing 1 hr 18 min and it's very very nice. I wonder if you and/or Kwag could comment on why the file size became even smaller. :) The re-encoded svcd's created with DVD2SVCD seem to create the best quality KVCD Plus movies. 8) |
3+ hrs -> 704x480 Plus -> 1.5 gb WITH SOUND! How did you do that!!?? I got a couple 3 hr movies onto 2 cds with the 352x480 Plus template but not the 704x480. I would say that it's smaller because it's a second generation encoding and there's quality loss- but if you say it looks good I won't argue with that :wink: Actually my re-encoded svcds look pretty good too- I didn't use any noise filters but I did have to deinterlace.
I don't know anything about the Trim command with avisynth because I never used that before- does it remove a number of frames from the start or end of a movie? |
hey ren,
Yes, it's true. I used KVCD Plus 704x480 with default settings. Also, used TemporalSmoother(2,1) and cut out movie credits. I too was supprised at the size, so I watched the whole movie (3 hrs., 8 min.). It was as good as the original SVCD, except it now fits on two CD's. Dvd2avi stats preview the movie as 4:3, 29.976 fps, so I set force film on to change it to 23.976 fps. Joined all the .dv2 using avisynth and created batch encoding job to turn off my computer when done. 15 hours later I created the audio using tmpgenc (170MB) via avisynth. Multiplexed using bbMPEG and the rest is history. The original svcd used 4 650MB CD's and filled them completely. I am going to try "Pear Harbor" next to make sure this was not a fluke. Trim is suppose to control starting frame and ending frames of the video. trim(clip,start frame,end frame) is the syntax. I think the clip parm is where I may be refrencing incorrectly. When you create an avs file using FitCD it's there commented out. But the refrence to a multiple video can also be used, if I can get it to work. My layman's theory is like yours. That with fewer bits to scan (SVCD) and the file produced should be smaller. Some SVCD's are very close to KVCD Plus 704x480. I personally like KVCD Plus 704x480 and will try to make a movie fit this encode. 352x480 is good, but 704x480 is the best. 8) |
Hey Ren,
Finally got this puppy to work nice. Selecting audio and video frames while keeping everything in sync finally works. Any suggestions as usual are welcome. So here we go: LoadPlugin("E:\DVD Backup\2 - DVD2SVCD\MPEG2Dec\MPEG2DEC2.dll") # video=mpeg2source("D:\Temp\avseq01.d2v") audio=WAVSource("D:\Temp\avseq01.wav") v1=trim(video,500,0) # <--- start from frame 500 to end (video) a1=trim(AudioDub(video,audio),500,0) # <--- start from frame 500 to end (audio) clip1=AudioDub(v1,a1) # <--- Join selected video/audio clip # video2=mpeg2source("D:\Temp\avseq02.d2v") audio2=WAVSource("D:\Temp\avseq02.wav") clip2=AudioDub(video2,audio2) # video3=mpeg2source("D:\Temp\avseq03.d2v") audio3=WAVSource("D:\Temp\avseq03.wav") clip3=AudioDub(video3,audio3) # video4=mpeg2source("D:\Temp\avseq04.d2v") audio4=WAVSource("D:\Temp\avseq04.wav") clip4=AudioDub(video4,audio4) # unalignedsplice(clip1,clip2,clip3,clip4) # <--- merge all A/V clips # BicubicResize(672,448,1/3,1/3,0,0,480,480) #TemporalSmoother(2,1) AddBorders(16,16,16,16) # <--- TV overscan from FitCD # I use tmpgenc to guide me on which frames to include. |
Hi black prince,
Can you explain the first part of your scrip? I got a little bit confused... Quote:
clip1=trim(AudioDub(video,audio),500,0) I believe that this line will join the video+audio and trim then both to start from frame 500 to end. Is it what you want? Regards, |
Muaddib,
a1=trim(AudioDub(video,audio),500,0) is compound. There is no direct way to trim the audio file except when the video is present. Avisynth doesn't seem to have a command to trim both at the same time. Therefore separate trims, v1 and a1. Try it and see what you think. :) |
Quote:
Here is what I found in the avs docs: "Trim trims a video clip so that it includes only the frames first-frame through last-frame. The audio is similarly trimmed so that it stays synchronized." |
Thanks Mauddib,
I did try trim(video,start frame,end frame). the result was the video was trimmed, but the audio was not. Go figure. :roll: The script I submitted is from VCDHelp's advanced avisynth guide. There you will find an example of this script and others. It works for both audio and video. Try a test case and if it works let me know. :) |
Hi black prince,
Here is the test I did: I was using this script to encode a music clip. I just add the wavsource at the beginning and the last trim command at the end. LoadPlugin("D:\DVD Rip Tools\mpeg2dec\mpeg2dec.dll") vid1=Mpeg2Source("C:\Temp\cassia_eller\malandragem .d2v") aud1=WavSource("C:\Temp\cassia_eller\malandragem.w av") vid2=Subtitle(vid1,"Malandragem",465,390,70,280,"a rial",33,$FFFFFF,$000000) vid3=Subtitle(vid2,"(Cazuza/Frejat)",470,414,70,280,"staccato222 bt",26,$FFFFFF,$000000) vid4=vid3.BilinearResize(480,480,0,0,720,480) vid5=Dissolve(Blackness(vid4,60),vid4,60) vid6=Dissolve(Trim(vid5,0,7202),Blackness(vid4,210 ),150) Trim(AudioDub(vid6,aud1),200,600) It works perfectly! The last trim results in the first 600 frames of video + audio, discarding the first 200 frames. The audio and video were in sync. |
Hi Muaddib,
I did a cut and paste of your script. Tested it and it worked. Thanks. :) I wanted a script to join wav file created by Mpeg Mediator from CD SVCD mpg files. I used VirtualDub to merge them into one wave via avs and Headac3he to create the final mp2. I tried to get Mpeg Mediator to read them all at once but, it kept quiting after the first avseq01.mpg. That's why I used the avs script to join these files. Not sure what my script was doing but thanks for the correction. |
Sure thing, black prince!
If it's working for you... great! :lol: I just point it cause I thought: "Why use 3 lines when you can do it with 1?" Bah... just ignore that! It's an old habit. (or should I say an optimization paranoia of an old programmer :lol: ) |
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.