Is there any good way to split or cut up video and audio without having to recompress it multiple times?
For example, lets say I rip a single episode off a DVD of mine from an uncut version and rip a cencored/edited version as well. The uncut version has a much better looking video source than the edited version, but it's voice dubbing is entirely different. I want the voice dubbing from the edited/censored version. It's also got more video footage due to being uncut so the added footage need removed to sync with the edited/censored versions audio.
What I am wanting to do is take the audio from the edited/censored version, take the superior video from the uncut source, and then cut only the extra footage out, so that it will sync with the edited/censored versions audio.
Any methods or suggestions for this?
Can I use avisynth alone to do this and specify which video frames I wish to keep and which frames I wish to discard? I know how to take out only one part by specifying start and end frames to encode, but I don't know how to take out several parts and then put them together in one go if you can do that.
Do I need to encode it first as the uncut version and then cut up the compressed encoded video? If so can that be done without having to recompress it when saving the finished job?
+ Reply to Thread
Results 1 to 30 of 35
-
-
The obvious answer would be
Trim(0,a) ++ Trim(b,c) ++ Trim(d,e)
And so on...
Or am I missing something in what you're asking? -
So something like this is what your suggesting?
source=DGDecode_mpeg2source("C:\Users\Admin\Deskto p\VTS_01_1.d2v", info=3).ColorMatrix(hints=true, interlaced=true, threads=0).tfm(order=1).tdecimate(hybrid=0).crop( 0, 0, -4, -2).LanczosResize(640,480)
clip1=Trim(source, 0, 8812)
clip2=Trim(source, 12813, 13220)
clip3=Trim(source, 15221,89686)
clip4=Trim(source, 90687,91994)
clip5=Trim(source, 93995,0)
Return clip1 + clip2 + clip3 + clip4 + clip5 -
Will it cut out the frames I didn't specify like I want it to if I use it like that, or does it just not filter them at all? So far I have only used it to apply different filters to different frames. I haven't tried not specifying certain frames at all before.
-
AVISynth only creates frames that the script specifically requests. Trim(framecount-1,framecount-1) will give you the last frame, and no, no other frame will be touched. Basically, AVISynth will request the last frame from MPEG2Source, apply whatever filters have been requested to it and then return only that one frame. Likewise Trim(framecount-2,framecount-2) ++ Trim(framecount-1,framecount-1) will give you the last two frames. Just extend the logic from there, it's really not hard.
-
That script will join together all the sections indicated by the trim start and end frame numbers. Everything else gets removed. And to make any use of it you'll have to reencode. And there's no audio in that script, although one can be created to cut and join the audio at the same time and in the same way.
-
I would love to learn how to make a script that cut the audio and video in the same exact places in one go. I didn't know avisynth could cut or even work with audio. I thought I would have to do that the hard way and cut the audio in an editor separately.
-
AudioDub plus FFAudioSource (or the lsmash variant) to convert it to PCM... you can't actually pass through the original audio codec so you'd have to re-encode it at the other side. If you're dealing with a lossy source that might not be what you want, but if you're dealing with lossless and are happy with FLAC (or just PCM) then it's doable.
-
Yes, with DVD sources I get the audio when making the D2V project file and convert it to WAV audio for further work in Audacity (something you may or may not want or need to do). Then I use AudioDub to join them. Then you can split everything as you did before. To save out the audio, rather than Save As Avi use Save WAV in VDub instead. Maybe something like this:
A=MPEG2Source("Video.d2v")
B=WAVSource("Audio.wav")
AudioDub(A,B)
Trim(0, 8812)++Trim(12813, 13220) ...
If you want to work with the AC3 audio (and still save it out as WAV audio), I believe you'll need the NicAudio.dll. Or do as ndjamena suggested and use FFAudioSource. -
I have another question now. Is there a way to cut and combine video frames from 2 different episodes with the script I asked about above?
What if I cut everything I needed from episode 2, and then need to take some frames out of episode 3 as well, due to the uncut being longer in length and more episodes?
The episodes end at different points in the edited and uncut versions.
How could I get what I need from the next episode to put with the previous one?
This would be my best guess, but I don't know if it would work or not. I don't think this would combine them together. It seems to me like this does what I want with episode 2 and episode 3, but doesn't combine both separate sets at the end. How should I go about doing this? This might even conflict and not work at all, I haven't tried it.
source=DGDecode_mpeg2source("C:\Users\Admin\Deskto p\VTS_01_1.d2v", info=3).ColorMatrix(hints=true, interlaced=true, threads=0).tfm(order=1).tdecimate(hybrid=0).crop( 0, 0, -4, -2).LanczosResize(640,480)
clip1=Trim(source, 0, 8812)
clip2=Trim(source, 12813, 13220)
clip3=Trim(source, 15221,89686)
clip4=Trim(source, 90687,91994)
clip5=Trim(source, 93995,0)
Return clip1 + clip2 + clip3 + clip4 + clip5
source=DGDecode_mpeg2source("C:\Users\Admin\Deskto p\VTS_01_2.d2v", info=3).ColorMatrix(hints=true, interlaced=true, threads=0).tfm(order=1).tdecimate(hybrid=0).crop( 0, 0, -4, -2).LanczosResize(640,480)
clip1=Trim(source, 0, 6812)
clip2=Trim(source, 16813, 19220)
clip3=Trim(source, 25221,39686)
Return clip1 + clip2 + clip3 -
Once you use return in a script nothing will happen after that.
Open one, open the second. Use trim statements to stick the extra material where you like. Maybe something like this:
X=MPEG2Source("Movie1.d2v")
Y=MPEG2Source("Movie2.d2v")
A=X.Trim(0,1000)
B=Y.Trim(1001,2000)
C=X.Trim(2001,3000)
A+B+C
There are lots of ways to do it. I usually prepare the part to be added in a separate folder and then when it's ready and cut, move it to the main folder. Also, I work with lossless Lagarith AVIs. So, if you have the 'MainVideo.avi' and have an 'Insert.avi' to be added to the middle:
Insert=AviSource("Insert.avi")
MainVideo=AviSource("MainVideo.avi")
A=MainVideo.Trim(0,1000)
C=MainVideo.Trim(2001,3000)
A+Insert+C
With audio you have to be more careful (and use ++ rather than + to join everything). But before encoding you can play the script to make sure everything's okay. -
AVISynth doesn't care where frames come from, you can mix and match them from anywhere to anywhere.
a=mpeg2source("video 1.d2v")
b=mpeg2source("video 2.d2v")
trim(b,456,876) ++ trim(a,123,456) ++ trim(b,987,1034) ++ trim(a,3456,5434)
Will work just as well as any other combination, as just as quickly as if that was always the order to begin with.
AVISynth will do whatever you tell it to, it only requests frames you've told it you want, and it can seek to any point at any time. -
http://avisynth.nl/index.php/Operators
+ same as the function UnalignedSplice
++ same as the function AlignedSplice
AlignedSplice Ajusts the audio (cuts off sound or inserts silence as necessary) to ensure that the sound remains synchronized with the video.
UnalignedSplice Simply concatenates the sound without regard to synchronization with the video. -
Thanks for that fill in. It makes sense now.
So I guess ending my script I asked about above like this is a good idea?
Return clip1 ++ clip2 ++ clip3 ++ clip4 ++ clip5 -
MeGui had a simple way to cut video and audio it looked like. I decided to try this tool because it makes a cut file for the audio to match it and its easier for me to make sure the audio syncs that way.
The script from the cutting tool I used became this. It added the cuts to the script in a different way than I am used to seeing or trying. I did it like the script I asked about above with the clips= in them, but the MeGui avs cutting tool I just tried, cut it like this.
DGDecode_mpeg2source("C:\Users\Admin\Desktop\Encod ing\VTS_01_1.d2v", info=3)
ColorMatrix(hints=true, interlaced=true, threads=0)
tfm(order=1).tdecimate(mode=1,hybrid=0)
crop( 10, 0, -8, -2)
LanczosResize(640,480) # Lanczos (Sharp)
dehalo_alpha(rx=1.5, ry=1.5, darkstr=0, lowsens=0, highsens=50, ss=1.0)
santiag()
LimitedSharpenFaster(ss_x=1.0, ss_y=1.00, strength=6, overshoot=0, undershoot=0, soft=0, edgemode=0)
tweak(cont=1.01, coring=false)
__film = last
__t0 = __film.trim(8750, 9740)
__t1 = __film.trim(10781, 11302)
__t2 = __film.trim(12083, 12864)
__t3 = __film.trim(14271, 15260)
__t0 ++ __t1 ++ __t2 ++ __t3
How would I go about adding specific frames from the next episode to be combined with this from episode 2?
Would I change the "__film = last" to something else? I feel like I would have to replace that line all together with something else in order to be able to load both episodes to trim from. -
I haven't used the program but I doubt MeGui would be designed to mix multiple clips.
What I'd do is:
Code:DGDecode_mpeg2source("C:\Users\Admin\Desktop\Encod ing\VTS_01_1.d2v", info=3) ++ DGDecode_mpeg2source("C:\Users\Admin\Desktop\Encod ing\VTS_01_2.d2v", info=3)
Then just take the frame ranges out of order from there.Last edited by ndjamena; 22nd Feb 2017 at 21:15.
-
I already explained one way to you and even gave an example.
Insert=AviSource("Insert.avi")
.
.
.
__film = last
__t0 = __film.trim(8750, 9740)
__t1 = __film.trim(10781, 11302)
__t2 = __film.trim(12083, 12864)
__t3 = __film.trim(14271, 15260)
__t0 ++ __t1 ++ Insert ++ __t2 ++ __t3
Of course, resolution, framerate, audio, etc. have to be the same for the two sources. You can even import a script from a separate folder having your second source (with the filtering and trimming in that other AVS):
Insert=Import("C:\Path\To\Other\Video\Insert.avs") -
Wow I didn't know you could do that. I am very glad to have learned it can import another AVS into it. I will give that a try tomorrow.
That sounds much easier for me to do it like that. Then I can just cut each episode how I want separately, then combine them in one script to get the finished video with them both in it and I wont have to worry about combining the separate video tracks.
Then all I have to do is combine the separate cut audio tracks to go with it. Hopefully without having to re-encode or make the audio more lossy again. Im not sure of a good way to do this though except maybe the append feature in MKVMerge.
After I import the script, does it automatically append/combine with the current script, or do I have to use ++ somehow to combine the video from them? -
wow, I never even thought of beginning it like that. I thought the + and ++ were for the trim only. If that works it sounds like a good idea because it should load both episodes at the same time as one longer episode, instead of me having to load them and name them separately in the trims and then trim them. Then I can just do splitting where I want with both of those episodes combined as one.
I don't know if both sources need the same filters or cropping amounts, but if they do, that's what I will try for sure. This will be very helpful to me in the future if I would ever need it for sources that need the same filtering.
Because MeGui can only cut the video for one episode and one audio track at a time with its AVS Cutter tool that I am aware of, I was considering just splitting one episodes video and audio where I wanted and encoding it. Then splitting the second episodes video and audio where I wanted in a whole nother script, then encoding it. Then finally somehow combine the finished encoded video together and finished audio cuts of episode 2 and episode 3 together after they were encoded without having to re-encode them.
The only way I can think of to do that would be the append feature in MKVMerge. If there is a better method for doing that, please tell. -
+ and ++ join clips together. All the source filters and blackclip/blankclip create clips, trim simply shortens those clips into shorter clips.
You seem to have a fundamental misunderstanding of how AVISynth works. You're putting limiting structure in place where it doesn't exist. -
Come on, man, use your head. I even showed you already. Twice. Experiment. Try it out. It's not like you'll break anything. Look it up on the AviSynth site:
DGDecode_mpeg2source("C:\Users\Admin\Desktop\Encod ing\VTS_01_1.d2v", info=3)
ColorMatrix(hints=true, interlaced=true, threads=0)
tfm(order=1).tdecimate(mode=1,hybrid=0)
crop( 10, 0, -8, -2)
LanczosResize(640,480) # Lanczos (Sharp)
dehalo_alpha(rx=1.5, ry=1.5, darkstr=0, lowsens=0, highsens=50, ss=1.0)
santiag()
LimitedSharpenFaster(ss_x=1.0, ss_y=1.00, strength=6, overshoot=0, undershoot=0, soft=0, edgemode=0)
tweak(cont=1.01, coring=false)
Insert=Import("C:\Path\To\Other\Video\Insert.avs")
__film = last
__t0 = __film.trim(8750, 9740)
__t1 = __film.trim(10781, 11302)
__t2 = __film.trim(12083, 12864)
__t3 = __film.trim(14271, 15260)
__t0 ++ __t1 ++ Insert ++ __t2 ++ __t3
If you have any problems, as usual, report back with the script used and the error message VDub gave.
By the way, you don't need the ColorMatrix line in the script, your LSF strength setting of 6 does virtually nothing, and I am very suspicious of that hybrid setting for Tdecimate. It sounds like some garbage MeGUI's analysis might give. Did you search and find any real 29.97fps material in your video, either pure interlace or progressive? -
Thanks for the simplified version and example, I appreciate it. It makes more sense to see it like that. I take it where it says "Insert" I can name it whatever I wish am I right?
LSF 6 is clearly visible to me, unless the ss=2.0, then it does practically nothing visible to me and needs to be set higher. Much more than a strength of 15-20 and lines begin to alias, unless I'm using ss=2 but I don't wish to do that.
The hybrid setting is correct I would assume. If I use =1 like MeGui suggested, I get aliasing in the lines on certain parts and sometimes slight ghosting/blending in pieces of certain moving scenes. If I use =3, it ghosts/blends alot and always does. -
And I owe an apology to you and MeGUI. I saw the 'hybrid' in there and that waved a red flag because MeGUI is known for giving a hybrid setting even when one isn't needed. Only now did I notice it was set for zero. And it does nothing. I didn't realize they have some hybrid setting in there all the time.
-
Yeah, MeGui seems to always use either Yadif, Hybrid=1 or Hybrid=3. I usually always just change hybrid to 0 [Thanks to learning about that on here a couple years back] and change yadif to QTGMC unless Yadif was a wrong detection and it needs hybrid=0.
I have another question about AVISynths capabilities. I've seen extra things able to be shown in the preview window when asked for in the script, like Histograms, and show Input, and Output side by side, etc.
Can I have it display both the uncut and the edited version side by side in a 1280x960 window in a script, so I can flip through them both frame by frame at the same time looking for which frames to edit out? That way they match up. Or am I going to have to use another separate preview window that shows frame count, like virtualdub or something and go through them frame by frame like that? -
I'm not entirely sure what you're asking. To see the longer version on the left and the shorter version on the right? If so, I don't understand why, but yes, you can do whatever you like. To show the original by the side of a filtered one, something like this will work:
A=Last
Filter
Filter
B=Last
StackHorizontal(A,B) -
I think he's trying to sync the low quality "edited version" (with the high quality audio) to the high quality "uncut edition" (with the low quality audio).
You can use stack horizontal with two different sources, but the frames will be locked to each other and once you edit a script you'll have to restart to see the changes go into effect.
You won't be able to seek within each video independently, to do that you'd need two separate programs running. -
Yeah, I was pretty much asking if you can see 2 separate sources side by side at the same time and flip through them frame by frame at the same time. So basically what you said. Longer version on one side and shorter version right next to it.
The idea was, I was wanting to go through them both frame by frame side by side until it gets to a part where they differ. There's a frame count at the top of the preview window. It will help me find which frame numbers need removed from the longer version quite easily is what I was hoping for.
Thanks for letting me know it can stack them like that, even if I may not be able to flip through the frames like I wanted.
Similar Threads
-
How to download specific parts from youtube videos
By Aashik Alam in forum Video Streaming DownloadingReplies: 7Last Post: 18th Jun 2023, 18:20 -
Does an app exist to break up a video file into specific size parts?
By brassplyer in forum EditingReplies: 6Last Post: 14th Jun 2014, 07:11 -
How to remove specific parts from mkv?
By Choey in forum EditingReplies: 4Last Post: 29th Jun 2013, 06:20 -
How to Encode Parts of a Video at Different Settings with Avisynth?
By VideoFanatic in forum RestorationReplies: 10Last Post: 13th Sep 2012, 17:31 -
transferring specific parts of a dvd
By lizzieq in forum Newbie / General discussionsReplies: 3Last Post: 27th Apr 2012, 17:19