?
Solved

How to create a video header

Posted on 2009-05-14
4
Medium Priority
?
1,006 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 39

Accepted Solution

by:
abel earned 750 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

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.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
This video teaches viewers how to process images for a time-lapse video. Programs required: Adobe Lightroom, Adobe After Effects, Video Editing Program. In Adobe Lightroom: Import sequence image files into Adobe Lightroom: Develop settings of an I…

770 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