Solved

Video Codec for DirectShow application

Posted on 2009-03-30
6
451 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

708 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

17 Experts available now in Live!

Get 1:1 Help Now