Fixing bad frames without losing any audio.
It's always a pain trying to work with a video that has bad frames. The video 'freeze' caused by bad frames during playback or encoder program crashes are very annoying. The most commonly used fix for bad frames involves completely cutting out the bad frame timeline from your video file - including the sound.
This comprehensive step-by-step guide will show you how to remove these bad frames without losing any audio! As a result, you'll have a file that won't have random audio and video gaps everywhere. Here's an example of why you would want to keep the audio:
Let's say you have a movie with two people talking and bad frames have damaged the conversation. You could remove the bad frames but still keep the flow of the conversation going by using this guide. If you were to simply cut out the frames, the conversation would seem awkward due to having various non-matching sentences joined together..
Tools & files required ( all free ):
VirtualDub 1.4.8 or newer (for frame masking)
The correct codec needed to view/open your file.
VDub-MP3 will be used in this section.
Step 1: Open VDub-MP3
Step 2: Open the file you'd like to fix using VDub-MP3.
Step 3: Click on "Video" and then "Check Video for Freezes…"
Step 4: The status bar at the bottom-left of VDub-MP3 will now say Examining #x-#y. Wait for the scan to finish and the "Scan Complete" dialog box to appear. Once the box appears, you may click "OK" and close VDub-MP3.
VirtualDub 1.4.8 or newer will be used in this section.
Step 5: Browse to the contents of your C: drive with windows and open up the badframes.txt file.
Step 6: Find each set of non-consecutive numbers (ie: 1, 2, 3 are consecutive but 1, 3 are not) and put a carriage return everywhere the numbers are not consecutive. If there is more than one place in the file with bad frames, this procedure will split each set of bad frames into "chunks" that makes things easier to deal with later.
Step 7: With the badframes file open (do not close it), open VirtualDub.
Step 8: Open the file that you'd like to fix using VirtualDub.
Step 9: Click on "Video" and then "Direct stream copy"
Step 10: Make sure that "Direct "Direct stream copy" is selected under "Audio"
Step 11: Push CTRL+G or click on "Edit" and "Go to…"
Step 12: Type in the first number of a "bad frame chunk" that you made during Step 6 in "Jump to frame number" and push "OK"
Step 13: Push the "Start offset" button (bolded left arrow button).
Step 14: Push CTRL+G or click on "Edit" and "Go to…"
Step 15: Type in the last number of the "bad frame chunk" that you're dealing with in "Jump to frame number" and push "OK"
Step 16: Push the "Next Keyframe Button" (Yellow Key Button) and then the "End offset" button (bolded right arrow button).
Step 17: Click "Edit" and then "Mask selected frames."
Step 18: Repeat Steps 11-18 for each "bad frame chunk" that you made in Step 6.
Step 19: Push F7 or click on "File" and "Save as AVI…"
Step 20: Type in a name for a new file that your fixed output will be stored in.
Step 21: Click "Save" and wait for the process to finish. Once this is done, you can close everything and watch your fixed file!
+ Reply to Thread
Results 1 to 24 of 24
fantastic thanx alot mate i'm just about to use this but have one question
my avi file plays ok even with the frame freeze but once it's coded to mpeg 2 for dvd sync problems will this guide help out with the sync problems in the mpeg file (hope you cn understand that)
Is it not easier to simply use the "scan video stream for errors" in VDUB? It was my understanding that VDUB automatically masks the bad frames after a scan. I don't know, however, if it masks up until the next keyframe or not...
Have you tried simply doing a scan for errors in VDUB and then saving the AVI? I know that when I do this, the resulting AVI no longer has any errors, but still has the same number of frames.
Liquidant, yes, I've heard that bad frames are exactly the kind of thing that cause sync issues in encoded MPEG's.
Couple of questions:
Shouldn't start offset and end offset both be made at key frames?
When Vdub masks frames and then you save, aren't those frames lost? I was always under the impression that masked frames are deleted, both audio and video.
"Art is making something out of nothing and selling it." - Frank Zappa
LisaB: VirtualDub's scan does mask up until the next keyframe. I have, however, had some weird issues in the past where using the automatic mask + save technique didn't work, but taking the long way around did. Maybe this was a bug that's been fixed in a newer release and is fine now, but I really don't know.
ZippyP: When you mask a frame, all it does is take the last complete image and place it over the newly masked one. In a sense, the video is lost, but the audio that goes along with each frame is never touched during this process - whatever is there will stay there. About the start offset: A keyframe is much like a 'background', and non-keyframes that follow are changing pixels put on top of that background. Because of the way keyframes and non-keyframes tie together, you can start an offset at anywhere you want if you are masking or deleting. The only requirement in offsets is that after you cut/mask/etc, you need to start your next scene at a keyframe. This makes it so that when you start your new scene after having cut out or masked something, you do not end up with a few random pixels plastered on the wrong 'background'.
The guide is great (nicely written and illustrated) and thanks for the answers. One more question:
Can this be used when there is VBR audio, or should I stick to cutting out the frames with VDub-MP3?"Art is making something out of nothing and selling it." - Frank Zappa
VBR audio problems:
There are 3 ways to go about this I guess...
1.) Cutting out the frames with vdub-mp3 - which I don't recommend.. hence this guide =)
2.) Try a virtualdub variant called virtualdubmod which I have heard does support writing VBR headers. I don't recommend this either.. VBR audio + AVIs just don't go together very well, the combination can actually cause more bad frames.
3.) Before you start doing all of your masking, save a full WAV from the file, reimport the WAV back into the video, then continue to do the frame masks. To do this:
a.) Audio | AVI Audio
b.) Audio | Full Processing Mode
c.) Audio | Compression | No Compression PCM
d.) File | Save WAV |
e.) Audio | WAV Audio
f.) Audio | Full Processing Mode
g.) Audio | Compression |
Originally Posted by DigiToast"Art is making something out of nothing and selling it." - Frank Zappa
I found this guide on a search engine, and I tried to follow it. Problem is, virtualdub crashes when it gets to the bad frames for some reason. Why is this, and what can I do to fix it?
DivFix doesn't find any errors in the file oddly enough.
digitoast : your guide looks fantastic
may i ask a question regarding a vbr file
do you have to save the file as a new .avi as when i try this it seems to be taking about 4 hours to convert it.
could i delete the bad frames and then save the .wav and then convert the two files using tmpgenc.
any help would be apreciated.
I followed this guide and found 352 bad frames and they were all in sequential order, so I masked them as mentioned in the guide.
The problem now is that the audio is completely out of sync with the video, i think this could be because i used Vdub-mp3 and so it did not cut out audio when it masked the bad frames and thus the resulting lag.
Can this problem be fixed by extracting audio as Wav file and using it when creating .mpg file for Xvcd?
Cataphract: VDubMP3Freeze and VirtualDub are both useless for what you are trying to achieve, I wasted hours fiddling around with both of them but to no avail. The problem is they both modify the AVI header that was written by Nandub and break it (though technically it was broken and they fix it). The solution is to use VirtualDubMod BUT there is a trick you must go into 'Preferences' and on the AVI tab select 'By default try processing MP3 VBR streams like Nandub' before you open your AVI, when the requester appears select 'Yes' now apply the frame mask using the technique above and it will work. Extracting the audio to WAV does not help in some cases (like mine).
Just a few general thoughts, one reason why you may need to use this method instead of just clipping out the bad frames or using DivFix, is because the film uses external subtitles - have a guess what happens if you just go deleting frames then try to watch the movie - thats right, the subs desynchronise after the edit point (don't even bother trying to fix that).
Just to labour the point no version of VDub was able to scan all the errors correctly they found the first block and then ignored the rest of the movie. I believe this was because the video had two blocks of bad frames very close together with a broken keyframe in between. This meant I was left with only 10 minutes of a 2 hour movie once I saved it. To fix it required me to scan the AVI with DivFix to log all the errors then I had to mask them by hand to prevent VDubMod (well the XviD codec actually) from crashing.
Major respect to Digitoast for the orginal idea.
hi, I follow the instructions and got a new avi file which is out of sync,
is there any other tool which can mask bad frames and keep audio and video in sync?
I have an hour long AVI video that I captured with my capture card. It reported 3 dropped frames. I needed to make a DVD out of it. So I loaded this AVI into VirtualDub, frameserved it and feeded it into TMPGEnc. I didn't mask any dropped frames whatsoever. I did create MPEG2 file and made the DVD out of it.
'Cause it was only 3 bad frames, I can't really say that audio was out of sync. However, there could be much more dropped frames depending on the condition of VHS.
The question is, do I need to mask dropped frames or not in order to keep video and audio in sync. Note that when VD serves to TMPGEnc, I don't get any freeze or anything like that. I want to know the right way for the future VHS2DVD transferring.
Basically I want to find out the following. If I have 30 dropped frames for precisely 1 hour long NTSC video, does it mean that my video portion of AVI file is 59 minutes and 59 seconds and my audio portion is still 60 minutes? Thanks.
Can someone help me when I load this film into VDub-MP3 I get an error message "MPEG Import Filter: pack synchronization error" Does anyone know what I should do
Sorry for digging this old post up, but I encounter an error while trying to open a SVCD mpg file with VDub-MP3.
When I open the file I want to fix, during the parsing operation, "MPEG Import Filter: packet sync error on packet stream (1b3432e0)" came up.
Is there any way to fix this?? Most of the article I came across here use VDub-MP3 to fix it, or do I have to use the ones that ultilize TMPGEnc??
Is there anyway to fix it? or do I have to convert it to avi to fix it?
I've never had much luck fixing mpegs myself. You can't convert a file that has errors without causing more problems."Art is making something out of nothing and selling it." - Frank Zappa
hm..... thanks I guess.
Anyone else have some luck fixing mpqs??
I cantr see it and ive searched on the page for mp3 and freeze, any other links please?