View Full Version : MJPEG encoded AVI file with many dropped frames opens but fails to save
broaser
12th August 2015, 08:07
Hi,
I have an AVI video file, where the video stream is Motion JPEG (MJPEG) with an uncompressed PCM audio stream. It was produced by a cheap action camera.
https://www.sendspace.com/file/l8s32g
dropframesample.avi (5.53MB)
The file has many dropped frames, however each dropped frame seems to be encoded as keyframe (every frame shows up as [K] in VirtualDub).
VirtualDub can open and play it well (FFDShow has to be installed and in the FFDShow VFW Interface the "MJPEG" format has to be set to "libavcodec").
However, when I'd like to save it, VirtualDub stops with "Video frame [n] could not be read from the source. The file may be corrupt."
Does anyone have any clue why VirtualDub can play the file but not save it? :confused:
I wonder if it's possible to process and save the original AVI file in VirtualDub without having to re-encode it beforehand? (At longer videos it can take excessive time and harddrive space.)
Any help would be kindly appreciated!
shekh
12th August 2015, 12:55
Tried to play your sample with ffmpeg. This could have helped but unfortunately ffmpeg fails to decode. Maybe worth submitting bug report to trac.ffmpeg.org
broaser
12th August 2015, 23:56
Wow... I didn't test this video with ffmpeg but indeed it's not decoding. In fact this is the first video I made with this camera that ffmpeg can't read so I wasn't aware of this problem.
VirtualDub and Media Player Classic seem to read the video though.
I have made another video which seems to be okay with ffmpeg:
https://www.sendspace.com/file/033jur
dropframesample_ok.avi (10.31MB)
However, ffmpeg seems to be a side issue as the point here is to bypass ffmpeg completely and process the video only in VirtualDub. Nevertheless if this can be a help for the ffmpeg developers, I can send it to them.
shekh
13th August 2015, 00:17
ffmpeg is relevant because you can use input driver with ffmpeg, this allows to bypass some problems
https://sourceforge.net/projects/vdfiltermod
raffriff42
13th August 2015, 02:23
If Windows Media Player can play the file for you (as it does for me), then this Avisyth script should work:DirectShowSource("dropframesample.avi")VirtualDub's internal MJPEG decoder, FFmpegSource etc did not work for me.
vivan
13th August 2015, 17:50
The file has many dropped frames, however each dropped frame seems to be encoded as keyframe (every frame shows up as [K] in VirtualDub).MJPEG is made out of JPG images, every frame is always a keyframe. In fact you can even extract them:ffmpeg -i 1.avi -vcodec copy %5d.jpg
After remuxing ffmpeg -i 1.avi -vcodec copy 2.aviyour second files works fine in vdub (make sure to use video->direct stream copy mode).
broaser
13th August 2015, 23:56
Thanks for the input, guys!
@shekh:
Well, I use VirtualDub 1.10.4 build 35491 - which reads all files well (like MPClassic) but can't process them.
I have installed 1.10.5-prerelease build 36164, which seems to be based on ffmpeg - this doesn't read the first video.
@raffriff42:
Well, I tried to open this avisynth script in VirtualDub but I can't ... should I open it or import it somehow?... (sorry I don't have enough time to google around)
(Btw. congrats for your VirtualDub Fraps MP4 opener, it works excellently!)
@vivan:
Yes... interestingly, in VirtualDub build 36164, not all frames show up as [K] keyframes but as [I] and [+] frames - I guess the [+] denotes dropped frames (which take up about half of the video).
raffriff42
14th August 2015, 04:17
I tried to open this avisynth script in VirtualDub but I can't ... should I open it or import it somehow?You actually don't need Avisynth (http://avisynth.nl/index.php/First_script)for this ... try File menu, Open video file, Files of Type, DirectShow Input Driver, and select your video.
This might not work, depending on how your system codecs are set up - but it is worth a try.
Simply opening the file, or dragging and dropping, uses VirtualDub's internal MJPEG decoder by default, which gives me the same problems as you.
broaser
14th August 2015, 05:44
@raffriff42:
Interestingly I don't have "DirectShow Input Driver" available in File/Open/Files of type menu... neither in 1.10.4 nor in 1.10.5...
Well, the reason I'd like to use VirtualDub is because I'd like to process the videos made with this cam with the Deshaker plugin.
(From what I have read this far, this could be better done in AviSynth - files can be processed in batch there but as it's command line and not WYSIWYG, it's a whole different bag of frustration/trial-and-error... :D)
shekh
14th August 2015, 09:10
Thanks for the input, guys!
I have installed 1.10.5-prerelease build 36164, which seems to be based on ffmpeg - this doesn't read the first video.
...
Yes... interestingly, in VirtualDub build 36164, not all frames show up as [K] keyframes but as [I] and [+] frames - I guess the [+] denotes dropped frames (which take up about half of the video).
Yes there is problem with first video as we discussed above, but another one is ok.
I didnt mean to confuse you, this is not just build number, it is alternate version by me, and the input driver too.
I display [+] for frames that are missing. I cant tell why exactly they are missing in these files: could be a trick to extend exposure time or could be mistake in the format.
raffriff42
14th August 2015, 09:45
Oh sorry, here's the link: DirectShow input driver (http://forums.virtualdub.org/index.php?act=ST&f=7&t=15093).
raffriff42
14th August 2015, 11:14
the reason I'd like to use VirtualDub is because I'd like to process the videos made with this cam with the Deshaker plugin.This is a 2-pass plugin, which requires frame accuracy, something DirectShowSource is not known for. Your dropped frames make frame accuracy even more difficult. I suggest you load the file with DirectShowSource (EDIT or any which way you can) and immediately save it to a lossless intermediate format such as UT video (http://www.videohelp.com/software/Ut-Video-Codec-Suite) or MagicYUV (http://magicyuv.com/) before doing any other processing.
broaser
15th August 2015, 05:40
The DirectShow input driver works fine in 1.10.4 (after some trial-and-error with the correct color space which in this case is most probably 4:2:2 YCbCr (YUY2)) and it even works with Deshaker!
So the initial question seems to be solved.
(The additional bit with batch processing/AviSynth is for future frustration :) )
Thanks again guys!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.