Log in

View Full Version : cutting at specific frames?


yawnmoth
31st October 2002, 07:16
Currently, if you want to cut some video out of Virtual Dub, and you have it at some frame that isn't a keyframe, it'll just go to the closest keyframe... atleast if I'm understanding things correctly... couldn't Virtual Dub simply recreate a keyframe at the specific frame, and for the rest of the frames after it, until the next keyframe, recompress it using the same codec, and at approximatly the same bitrate? this wouldn't take too much time, if there were a good number of keyframes, and would make Virtual Dub more powerful, imho! :)

esby
31st October 2002, 14:38
Well if you want to use direct stream copy,
you must cut at the kf,
If you want to cut at a non KF, two cases:

Ending of block frame , nothing behind, you can cut, there is no problem here...

Starting of block frame, each block need a kf to start, so if you don't have any kf at the start, you can't direct stream copy.
So what you need is to:
1 - direct stream copy the part you want between the next KF and the end of your block,
2 - reencode the begining to the starting kf of the block you direct copied to have a starting kf.
for this, reencode the part at high bitrate, to preserve the data,
and since it's will be only a few seconds it will be fine.
3 - assemble the two part you got together (appends with vdub).

esby

NB: if you encoded a file with nandub and wants a KF somewhere,
(meaning Opening / ending start etc.),
just use the ECF possibilities when encoding, and add a KF manually at the correct frame.
for that create a .ecf file, edit it with any text editor,
and add each time you need a KF at a given frame number this:
@XXXXX : K
where XXXXX is the frame number.
This will add a KF at the wanted place, and you'll be able to cut easily.

Loul
8th December 2002, 08:12
Hi !

I followed your advice esby but I noticed a new trouble :
at the junction point there is a hiccup (gap in the sound).
It's not that disturbing but it can be.

I solved this in a quite easy way : after rejoining the original cut part with the reencoded one I saved the avi.
Then I loaded the original avi and selected the "other part" of the movie to delete it and I was then left out with the whole part I had after rejoining the two former files (I hope this is clear enough).

Of course it then didn't started at a keyframe, butI didn't care as I did a simple save Wav [don't forget selecting direct stream audio](which is of course a compressed wav so no reencoding trouble there).

Finally I loaded the "rejoined" clip and selected wav audio using the previously saved wav file.

The result is perfect : no sync trouble nor hiccup BINGO ! :-)

P.S. : I don't know if you have to use the same video or audio codec to do this. I had, but I don't know if it could work mixing different audio or video codecs.

esby
8th December 2002, 13:06
Well technically you cant join video streams
with different audio codec.
So forget about mixing with different audio & video codec,
except if the codec are the nearly the same
(like divx 3.11, mp43 etc.)

I think the sound you were hearing must be coming
from how the audio is coded...
If it's interleaved with video it's quite normal
to have an sound with directly dealing with video.

esby