turning jpg sequence into mp4

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
jhines

turning jpg sequence into mp4

Post by jhines »

I am taking jpg files that I created and trying to take 1...n of them and turn them into an mp4.

I got pretty far with:

convert -delay 1x2 -limit memory 512mb -limit map 64mb *.jpg movie.mp4

But, I get:

convert: missing an image filename `movie.avi' @ error/convert.c/ConvertImageCommand/2919

I also get:

convert: maximum channels exceeded `1.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `10.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `11.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `12.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `13.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `14.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `15.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `17.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `18.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `19.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `2.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `20.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `21.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `3.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `4.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `5.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `6.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `7.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `8.jpg' @ error/psd.c/ReadPSDImage/866.
convert: maximum channels exceeded `9.jpg' @ error/psd.c/ReadPSDImage/866.

When I run this command. So, I have a few specific questions:

1. All the examples suggest that all the *.jpg will be 1/2 second a part, and the output would be
in a movie.mp4 file. I've tried this with movie.mp4, movie.avi, and movie.mpeg. All give the same
convert: missing an image filename.

2. I did look on the forum to figure out what the deal is. I tried -write with a filename, and that
didn't produce an output file, so I went back to the suggested usage. I did see some postings that
suggested that if I built from source that I might not have the right flags for building the tools, so
maybe I need to recompile with MP4/AVI video support?

3. Assuming I could get this to produce an MP4, I would like to understand what this maximum channels exceeded
means, and also understand how I can tell convert to iterate over the images from 1..n vs. 1, 10, 11, .. 2, 20, 21.
etc.

I recognize that these are some pretty basic questions, but I would be very pleased if someone could point me
in the right direction. My animation future depends on it:)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: turning jpg sequence into mp4

Post by fmw42 »

not an expert on mp4/avi, but do you have the appropriate mp4/avi delegate library installed?

check

convert -list format

on my system it shows

AVI* AVI r-- Microsoft Audio/Visual Interleaved
MP4 MPEG rw+ MPEG-4 Video Stream

If there is no rw, then it is not writable.

I am not sure what delegate you might need if any?
jhines

Re: turning jpg sequence into mp4

Post by jhines »

Thanks for the reply. Here is what I get with convert -list format

convert -list format
Format Module Mode Description
-------------------------------------------------------------------------------
AVI* AVI r-- Microsoft Audio/Visual Interleaved
...
M2V MPEG rw+ MPEG Video Stream
M4V MPEG rw+ Raw MPEG-4 Video
MOV MPEG rw+ MPEG Video Stream
MP4 MPEG rw+ MPEG-4 Video Stream

I don't really care about AVI, but my attempts to write out an mp4 fail, and it seems like it is there and rw+.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: turning jpg sequence into mp4

Post by fmw42 »

Apparently from your previous error message it appears to need avi to work (my guess), so your avi is only readable.

AVI* AVI r-- Microsoft Audio/Visual Interleaved

Again I am no expert on this. Perhaps someone else can point you in the right direction.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: turning jpg sequence into mp4

Post by snibgo »

0. Please tell us your platform (Win7, Ubuntu, whatever) and IM version.

1. Software often wants frames to be in alphabetical sorted order. To get this, create your frames with leading zeros, eg 000000.jpg, 000001.jpg, ... 000009.jpg, 000010.jpg, 000011.jpg, etc. Personally, I would always prefix them with something else, eg mymovie_000000.jpg etc.

2. Take a look at your delegates.xml file. Mine uses ffmpeg to convert from frames to the MPEG movie files. I play with ffmpeg (directly, rather than via IM) successfully on Windows XP and 7, but not yet on Ubuntu. I think the standard ffmpeg on Ubuntu is deliberately crippled, and I haven't yet found a workaround.

3. However, your convert command seems to be falling over before it gets that far. Try it with a "-verbose" command to see. It seems to be complaining about your input jpg files. Please supply a link to a couple of them so we can take a look.
snibgo's IM pages: im.snibgo.com
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: turning jpg sequence into mp4

Post by snibgo »

[Posting withdrawn. I confused -l (letter L) with -1 (digit one).]
snibgo's IM pages: im.snibgo.com
dchesters
Posts: 1
Joined: 2013-07-11T11:15:14-07:00
Authentication code: 6789

Re: turning jpg sequence into mp4

Post by dchesters »

When I couldn't get ffmpeg to process a sequence of greyscale jpegs into a mpeg movie, I turned to ImageMagick, which worked using
convert frame_*jpg movie.mov

To assure proper sequencing, each real jpeg file was soft-linked to an alias in a strict 4-digit numerical sequence with leading zeros
ln -s firstreal.jpg frame_0001.jpg
ln -s secondreal.jpg frame_0002.jpg
...
A shell script automates the incremented link formation.
Some file-to-movie utilities cannot order the sequence correctly without strict unbroken name-ordering.

This configuration: Apple iMac under OS-X 10.8, IM version 6.8.6-0.
Post Reply