New Image Magick user - Help creating mpg

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
algarve

New Image Magick user - Help creating mpg

Post by algarve »

I woukd like to create an mpg with 5 jpeg images from one directory and tried this

#!c:\perl\bin\perl.exe -w
print "Content-type: text/html\n\n";
# generate the animation
my $mpegname = "movie.mpg";
print `convert -delay 1 *.jpg $mpegname`;
print "finished";
exit;

But i get an error message in bowser
N must be positive convert: Delegate failed `mpeg2enc.exe "%i" "%o"'. finished
Im runing windows xp with
ActivePerl-5.10.0.1002-MSWin32-x86-283697.msi
ImageMagick-6.3.8-9-Q16-windows-dll.exe
installed
All the other commands work fine, have tried most of the examples of your pages.
So i know that the code is wrong but have no idea where to start and could not find any examples with mpg only with gif animation. So if somoeone could show me an example.
Thanks in advance
algarve

Re: New Image Magick user - Help creating mpg

Post by algarve »

I have solved the problem myself

With ffmpeg

ffmpeg -f image2 -vcodec mjpeg -y -i %d.jpg anim.mpg
laurik_vertex

Re: New Image Magick user - Help creating mpg

Post by laurik_vertex »

It seems that Image Magick (version 6.3.9 which I tested ) has a bug.
Image Magick executes the mpeg2enc.exe with following parameters:

mpeg2enc.exe "PATH_TO_TEMP/magick-EMZiPPWd" "PATH_TO_TEMP/magick-UBa8cAXl"

where PATH_TO_TEMP is my temporary path. The file pointed by first parameter seems to have yuv-stream and the second is the parameter file for mpeg encoder.

However, regarding to the documentation of mpeg2encode, the parameters should be as:
"Usage: mpeg2encode in.par out.m2v"

I tested mpeg2encode with proper parameter-order and data generated by ImageMagick, and I was able to create a playable mpeg-animation.
Post Reply