Solved

How to create a video header

Posted on 2009-05-14
4
1,003 Views
Last Modified: 2013-11-25
Hi to all,

I am currently coding a multicast video streamer with DirectShow and C# and have quite a lot of done but i need some help with the rest.

Here's what i have:

In DirectShow i have my graph- Video File->Decompresser->h264 Encoder->SampleGrabber

I am getting each frame in byte array and sending them over the RTP Multicast Network. All this is good. If i send each frame without the encoder, i can reassemble them successfully at the other end as a bitmap. Upside down, but it's all there. (just for proof. i know that's my code).

Now my issue:

I am trying to feed each encoded byte array into a push source filter and have relised that each byte array must only contain information about the pixels and not the header as i can't connect the source to anything else.
I'm not sure how to create the header for the encoded frames. i have looked at the iso standards PDF's and such but can't make head not tale of any of it, let alone how to translate it into C# code.

Now i believe that as soon as i can solve this issue i will be well on my way to what i want to achieve (still have to add audio but will have to cross that bridge later i guess). If i am still a long way away, could someone also let me know.

thank you and i look forward to your help.
0
Comment
Question by:drewbuckley
  • 3
4 Comments
 
LVL 39

Accepted Solution

by:
abel earned 250 total points
ID: 24408282
I believe you are only scratching the surface, as they say. do I understand you correctly that you are trying to write a video streamer yourself, by hand? Just as a suggestion, but if you want to grab the frames and send them over the wire, I'm not sure if that's such a good idea. I don't know how you do it, but the way I understand it, your frames are full frames and not the partial frames that an encoded stream usually has. Sending that over the wire is a whole lot more (multiples,not percentages) bandwidth eating than the partial frames.

You may want to try a library like this one (shows a little tutorial): http://www.cogitance.com/files/videoprocessing/videoprocessing.htm

Though this is AVI, you may get some ideas. It includes frame grabbing / adding: http://www.codeproject.com/KB/audio-video/avifilewrapper.aspx
0
 
LVL 39

Expert Comment

by:abel
ID: 24408302
Not sure if these help...:

- though this is for Linux, it is a fully open source streaming (mjpg, probably not what you want), but it can give you some ideas: http://sourceforge.net/projects/mjpg-streamer/

- And this one, seems more stable (didn't try though), also mjpeg: http://sourceforge.net/projects/calamaio/
0
 

Author Comment

by:drewbuckley
ID: 24408793
Thank you.

Here i am assuming that the frames i am getting from the samplegrabber whilst connected to the h264 encoder, are the encoded frames. I can't prove it but i think that the information is without its header because i can't do anything with it at the other end. When tested by converting to a bitmap, i had to rebuild the bitmap header at the other end before i could see it.

Do you think this may be the case?

Also i'll have a look at the suggested libraries.

thanks again.
0
 
LVL 39

Expert Comment

by:abel
ID: 24449200
You might be right there, but I'd have to test it myself to find that out. The libraries mentioned might yield the answer. It might be a good idea to consider professional libraries, too, instead of building something from scratch. It might safe you a lot of headaches in getting this right (I know that is not much of an answer to your question).
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn how to turn a Live Set into a compressed Live Pack file, and how to install Live Packs. Make: File > Collect All And Save: File > Manage Files: Click Manage Project: Click Create Pack: Select save location: Install: Doub…
Viewers will get an overview of how to make and use Drum Racks in Ableton Live. Load new Drum Rack into empty MIDI track: Fill rack with audio samples: Re-arrange sample slots as necessary: Adjust parameters of each slot to tailor each sound a…

821 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