?
Solved

Video Codec for DirectShow application

Posted on 2009-03-30
6
Medium Priority
?
458 Views
Last Modified: 2013-12-08
Hi all,

i have an application built in Win32Api using DirectShow for Live Video Broadcasting.(right now it works locally).

Now i want to compress and de-compress it using MJPEG Compressor Filter.

i cant find any Relevant informatin on MSDN.

So can any one suggest me how to implement this Compression filter in DirectShow.

Thanks
Kishan
0
Comment
Question by:kishan66
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 12

Expert Comment

by:williamcampbell
ID: 24024573
http://www.free-codecs.com/download/FFDshow.htm

Install this codec

Using GraphEdit insert this Codec into your graph after the source. Or if you are doing it in Code use its GUID and dynamically insert it.

I assume you know DirectShow
0
 

Author Comment

by:kishan66
ID: 24031395
Hi,

Thanks for the reply.

Can you tell me more clearly how to do it ?(like compression & decompression).
example would definitely help me.

Thanks
kishan.
0
 
LVL 12

Expert Comment

by:williamcampbell
ID: 24034828

  DirectShow is a Filter graph, a pipeline of sorts. A source comes in (bytes) and passes through several filters and is rendered at the other end.

  FILTER1: live video and audio stream as the source.
  FILTER2: Compress the video (JMPEG)
  FILTER3: Multiplex To go over  Network
 
   === NETWORK ===

  FILTER4: Demultiplex Stream
  FILTER5: Uncompress Video (JMPEG)
  FILTER6: Render Video

  Right now you may have a filter where FILTER 2 and 5 are  (MPEG4/ or MPEG2) and you need to replace it with the JMPEG one.

 If you open GraphEdit run your app you dynamically hook into the graph and see how the filters are connected.

 To Have your JMPEG filter used there are several things you can do.

 So let me know if you understand what I have said an we can take it form there.

 


0
Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

 

Author Comment

by:kishan66
ID: 24043292
Hi WilliamCambell,

Thank you so much for your reply.

I understood the concept and steps.
but i only have the Step 1 done till now.( i am just in the learning mode of Direct Show).

i feel its better to do that step by step,................

 i am using a Timer () to get/show the images continuously from the WebCam and showing it on the screen (locally).  

-my next step is to compress and Decompress these DIB's using MJPEG( initially both operations locally)

So can you tell me how to call or assign this filter.(MJPEG Compressor & DeCompressor)

Thanks,
Kishan
0
 

Author Comment

by:kishan66
ID: 24051394
Hi William,

here is my sample code where i am getting the image(Bitmap) and constructing the Bitmap Header.


I am developing a win32api using 'C'.

-------code----

GetFrame(&pImage); // gets the Bitmap image into BytePointer pImage
        m_pImageBytes = pImage;
MakeBMPHeader(); // construct the header .
.......
......
 void MakeBMPHeader()
{  
    DWORD  dwBitmapInfoSize;
    dwBitmapInfoSize = sizeof(BITMAPINFO);
    m_pBmp   = (BITMAPINFO *)new BYTE [dwBitmapInfoSize];
    m_pBmp->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    m_pBmp->bmiHeader.biWidth = m_un32ImageWidth;
    m_pBmp->bmiHeader.biHeight = m_un32ImageHeight*-1;  
    m_pBmp->bmiHeader.biPlanes = 1;
    m_pBmp->bmiHeader.biBitCount =(unsigned short) m_un32ImageBits;
    m_pBmp->bmiHeader.biCompression = BI_RGB;
    m_pBmp->bmiHeader.biSizeImage = 0;
    m_pBmp->bmiHeader.biXPelsPerMeter = 0;
    m_pBmp->bmiHeader.biYPelsPerMeter = 0;
    m_pBmp->bmiHeader.biClrUsed = 0;
    m_pBmp->bmiHeader.biClrImportant = 0;          
}

Now i have Image and Header.

-----------------

can you please explain me " how to compress using MJpeg"?

thanks
0
 
LVL 12

Accepted Solution

by:
williamcampbell earned 2000 total points
ID: 24051804
Capturing the bitmaps as you are doing now is very slow...

Take a look at this sample program AMCap

http://msdn.microsoft.com/en-us/library/ms778964.aspx

It does all the Capture part and displays the video. Once you are able to get that working you can download the JMPEG codec and insert it into  the filter chain.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question