Hein du Plessis
Hein du Plessis

Reputation: 3357

Using Delphi or FFMpeg to create a movie from image sequence

My Delphi app has created a squence called frame_001.png to frame_100.png.

I need that to be compiled into a movie clip. I think perhaps the easiest is to call ffmpeg from the command line, according to their documentation:

For creating a video from many images:

ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi

The syntax foo-%03d.jpeg specifies to use a decimal number composed of three digits padded with zeroes to express the sequence number. It is the same syntax supported by the C printf function, but only formats accepting a normal integer are suitable.

From: http://ffmpeg.org/ffmpeg-doc.html#SEC5

However my files are (lossless) png format, so I have to convert using imagemagick first.

My command line is now:

ffmpeg.exe -f image2 -i c:\temp\wentelreader\frame_%05d.jpg -r 12 foo.avi

But then I get the error:

[image2 @ 0x133a7d0]Could not find codec parameters (Video: mjpeg) c:\temp\wentelreader\Frame_C:\VID2EVA\Tools\Mencoder\wentel.bat5d.jpg: could not find codec parameters

What am I doing wrong?

Alternatively can this be done easily with Delphi?

Upvotes: 3

Views: 7392

Answers (4)

Brad
Brad

Reputation: 2237

Not sure if you are interested but there are delphi headers for this @ http://ultrastardx.svn.sourceforge.net/viewvc/ultrastardx/trunk/src/lib/ffmpeg/ So you can use the DLL vs command line.

-Brad

Upvotes: 3

bman
bman

Reputation: 5235

Guys in DelphiFFMpeg have been produced a component wrapper for FFMpeg. It's very expensive but it's worth to test it. However what you want to do is very simple and command-line is more than enough for you.

Upvotes: 2

Rob Kennedy
Rob Kennedy

Reputation: 163347

Look at the file name in the error message. That can't possibly be right. The percent sign needs to get all the way to the program you're running, but it's being expanded by the batch file instead, where %0 expands to the full name and path of the file. Double the percent sign in the batch file:

ffmpeg.exe -f image2 -i c:\temp\wentelreader\frame_%%05d.jpg -r 12 foo.avi

Also, why do you want five digits when you've already said your files are named like frame_001.png, which has only three digits?

Upvotes: 2

Shay Erlichmen
Shay Erlichmen

Reputation: 31928

ffmpeg can create a movie from png images, why do you think you have to convert them to jpeg?

Upvotes: 2

Related Questions