Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion DirectShow MJPEG Compressor Filter
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alessandro Angeli [MVP::DigitalMedia]  
View profile  
 More options Apr 11 2005, 10:24 am
Newsgroups: microsoft.public.win32.programmer.directx.video
From: "Alessandro Angeli [MVP::DigitalMedia]" <nob...@nowhere.in.the.net>
Date: Mon, 11 Apr 2005 16:24:08 +0200
Local: Mon, Apr 11 2005 10:24 am
Subject: Re: DirectShow MJPEG Compressor Filter

Artem Omelianchuk wrote:
> I also think so,but it's not. When i try to open file
> it's fail. Photoshop writes:"Can't open because SOFn,DQT
> or DHT JPEGs markers is missing before a JPEG SOS marker".

> I compare this file with real jpeg and notice that
> instead of JFIF there is AVI1. And other differents. If
> you want I can send file to you.

That's the least of your worries since 'AVI1' is the APP0
marker which replaces the APP0 'JFIF' and APPn markers are
optional.

The big difference is that the DHT marker that contains the
Huffman table for decoding is missing. This table is fixed
for MJPEG and defined in mmreg.h, according to the OpenDML
specs.

Some reading on the subject:

- JPEG standard (markers are listed in section B.1.1.3):

http://www.w3.org/Graphics/JPEG/itu-t81.pdf

- JFIF standard (JFIF marker at page 5):

http://www.w3.org/Graphics/JPEG/jfif3.pdf

- JFIF, old AVI1 and new AVI1 markers:

http://sourceforge.net/mailarchive/message.php?msg_id=7062286

- ODML standard (MJPEG DIB described at page 26):

http://www.nomadelectronics.com/VidCap/capture using
vfw/ODMLFF2.DOC

So, in the end, you need to find the 0xFF,0xDA SOS marker in
your sample (that's where the image data starts) then write
averything up to that point to the JPEG output stream, then
write the DHT, then write the rest of the sample. The DHT is
exactly the content of the MJPGDHTSeg byte array defined
near the end of mmreg.h.

Let's assume pb points to the sample data and cb is the
sample length in bytes:

 int k = 0; while(pb[k] != (char)0xFF || pb[k+1] !=
(char)0xDA) k++;
 output(&pb[0],k);
 output(MJPGDHTSeg,sizeof(MJPGDHTSeg));
 output(&pb[k],cb-k);

If you want, you can also replace the 'AVI1' APP0 with a
'JFIF' APP0, but it is not required (APP0 = 0xFF,0xE0).

--

// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google