Virtualdub: why can't I select with a 1-second precision ?

zibizibi

Distinguished
Jan 25, 2010
28
0
18,580
I want to select a piece in a video starting with say 4:44, but Virtualdub doesn't let me. Even if I put the start selection at exactly 4:44, it will actually select from say 4:42.

What can I do to fix that ?
 

PhilFrisbie

Distinguished
How is the video encoded? When video has been compressed there are different types of frames in the stream. You begin with a full frame (I frame), basically JPEG encoded, and then you follow with highly compressed frames with just predicted information (P and B frames). The video slowly degrades while sending just P and B frames, so periodically you send another I frame to get back in sync. You can actually see this on some very low bitrate files. The image gets sharp every few seconds and in between you see the blockiness.

So, when you cut a segment out of an encoded video, you must begin at an I frame. The video you are working with must be highly compressed, so it includes I frames just every few seconds. This is why it is important to use low compression when editing files so there are more I frames closer together.

Your only fix is to get a video which has been encoded at a higher bitrate.
 

zibizibi

Distinguished
Jan 25, 2010
28
0
18,580
Hi PhilFrisbie. The video in question was a .VOB that I converted myself with a bitrate of 3000. After reading your reply I converted the .VOB again, this time at 15000 ! Yet the problem remains : Virtualdub starts 1 or several seconds distant from the precise starting point I picked ..

However 15000 is very high no ? What can I doOooOo :(
 

ulillillia

Distinguished
Jul 10, 2011
68
0
18,590
I use Virtual Dub very extensively and is my primary and sole video editor and I know its ins and outs very well.

There is an option in the compression dialog that, upon choosing the codec, you can configure it. Some codecs have the "force key frames every x frames" field being accessible. If you want to snap to the second, you'll need to know the frame rate of your video ("video - frame rate" will show this). Round the frame rate to the nearest integer and put this value in the "force key frames every x frames" field. Unless it's a customized video, you'll usually use 30 or 25 (NTSC or PAL respectively), 24 if it's a film.

If you want to move between single frames, use the arrow keys. Press right to go forward a frame, left to go back (going back is often slow if the last key frame was several seconds ago). Hold the shift key to snap to key frames (known as I frames in MPEG and H.264 videos). This keyboard on sliders trick works in pretty much any program to make very fine adjustments. When the starting point is not a key frame and the video is in "direct stream copy" mode, the previous key frame is used.

I utilize this mechanic to edit any of my videos (where key frames can even be 10 seconds apart) accurate to the frame.