0

I would like to convert images to a video via imagemagick. Unfortunately running the command:

convert img1.jpg img2.jpg img3.jpg out.mpg

gives an error something wrong running avconv

convert: delegate failed `'avconv' -nostdin -v -1 -i '%M%%d.jpg' '%u.%m' 2> '%u'' @ error/delegate.c/InvokeDelegate/1919.

I have also read that the delegate.xml might have the wrong avconv program name.. But I don't know how to check this.

I have installed imagemagick, ffmpeg (brew) und also avcon (after the same error appeared when I only installed the first two.. I installed vi brew install libav) on my Mac on High Sierra.

I have avconv (Version 12.2) as well as a programme called avconvert. And convert version 6.9.9-26.

Thanks for any help!

toby
  • 45
  • 2
  • 9

1 Answers1

4

I would suggest you just use FFMPEG directly to create your video. Adding in ImageMagick just adds one more layer of complexity.

See https://www.imagemagick.org/Usage/formats/#mpeg

But try the following anyway:

convert img1.jpg img2.jpg img3.jpg MPG:out.mpg

or

convert img1.jpg img2.jpg img3.jpg M2V:out.mpg


Did you install ImageMagick such that it can see FFMPEG. You can see if ImageMagick knows about ffmpg via convert -list format. Does it list MPG and MPEG?

Find your delegates.xml file on your system. Mine (on my Mac Sierra) is at /usr/local/etc/ImageMagick-6/delegates.xml. But it could also be in /opt/local/etc/ImageMagick-6/delegates.xml. Mine shows

  <delegate encode="mpeg:encode" stealth="True" command="&quot;ffmpeg&quot; -nostdin -v -1 -i &quot;%M%%d.jpg&quot; &quot;%u.%m&quot; 2&gt; &quot;%u&quot;"/>


I do not know what avconv does with relation to creating an mpg or ffmpeg.

But doing a Google search for avconv, I find http://www.autodidacts.io/convert-media-files-like-a-geek-a-guide-to-video-transcoding-with-avconv-ffmpeg/. It would appear that avconv (Libav) is a fork of ffmpeg. So perhaps your delegate.xml file is looking for avconv rather than ffmpeg. Try editing it if needed to point to ffmpeg. You may need to put the full path to ffmpeg

P.S. I typically install all my delegates from MacPorts and then install ImageMagick from source. See https://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=21502&p=88202&hilit=OSX+MacPorts#p88202. Unfortunately, I have no experience with Homebrew.

P.S. 2 If you only have a few frame, you could create a simple gif animation, if that would do as follows:

convert -delay 50 img1.jpg img2.jpg img3.jpg -loop 0 out.gif

Adjust the delay as needed. The value is in ticks (1/100 sec = 1 tick). See https://www.imagemagick.org/script/command-line-options.php#delay. The loop 0 means loop without stopping. A loop of 1 would stop after just one showing of each frame.

fmw42
  • 46,825
  • 10
  • 62
  • 80
  • Thanks! Changing the delegate from aconv to ffmpeg for the mpeg tag did the job. And yeah using ffmpeg directly is much more handy as it allows to do all in one go and specify all the params like this `ffmpeg -r 1/2 -i img%1d.jpg -c:v libx264 -vf fps=25 -pix_fmt yuv420p out.mp4` I also found an install guide on mac https://trac.ffmpeg.org/wiki/CompilationGuide/macOS – toby Feb 06 '18 at 16:16
  • If my answer was helpful, please consider giving it an up-vote. – fmw42 Feb 06 '18 at 16:45
  • It was and I will once I'll have enough reputation:) – toby Feb 06 '18 at 17:14
  • OK. Thanks. I understand. – fmw42 Feb 06 '18 at 19:24
  • @fmw42 : it seems a version update has borked creating animations from jpgs. When I looked at trying to do this 6 months ago on MS-WIn, I saw others complaining that only the last jpg displays when launching the gif'ed version. (Even though you can see by the size that all the images are in the gif). Same thing happened today after using a no-pain install from mac ports on a Mac. My version info is `Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25`. Does this still work for you, if so what version please (and thanks!) – shellter Apr 29 '22 at 04:40
  • I will research in ImageMagick dev boards and see what kind of info is there. Possibly file a bug report. Cheers1 – shellter Apr 29 '22 at 04:47
  • LOL, same problem using the `ffmpeg` cmd-line offered by @toby. )-;! – shellter Apr 29 '22 at 04:58