VideoHelp Forum




+ Reply to Thread
Results 1 to 17 of 17
  1. Member
    Join Date
    Aug 2006
    Location
    United States
    Search Comp PM
    I am having difficulty getting Virtualdub to cut at precisely the point I want, or even at a keyframe. This is for all videos in general that I have tried to cut, and am wondering if I am doing anything wrong.

    Say for example, I am cutting a video of a baby smiling. I get near the point where the baby smiles using the slider and then push the keyframe next button until it shows his mouth closed, just before he is about to smile. I click mark in. Then I keep on clicking keyframe next until the baby stops smiling, and click mark out. With this selection, the resulting video will sometimes not cut at the points I want and instead I get a good second of non-smiling baby in the beginning, the baby already smiling in the beginning, the video ending before the baby stops smiling, the video ending long after the baby stopped smiling which can sometimes be a complete scene change, which makes the video clip look really shoddy. The baby smiling example doesn't give a lot of leeway, but I get the same problems trying to get video clips that allow for more error, like cutting end credits. I've tried manually just going to the specific frame and cutting out of keyframe, or cutting only at the places the virtualdub slider lands un when being dragged as opposed to using the buttons or the arrow keys. All the results are very unpredictable from video to video.

    I'm using virtualdub mainly so I can do direct stream copy and preserve quality. Also, virtualdub has this annoying problem where when you use the keyframe buttons, if you happen to click too much and bypass the intended keyframe and you try to go back several keyframes, the picture displayed in the preview area is completely wrong, displaying keyframes from the opposite direction you are clicking even though the frame number on the bottom is consistent with what you are clicking. I usually just drag the slider away and slowly move towards the cut point again, hoping to not screw up again.
    Quote Quote  
  2. It has been a while but is your raw video in raw .avi format or in some compressed format
    Quote Quote  
  3. Convert your source to packed bitstream with Mpeg4Modifier.
    Quote Quote  
  4. Member dragonkeeper's Avatar
    Join Date
    Jul 2003
    Location
    United States
    Search Comp PM
    Convert your source to packed bitstream with Mpeg4Modifier.
    How does this help, I'm not disputing you I'm really curious.
    In the past I've always cut out a portion of the video with Vdub, and save it as an uncompressed avi. Then cut out the section I wanted and saved it in the desired format. This approach seems simpler, i would try it now but my PC is currently converting episodes of Heoes from HD DVD to MKV. So i don't have the CPU cycles to spare at the moment.
    Quote Quote  
  5. Originally Posted by dragonkeeper
    Convert your source to packed bitstream with Mpeg4Modifier.
    How does this help
    VirtualDub uses VFW codecs. VFW is based on a one-frame-in-one-frame-out model. A program reads one frame worth of compressed data from the source file, passes it to the decoder, the decoder decompresses the frame and hands an uncompressed frame back to the program. This works fine with codecs that are all keyframes and codecs that only use forward prediction (frames that only encode the changes from the frame immediately before them). But when using birectional prediction (some frames encode only the difference between themselves and a later frame of video) frames can not be decoded properly.

    Take a frame sequence like IBBP. This is the order they are to be viewed, first the I frame, then the first B frame, then the second B frame, and finally the P frame. I is a keyframe, the two B frames are backwards predicted from the P frame, and the P frame is forward predicted from the I frame. To decode this sequence properly you first have to decompress the I frame, then you decompress the P frame, and finally you can decompress the two B frames. This confuses VFW decoders because they can't decompress the P frame before decompressing the B frames.

    Packed Bitstream works around this problem by encapsulating the BBP sequence as if it is a single frame, then adding two N (null) frames as placeholders: I[BBP]NN. Now when a program reads the sequence it first reads in the I frame data and VFW decompresses it. Then the program reads the BBP sequence thinking it's one frame of video. The decoder knows it's three frames so it decompresses all three, stores them internally, and returns the first decompressed B frame to the program. Next the program reads the first N frame and passes it to the decoder. The decoder ignores the N frame and returns the second B frame that it already decoded. Finally the program reads in the second N frame and passes it to the decoder. Again, the decoder ignores the N frame and hands the already decoded P frame to the program.
    Quote Quote  
  6. Member
    Join Date
    Aug 2006
    Location
    United States
    Search Comp PM
    AAhh too technical for me. I'll just take your word and try it. How will this change the filesize? It doesn't mess up the quality right? I am using divx and xvid files.
    Quote Quote  
  7. Originally Posted by silverwolf0
    How will this change the filesize?
    Nothing significant.

    Originally Posted by silverwolf0
    It doesn't mess up the quality right?
    It won't change the quality at all. It's just rearranging the compressed frames. You'll still have your original file.

    Originally Posted by silverwolf0
    I am using divx and xvid files.
    Yes, it's for Divx/Xvid files. I'm pretty sure it will work for your problem.
    Quote Quote  
  8. Member
    Join Date
    Aug 2006
    Location
    United States
    Search Comp PM
    Uhoh having another problem. The checkbox next to pack is greyed out.
    Quote Quote  
  9. Originally Posted by silverwolf0
    The checkbox next to pack is greyed out.
    That may mean the file doesn't use B frames. I'm not sure what other conditions would disable that box. You can use GSpot to check for the use of B frames. It will show you a lot of other details about the file too.
    Quote Quote  
  10. Member
    Join Date
    Aug 2006
    Location
    United States
    Search Comp PM
    Even if Gspot tells me I don't have these magical B frames, there's basically no way around it unless I uncompress the video or re-encode it right?
    Quote Quote  
  11. I can't remember exactly, but it was certain builds either ffdshow vfw or xvid vfw that caused similar problems to what you describe, where non-linear seeks would disrupt the keyframes and they would be totally different than what they were when you just went over them.

    You can try changing decoders (e..g if you are using ffdshow vfw to decode, disable it and install xvid vfw or vice-versa)

    It might be worth giving avidemux a shot

    use it in "copy" mode, similar to direct stream copy for vdub
    Quote Quote  
  12. Originally Posted by silverwolf0
    Even if Gspot tells me I don't have these magical B frames, there's basically no way around it unless I uncompress the video or re-encode it right?
    Maybe. I've never seen the problem except with packed bitstream which requires B frames.

    You might try re-deriving the keyframe list in VirtualDub. When you open the file put a checkmark in the Ask For Exteneded Options... box. When the extended options dialog comes up select Rederive Keyframe Flags.

    Could you post a short segment that shows the problem? Ie, 5 or 10 minutes where I can see the same bad seeks. I'd like to figure out what's going on...
    Quote Quote  
  13. Member
    Join Date
    Oct 2011
    Location
    Spain
    Search Comp PM
    Originally Posted by jagabo View Post
    Convert your source to packed bitstream with Mpeg4Modifier.
    Thank you so much for this. It solved a problem that had been annoying me for years.
    Quote Quote  
  14. Member
    Join Date
    Oct 2011
    Location
    Spain
    Search Comp PM
    I have been using Mpeg4Modifier to fix the problem described by the OP and it works beautifully with AVI files. However, I have found the same problem with some MP4 files. Since Mpeg4Modifier only works with AVI files, it doesn't help with the MP4s. Is there another tool that does the same thing with MP4s? Or is there a way of making Mpeg4Modifier work with MP4?
    Thanks
    Quote Quote  
  15. Member
    Join Date
    Aug 2012
    Location
    South America
    Search PM
    Originally Posted by #14, Alonshow
    I have been using Mpeg4Modifier to fix the problem described by the OP and it works beautifully with AVI files. However, I have found the same problem with some MP4 files. Since Mpeg4Modifier only works with AVI files, it doesn't help with the MP4s. Is there another tool that does the same thing with MP4s? Or is there a way of making Mpeg4Modifier work with MP4?
    Yes and no.

    The really important is the video codec of your file, not the container. (AVI is a container, MPEG-TS/MPEG-PS is other, OGM is other, Matroska is other, etc.). Diverse tools exists to change the container, demuxing and remuxing the streams inside of the files.

    But, for your case especially, the important thing is that the video codec must be MPEG4-ASP not MPEG4-AVC.

    MPEG4-ASP (Advanced Simple Profile) is a video codec derived from old H263 specification, and is the format behind the DIVX and XVID logos.

    MPEG4-AVC (Advanced Video Coding) known also as H264, is the successor of the previous one.

    Unfortunately, Mpeg4Modifier only works with MPEG4-ASP video streams.

    How convert .mp4 files to .avi?

    I personally use the mkvtoolnix tools for remux the .mp4 files in .mkv (matroska) files.
    Then, i use virtualdub with the matroska reader plugin of fcchandler for saving in a new .avi (direct stream copy option enabled), and voilá: a have my mpeg4 video without recompression (taking only some minutes) in full quality in AVI container.

    Now, the MPeg4-Modifier from Moitah can work with it.
    Last edited by Empatojayos; 28th Aug 2012 at 23:51.
    Quote Quote  
  16. Member FulciLives's Avatar
    Join Date
    May 2003
    Location
    Pittsburgh, PA in the USA
    Search Comp PM
    From the VideoHelp website section called "Tools/Software and Downloads"

    SolveigMM AVI Trimmer + MKV is a free video editor for fast and lossless AVI and MKV editing. This freeware AVI editor is small, smart, easy to use and involves no encoding/decoding processes. No video / audio degradation and out of sync problem arises after editing. All AVI and MKV file types of any size and video / audio content are supported.
    SolveigMM AVI Trimmer + MKV is a great program for cutting MKV files. I've used it with files that have H.264 video and either AC-3 or DTS audio. However it should work with other codecs.

    Right now you might be saying, "But a MP4 file is NOT a MKV file?"

    Well yes but a MKV file is just a container and it can hold all kinds of different video and audio formats. So basically you need to demux and remux the MP4 file into a MKV file. The process is fairly easy, doesn't take long and no re-encoding nor transcoding takes place.

    Once the MP4 file is a MKV file you can then use SolveigMM to edit out the part you want (or cut out parts you don't want keeping the rest). The resulting new file is a MKV but it can easily be demuxed and remuxed back into a MP4 file if you so wish (again without any re-encoding nor transcoding).

    Oh and just now while typing this I tried it (since I never used EXACTLY in this way) and it worked. I took a MP4 and made a MKV and cut out a part of it and then changed it back to a MP4 and like I said it worked (all without any re-encoding/transcoding taking place).

    - John "FulciLives" Coleman

    P.S.
    Here's a link to the program: CLICK HERE
    "The eyes are the first thing that you have to destroy ... because they have seen too many bad things" - Lucio Fulci
    EXPLORE THE FILMS OF LUCIO FULCI - THE MAESTRO OF GORE
    Quote Quote  
  17. Member
    Join Date
    Dec 2018
    Location
    Russia
    Search Comp PM
    Sorry for bumping an ancient thread, but...
    sooo... How do you go about all this if your file is H264? It's convenient for me to use Vdub with lots of filters for it, but the cutting problem is the pain.
    (Also tried loading the file through Avisynth script (FFVideoSource), did not help)

    A trick like packed bitstream would be cool.
    Or maybe making Vdub to work directly with a container such as MKV or MP4 instead of AVI, and doing it that way, is enough?

    upd. I've found one workaround, is to output uncompressed files. Seems to work properly then
    Last edited by rebus_x; 2nd Jun 2023 at 06:33.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!