Search code examples
macosffmpegimagemagickmacos-high-sierraavconv

Imagemagick convert command creating video from images gives avconv error on Mac


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!


Solution

  • 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.