Jump to content

Virtualdub trim problem


Messerschmitt

Recommended Posts

Hello there.

I have a problem with virtualdub trimming.

There is this episode from which I have to cut the first 35 frames. The thing is that no matter what I try, they are still there after procesing. I have tried on other files of the same type and encoding, and I could very easely cut the first few 20-30 frames, but there is this particular file which just won't do it. No matter what, even if I cut over a full second it will still be present in the output file. The most closer I could get was to cut the first 4 seconds.

What can be rong with this file? why can't I cut the first few frames of this file with virtual dub? It worked on all the others I needed.

Link to comment
Share on other sites


  1. Make sure that both Video and Audio are set to "Direct stream copy".
  2. Set the starting point for the selection you want to keep at the 36th frame.
  3. Set the end point for the selection you want to keep at the last frame.
  4. File -> Save As Avi.

Edited by jcarle
Link to comment
Share on other sites

1. Make sure that both Video and Audio are set to "Direct stream copy".

2. Set the starting point for the selection you want to keep at the 36th frame.

3. Set the end point for the selection you want to keep at the last frame.

4. File -> Save As Avi.

It is selected as direct stream copy.

I have even tried starting from the 36th frame.

It is saved as avi.

You have to be doing something not quite correctly. I've used VDub for 6 years now on multiple video formats and never have any problem like that.

I select with the marker the start of the frame (mark in), then mark out at the end and save as avi. I have done this on 4 files of the same type and they all cut perfectly. This file just won't do it.

You sure this is not a keyframe issue? I think you have to make a cut at the start of video on a keyframe, or it won't work properly. Just a longshot, but have had similar problems before.

That is correct. In this file it will only start from the first snaped keyframe, which is frame 81, 3.5 seconds later.

But as I said I had edited more than 4 files and on one of them I have not had to snap to any key frame, just place the frame from where I wanted to start, being 20 or 30th frame and it worked like a charm.

I do not understand why when I would mark in at any other frame previous to the 81 it would just stream it into an .avi which preserves all the original frames.

Another wired thing is that if I try to edit this file, and then I try to edit the file which did worked to remove just the first 20-30 frame it will not work either, it will also require to snap to the first keyframe.

But if I restart the computer let's say, and I open directly the file which I managed to cut the first 20-30 frames it will work again to remove just the frames I want.

So in the end, why the program won't just remove just the frames I wish?

Link to comment
Share on other sites

virtualdub can only start a cut on a keyframe boundary. as you say, the first two keyframes are at frame 0 and 81. therefore, unless you re-encode those first 55 frames you want to keep and then stitch it together with a cut from frame 81 onwards, virtualdub just cannot do it.

it's a limitation of the avi format. the frames from 1 through 80 depend absolutely on the frames that came before it. you say it worked on other files - that's because they either had a keyframe where you wanted one to be... or it just did a seek to find the next keyframe after 0 and cut from there.

believe me, i've done a lot of programming involving avi parsing and virtualdub filters - virtualdub absolutely cannot do a lossless cut unless the first frame is a keyframe.

Link to comment
Share on other sites

Very well, I understand then that avi can only depend on key frames.

As a matter of fact I have made a test, and yes, all other files had a keyframe exactly at the moment I wished to start (fade in on the movie from comercials).

And what I have observed, is that only the begining is affected by these keyframes. You can cut the end at any frame you wish, it does not have to be the hole segment from 1 keyframe to the next. But the beggining must start from a keyframe.

So what I can say is that I have been lucky that a keyframe has been assigned exactly when the movie began, with the exception of this one.

Now the question would be, what factors dictate were a keyframe will be put. As an example on a file the key frames are at frame: 5, 245, 400, 488, etc. So to me it looks pretty random.

Can I manualy insert a keyframe so virtual dub can trim from where I wish?

Thanks :)

Link to comment
Share on other sites

well the way the format works is that you have a keyframe which is stored as a full complete picture, then following that keyframe, you have a bunch of 'incomplete' pictures which only store the difference between itself and the frame that came before it. some formats can look back more than one frame, some can look forwards too (bidirectional).

so, when you want to cut the end off of something, that's easy - you just store the last keyframe in that segment, and the following incomplete frames that depend on that keyframe... then you can just drop off the other incomplete frames you don't want, since nothing depends on them :)

keyframes are set when the codec is either forced to (by user setting) or the codec has determined that a frame is 'different enough' from the previous frame to signify a scene change, or it's just decided that it would actually use fewer bytes to store a keyframe than a very-complex incomplete frame. it sounds like the codec was smart enough to guess the scene had changed in most of your files and inserted a keyframe, however that detection either failed, or was disabled for the file that's giving you problems.

what you can do is, re-encode (using virtualdub) the frames you want to keep, i.e. from 36 til 80, with the same codec as the original file. then cut the original file from frame 81 onwards. then use virtualdub to append the first re-encoded segment with the post-81 cut (this will work since the video codec, audio codec and sizes are all identical) and you'll have your finished file.

i believe there are some programs which automate this cut-and-reencode procedure, but i can't think of any names right now.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...