PDA

View Full Version : How to remove video glitches


onlym3
1st September 2008, 21:18
I have an xvid avi with and i would like to clean a few frames that have video glitches. Is there any way i can do this with vdub? If so how, or can anyone recommend another software where i can do this? I know nothing about cleaning up videos, i do know how to do this on pictures, so maybe there is a way to save the glitched frames as bmp, edit them and then insert them back into the avi? Or the original mpeg2 source if that would make it easier.

Thanks

neuron2
1st September 2008, 22:04
Tell us more. What do you mean by "video glitches"? Maybe you could make a screenshot for us. And how many frames are affected? If it's just a few, it might be acceptable to just replace them with copies of their neighboring frames.

onlym3
2nd September 2008, 03:53
Hi, actually i went along and made screenshots of the frames with glitches and edited each frame with Photoshop. I figured i should be able to reinsert them into the avi with avisynth. Which turned out to be a bit optimistic since i dont know a lot about avisynth.
So the next problem is: I have 25 .bmp, how do i insert them into an xvid avi? the avi has 23,976 framerate, the the resolution of the avi and the bmps is identical. i thought avisource + imagesource would do the trick but maybe someone could help me with the correct syntax?

Thanks a lot

neuron2
2nd September 2008, 05:04
Are they consecutive or scattered throughout the video?

I assume you are aware that you have to decode the Xvid and then re-encode it after replacing your frames.

onlym3
2nd September 2008, 16:02
Hi,

yes i am aware of that, but that doesnt bother me, i dont need perfect quality, i just dont want those ugly glitches. The frames are consecutive.
Alternatively i could do the same thing on screenshots from the vob, the files are from an DVD that seems to suffer from old age. So i could make screenshots from the vobs, clean them up, use those as source in a script and then encode the whole thing? Which would leave me with the same problem as before, the exact syntax of how to insert the consecutive frames in the middle of the video.

neuron2
2nd September 2008, 16:12
Get the good starting and ending parts using Trim(). Create a new piece with ImageSource() to replace it. Then join them with the ++ operator. Something like:

vid=avisource("youravi.avi")
start=vid.trim(...)
end=vid.trim(...)
middle=ImageSource(...)
return start ++ middle ++ end

onlym3
3rd September 2008, 19:40
Hi, thanks a lot. I get the error message "Splice: Video formats don't match. This is what i used for imagesource: ImageSource("%d.bmp", 10, 25, 23.976). I assume something is not right here?

neuron2
3rd September 2008, 19:46
Post your full script and tell us the frame rate of the AVI.

You'll need to be sure that these things match:

frame size
frame rate
color space

onlym3
3rd September 2008, 20:49
vid=avisource("k:\work\Movie.avi")
start=vid.trim(x,y)
end=vid.trim(a,b)
middle=ImageSource("k:\work\%d.bmp", 10, 25, 23.976)
return start ++ middle ++ end


frame size of the .avi and pics is 640x352, framerate of the .avi is 23.976. The .bmps are RGB true color 24-bit, i don't know about the .avi.

onlym3
3rd September 2008, 21:20
i may have found the problem, i encoded the 15 frames and then tried to apped it to the other avi in vdub. i got the error message that one avi has 23.97600 fps, while the other has 23.07602 . how to fix this though?

neuron2
3rd September 2008, 21:32
Don't do it in VirtualDub. Do it in your script as I suggest. As I said, you have to get the same color space.

vid=avisource("k:\work\Movie.avi").ConvertToRGB()
start=vid.trim(x,y)
end=vid.trim(a,b)
middle=ImageSource("k:\work\%d.bmp", 10, 25, 23.976).ConvertToRGB()
return start ++ middle ++ end

onlym3
3rd September 2008, 22:48
even with .ConvertToRGB() i get the exact same error message.

neuron2
3rd September 2008, 23:07
Run Info() on each clip segment to see what is mismatching.

Run this script:

vid=avisource("k:\work\Movie.avi").ConvertToRGB()
start=vid.trim(x,y)
start.Info()

then this one:

vid=avisource("k:\work\Movie.avi")
middle=ImageSource("k:\work\%d.bmp", 10, 25, 23.976)
middle.Info()

Compare the results.

Didée
4th September 2008, 13:44
Try like that:
(small mod of neuron2's script, also avoiding the unnecessary YV12 > RGB > YV12 conversion for the main parts)
vid = avisource("k:\work\Movie.avi")
start = vid.trim(x,y)
end = vid.trim(a,b)
middle = ImageSource("k:\work\%d.bmp", 10, 25).ConvertToYV12().AssumeFPS(vid)
result = start ++ middle ++ end
result = result.AudioDub(vid) # in case you need audio too. If not, delete this line.
return result