Solved

How to create a video header

Posted on 2009-05-14
4
1,000 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

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Users will learn how to set proper sequence settings, scale images, paste attributes, add transitions, fades, and music. Open up Final Cut Pro 7 and Create a new Project: Set the Sequence Settings. a) Click File > Easy Setup > Format > Apple ProRe…
Viewers will learn the basics of making and using Impulse Kits in Ableton Live. Load new Impulse into an empty MIDI track: Fill the 8 empty sample slots with drum samples: Adjust parameters to tailor each sound as desired: Proceed to create be…

920 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

11 Experts available now in Live!

Get 1:1 Help Now