[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1008
  • Last Modified:

How to create a video header

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
drewbuckley
Asked:
drewbuckley
  • 3
1 Solution
 
abelCommented:
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
 
abelCommented:
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
 
drewbuckleyAuthor Commented:
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
 
abelCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now