views:

1892

answers:

5

Hi all

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?

+2  A: 

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

Shay Erlichmen
I had an error earlier which made me assume that and there's no mention of png in the (sparse!) manual.Thanks, good to know. Now if I can just figure out the command line :)
Hein du Plessis
Same command line as jpeg.
Shay Erlichmen
png or jpeg is not the problem - I can't get the command line to work since it replaces the %0d parameter with the name of the batch file I'm calling it from.
Hein du Plessis
@rob gave you the answer use %%05f instead of %05d
Shay Erlichmen
Thanks to you too, Shay.
Hein du Plessis
+2  A: 

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?

Rob Kennedy
Thanks Rob! Obvious now in retrospect...I now get the following error, tried it out of the batch file as well:c:\temp\wentelreader\Frame_%05d.jpg: I/O error occurredUsually that means that input file is truncated and/or corrupted.The frame_001.png was just a sample, I decided to quote my code later on. The real file names are Frame_00000.jpg - Frame_03961.jpg.
Hein du Plessis
Ok update - using the original png it seems to work now. I think I had the wrong path in for the jpegs.Thanks again!
Hein du Plessis
+1  A: 

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.

Muhamamd
Thanks, looks very powerfull, will keep in mind.
Hein du Plessis
A: 

Hi I am trying to convert SWF file to FLV, but i am getting same eror

C:\Users\Administrator>C:/ffmpeg/ffmpeg.exe -i C:/xampplite/htdocs/ffmpeg/1.swf C:/xampplite/htdocs/ffmpeg/file1.flv FFmpeg version SVN-r16573, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --extra-cflags=-fno-common --enable-memalign-hack --enable-pthr eads --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libfaac --enable-libgsm --enable-libx264 --enable-lib schroedinger --enable-avisynth --enable-swscale --enable-gpl libavutil 49.12. 0 / 49.12. 0 libavcodec 52.10. 0 / 52.10. 0 libavformat 52.23. 1 / 52.23. 1 libavdevice 52. 1. 0 / 52. 1. 0 libswscale 0. 6. 1 / 0. 6. 1 built on Jan 13 2009 02:57:09, gcc: 4.2.4 C:/xampplite/htdocs/ffmpeg/1.swf: could not find codec parameters

Please solve this problem, what i am doing wrong??

Ritesh
+1  A: 

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

Brad