I'm using VirtualDub2 to step through a video (.MTS format), frame-by-frame.
The computer is a Dell Latitude running under Windows 10.
If I play the video with VirtualDub2 everything looks good, but if I step through the video frame by frame (using the arrow keys) some frames become badly distorted (milky and fuzzy, almost whited out at times).
Can anybody suggest what causes this, and how the problem might be fixed?
+ Reply to Thread
Results 1 to 9 of 9
You're using a source filter that's not frame accurate. Try a different source filter. After selecting File -> Open Video File, use the Files Of Type pulldown to select a source filter. Then select and open the file.
Thanks, jagabo. I couldn't see "MTS" in the "Files Of Type" pulldown, so I selected "All Media Types". The problem still exists. The strange thing is, if I go forward frame-by-frame immediately after loading the video everything is crystal clear from start to finish. It's only when the Left Arrow key is used to step backwards through the frames that distortion starts. After that, the same frames appear distorted no matter which direction you go. As a newcomer to VirtualDub2 I'm mystified....
The .MTS video is 3 minutes long, and its frame rate is 25 fps.
The behavior you're seeing is typical of source filter problems. It happens in many editors, not just VirtualDub(2). And transport streams are one of the most likely containers to have the problem. "All Media Types" isn't specifying which input filter to use. It means pick the first one that works -- and I believe that's the default anyway. Try using "ffmpeg video". But I believe that's the only one that opens MTS files (unless you installed another) and the one you were using when not selecting one.
Below the Files Of Type pulldown there's an Options button. Press that and enable Disable Cache. That won't completely fix the problem but after seeking you can step forward frame by frame and it may eventually clear up. So every time you seek you'll need to seek a little earlier than you really want, then single step forward until you get to the frame you want. This could still lead to problems with encoding because the encoder or complex filtering might lead to frames being requested out of order.
Another workaround is to remux the video into another container like MKV or MOV. Something like this with ffmpeg:
ffmpeg -fflags +genpts -i input.mts -vcodec copy -acodec copy "output.mkv"
ffmpeg -fflags +genpts -i "input.mts" -vcodec copy -acodec copy -movflags faststart "output.mp4"
I used your second line of code with ffmpeg to convert the video to MP4 format.
There's now much less distortion as I step through the frames with VirtualDub2. The distortion is different than before (it's now small square blocks of near-white).
The conversion process created a video with exactly twice the number of frames as the original. Why is that?
ffmpeg source filter mistakes the field rate for the frame rate when it muxes the video into mp4. I recommend you try muxing into MKV instead.
The next problem you are going to have is that VirtualDub(2) doesn't handle the chroma of interlaced YV12 video properly. I don't know of a solution to this in VirtualDub(2). I deal with it in AviSynth.
I'm new to VirtualDub2 and most other video editing topics. jagabo's advice gave me clues and confidence to explore further.
I used ffmpeg to lower the video resolution from 1440 x 1080 to 320 x 240:
ffmpeg -i "hi-res.MTS" -vf scale=320:-1 "lo-res.MKV"
The resulting low-resolution video allowed me step through, frame-by-frame, without encountering distorted images.
I wanted frame-by-frame viewing to identify critical editing points. Having found these points in low resolution I can now use the high resolution version to make the changes.
Thanks for your help, jagabo.
MPC-HC allows to step through .m2ts files without garbling the frames here, using its internal filters. You may want to try it in place of VirtualDub(2) or VLC for inspecting the frames, if you don't need any editing functionality.
The problem is that it returns the time rather than the frame number. I don't know if this can be changed.
Last edited by Sharc; 24th Jul 2021 at 04:28. Reason: typos