Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VirtualDub, VDubMod & AviDemux

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th August 2015, 08:07   #1  |  Link
broaser
Registered User
 
Join Date: Dec 2014
Posts: 9
MJPEG encoded AVI file with many dropped frames opens but fails to save

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?
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!
broaser is offline   Reply With Quote
Old 12th August 2015, 12:55   #2  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 766
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
shekh is offline   Reply With Quote
Old 12th August 2015, 23:56   #3  |  Link
broaser
Registered User
 
Join Date: Dec 2014
Posts: 9
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.
broaser is offline   Reply With Quote
Old 13th August 2015, 00:17   #4  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 766
ffmpeg is relevant because you can use input driver with ffmpeg, this allows to bypass some problems
https://sourceforge.net/projects/vdfiltermod
shekh is offline   Reply With Quote
Old 13th August 2015, 02:23   #5  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,375
If Windows Media Player can play the file for you (as it does for me), then this Avisyth script should work:
Code:
DirectShowSource("dropframesample.avi")
VirtualDub's internal MJPEG decoder, FFmpegSource etc did not work for me.
raffriff42 is offline   Reply With Quote
Old 13th August 2015, 17:50   #6  |  Link
vivan
/人 ◕ ‿‿ ◕ 人\
 
Join Date: May 2011
Location: Russia
Posts: 649
Quote:
Originally Posted by broaser View Post
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:
Code:
ffmpeg -i 1.avi -vcodec copy %5d.jpg
After remuxing
Code:
ffmpeg -i 1.avi -vcodec copy 2.avi
your second files works fine in vdub (make sure to use video->direct stream copy mode).
vivan is offline   Reply With Quote
Old 13th August 2015, 23:56   #7  |  Link
broaser
Registered User
 
Join Date: Dec 2014
Posts: 9
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).
broaser is offline   Reply With Quote
Old 14th August 2015, 04:17   #8  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,375
Quote:
Originally Posted by broaser View Post
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 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.
raffriff42 is offline   Reply With Quote
Old 14th August 2015, 05:44   #9  |  Link
broaser
Registered User
 
Join Date: Dec 2014
Posts: 9
@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... )
broaser is offline   Reply With Quote
Old 14th August 2015, 09:10   #10  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 766
Quote:
Originally Posted by broaser View Post
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.
shekh is offline   Reply With Quote
Old 14th August 2015, 09:45   #11  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,375
Oh sorry, here's the link: DirectShow input driver.
raffriff42 is offline   Reply With Quote
Old 14th August 2015, 11:14   #12  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,375
Quote:
Originally Posted by broaser View Post
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 or MagicYUV before doing any other processing.

Last edited by raffriff42; 14th August 2015 at 11:35.
raffriff42 is offline   Reply With Quote
Old 15th August 2015, 05:40   #13  |  Link
broaser
Registered User
 
Join Date: Dec 2014
Posts: 9
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!
broaser is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.