Solved

Video Codec for DirectShow application

Posted on 2009-03-30
6
455 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
Industry Leaders: 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!

 

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Setting nameservers after res_init fails doing res_query 2 133
C++ mouse_event mouse look 7 128
Indy 10 not Receiving UDP broadcast 3 51
cmake and message 1 16
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

740 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