gudguy
User

Fresh Boarder
Posts: 4
graphgraph
 
Click here to see the profile of this user
Decode streams directly - 2007/11/16 10:29 Hi Daniel,

First, great work you did on FFMPEG wrapper!

Now, for the serious matter, do you have an example on how I can use this wrapper to read a video file and render it to a control (say picturebox control).

Also, can I feed Avdn ffmpeg wrapper with streams (array of bytes) instead of a file or a URL? I am receiving MPEG4 streams (byte[]) from an IP camera and I got hold of the MPEG4 streams, now I want to use your wrapper to decode it for me. Once I have the raw bytes after decoding then it should not be a problem rendering it to screen for display.

MPEG4 byte[]->Avdn API decoder->output byte[]->renderer

Thank you.

Regards
  | | No public write access. Please register.
Daniel
Admin

Admin
Posts: 44
graph
 
Click here to see the profile of this user
Re:Decode streams directly - 2007/11/17 00:43 I'm afraid I don't have good answers for both of your questions.

For the first question, you can use the csavcodecsample.cs to write the frame to a DirectDraw surface or a D3D texture for a quad (for sample code, you can look at dowitchers renderers).

For the second question, the state of the wrapper atm doesn't allow you to handle streams and I don't know how much work it would be to handle it. If I would have to do this, I'd try to use graphedit and create a graph to handle your situation then, use directshowlib and ffdshow (a directshow wrapper for libavcodec) to write the app in C#.
  | | No public write access. Please register.
gudguy
User

Fresh Boarder
Posts: 4
graphgraph
 
Click here to see the profile of this user
Re:Decode streams directly - 2007/11/19 06:08 Hi Daniel,

Thank you for your reply. I just downloaded GraphEdit. I also have the copy of DirectShowLib now. I have installed ffdshow and its components. But how exactly can i use ffdshow in my code?Is there a .net wrapper or using DirectShowLib will indirectly use ffdshow? I don't exactly understand how this GraphEdit works and how its going to help me. Let's just say i have the raw MPEG4 data (byte[]) and lets not mind how I got this data.

byte[]->graphedit->directshowlib->renderer

is that a correct diagram?

Thanks.
  | | No public write access. Please register.
Daniel
Admin

Admin
Posts: 44
graph
 
Click here to see the profile of this user
Re:Decode streams directly - 2007/11/20 00:54 You should definitely spend some times getting used to graphedit. It's a very good tool to prototype most A/V apps for Windows.

Your graph would, probably, starts with a capture filter (for your camera) as a source filter, then, maybe, an mpeg splitter, which would feed into ffdshow. If you just add the filter for your camera, and right-click on its output pin to select "Render Pin". You should be able to see your capture output in a window when you click the "Run" button.

Then you translate this app in C#. There a quite a few capture sample applications written in C# on the net. I wrote one (look at the tutorials section) or google it.
  | | No public write access. Please register.
gudguy
User

Fresh Boarder
Posts: 4
graphgraph
 
Click here to see the profile of this user
Re:Decode streams directly - 2007/11/20 11:30 Hi Daniel,

Thank you for this information. I haven't gone through the entire tutorial on your site, but it looks useful for my project. I have a question though, Im using that GraphEdit tool, but all I can render is a file, file from URL or capture device. My source filter is an array of bytes (w/c is a raw MPEG4 data). How can I create a source filter from byte[] (can I create a graph for this in GraphEdit?) so I can continue with the whole process:

source filter (byte[]) -> MPEG4 Splitter -> ffdshow video decoder -> VMR9 renderer

Do you have a sample for this or know a link that will give me hint on how to create a source filter for this? I know C#, very limited to C++.

regards,
gudguy
  | | No public write access. Please register.
Daniel
Admin

Admin
Posts: 44
graph
 
Click here to see the profile of this user
Re:Decode streams directly - 2007/11/21 00:30 I might be wrong but I suppose that your IP camera appears as a capture device. Then by adding the corresponding filter to the the graph, you'll have your source filter. If you need the decoded picture insert the SampleGrabber before the renderer.
  | | No public write access. Please register.
gudguy
User

Fresh Boarder
Posts: 4
graphgraph
 
Click here to see the profile of this user
Re:Decode streams directly - 2007/11/21 04:08 I have plenty of video sources. Some from IP cameras, video servers, DVR's and almost all of them sends data over network as array of bytes. So i prefer choosing byte array as the source filter as it can handle all of them (mostly). If you happen to know a link that may guide me to it kindly let me know.

Thanks.
  | | No public write access. Please register.
Joomla Template by Joomlashack
Joomla Templates by JoomlaShack Joomla Templates by Compass Design