4

Possible Duplicate:
bitmaps to avi file c# .Net

I am bit struck with an idea to convert the sequence image files into a single video file. I am using dotnet as a platform.How should i proceed. No clear idea... And more to that need to add audio(mp3) speech while the image sequenceare displayed...

Community
  • 1
  • 1
Tony
  • 1,177
  • 6
  • 18
  • 31

1 Answers1

0

The general idea here is you want to pass your raw images through an encoder and encode the file that way. The encoder will take care of generating all your keyframes and intermediary (P and B) frames as well as generating any necessary decoding metadata that needs to be stored. On top of that running it through an encoding tool such as ffmpeg will also take care of saving the video file in a known container format and properly structuring your video headers. All of this is complicated and tedious to do by hand, not to mention error prone.

Whether you use ffmpeg or some other encoder it's up to you. I suggest using ffmpeg because it has the necessary functionality you need. If you want to do this all in code, ffmpeg is open source and you can wrap the pieces you need in a .net shell and call things that way. Though, keep in mind ffmpeg's licenses if you are developing a distributable application.

This should get you started: Making movies from image files using ffmpeg/mencoder

To add audio check this: https://stackoverflow.com/questions/1329333/how-can-i-add-audio-mp3-to-a-flv-just-video-with-ffmpeg

Now if you want to synchronize the audio and video (lets say the image sequence is people talking and the audio is their speech) you have a much more difficult problem on your hands. At this point you need to properly multiplex audio and video frames based on their durations. FFMpeg probably won't do that well since it will set each image in your video sequence to play at the same duration, which doesn't usually correlate properly with audio frames.

Community
  • 1
  • 1
devshorts
  • 8,572
  • 4
  • 50
  • 73
  • yes it solvesthe problem partly... still wandering how to incorporate the audio into the video ??? – Tony Sep 03 '12 at 17:50
  • I updated the answer with more information – devshorts Sep 03 '12 at 17:53
  • thanks for your quick reply. so i need to think wisely about that feature incorporating into this projectly. :P But is it also possible to create some animation effect upon the image sequences while creating the video.... ??? for example some stick notes while sequence of images are displayed ?? – Tony Sep 03 '12 at 18:00
  • Doing that all programmatically is complicated since you'd need to multiplex the image data onto your frame data. Now you're dealing with image processing and thats a whole subset of computer science in itself. I would suggest using a movie editor if you needed to do this or find an off the shelf library that can help you. – devshorts Sep 03 '12 at 18:02