Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a Video Stream (AVI) from a Series of Images

There is an IP web camera that I wrote a .NET class for sometime ago. It's basically a Timer implementation that pings a snapshot CGI script from the camera every five seconds. The camera itself is very rudamentary; it does not have any sort of API for me to work with, the only thing I can do programmatically (remotely) is invoke this script. The script returns a 640x480 JPEG image. Simple.

Now what I need to be able to do is take a days worth of these images, and create a "time lapse" AVI video stream out of it that will eventually be embedded into a web page. How can I do this with VB.NET?

like image 708
Josh Stodola Avatar asked Dec 08 '09 21:12

Josh Stodola


People also ask

How do I turn a photo into an AVI?

Steps to convert JPG to AVI online with Convert Files:Step 1: Type https://www.files-conversion.com/ on your browser window. Click the Select a file button to add JPG files from your computer. Step 2: Choose AVI as the target format. Step 3: Choose video quality and size.


2 Answers

.net doesn't directly support video formats. Your best option would be to use a 3rd party tool to generate the .avi.

ffmpeg is one option. You could access it directly via a command line like this:

ffmpeg -f image2 -i img%d.jpg /output/a.mpg

You would need to name your images img1.jpg, img2.jpg etc. For more details see the ffmpeg faq. You should also find details in the faq for how to output different video formats.

You can start a process from vb using Process.Start(). Something like this:

Process.Start("ffmpeg.exe", "-f image2 -i img%d.jpg /output/a.mpg")

You could also take a look at ffmpeg-sharp or Tao.FFmpeg, they are .net wrappers for the ffmpeg libraries. I haven't tried either personally, but it looks like it might help you out.

Another alternative would be to take a look at MEncoder, which has similar functionality. You should be able to look up a similar command line for this tool.

[Related SO question: 271003]

like image 101
Simon P Stevens Avatar answered Oct 17 '22 17:10

Simon P Stevens


FFMpeg has windows binaries and is very popular.

Making movies from image files using ffmpeg/mencoder

You'll have to check whether the available output formats suit you.

like image 4
Pekka Avatar answered Oct 17 '22 18:10

Pekka