Solved

Video Codec for DirectShow application

Posted on 2009-03-30
6
452 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now