Solved

How to create a video header

Posted on 2009-05-14
4
996 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
In this article, I'll explain how to setup a Plex Media Server (https://plex.tv/) on a Redhat (Centos) 7 based NAS with screenshots to help those looking for assistance.  What is Plex? If you aren't familiar with Plex, it’s a DLNA media serv…
This video will give a brief orientation and organization of Logic Pro X, and how to access different work spaces quickly with keyboard shortcuts.
Viewers will learn how to create a new project within Adobe Encore and the basic layout of the software.

706 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

18 Experts available now in Live!

Get 1:1 Help Now