Page 1 of 1
How to speed up identify on images with multiple frames?
Posted: 2013-08-14T09:42:43-07:00
by 0xJohny
When I run identify on animated GIF, or MP4 video, the execution time can go up to minutes, as it is identifying every single frame.
The command I want to run is:
Code: Select all
identify -format "%Q %m %n %w %h" image.gif
- %Q - compression quality
- %m - image format
- %n - number of frames
- %w - width
- %h - height
I know that I can speed it up by specifying only one frame in path (image.gif[0]), but that would mean that %n would always return 1, and I need that value. ImageMagick is really inefficient in this. For example, even simple 'identify -format "%n" image.gif' is doing the identification process on every single frame, as opposed to just returning the requested total number of frames.
Re: How to speed up identify on images with multiple frames?
Posted: 2013-08-14T10:24:22-07:00
by snibgo
Does "-ping" help?
Re: How to speed up identify on images with multiple frames?
Posted: 2013-08-14T11:20:08-07:00
by 0xJohny
Doesn't seem to. Tried:
Code: Select all
identify -format "%n" -ping test.mp4
And it was as long as before (over a minute). Also tried other simple formats like %w, and same result. (I'm using ImageMagick 6.8.6-7 Q8)
How is -ping supposed to work? The documentation doesn't say much...
Re: How to speed up identify on images with multiple frames?
Posted: 2013-08-14T11:39:27-07:00
by snibgo
As I understand it, "-ping" tells IM to read the metadata, but not to read and decode the actual image data. I always put it as the first argument:
Code: Select all
identify -ping -format "%n" test.mp4
Re: How to speed up identify on images with multiple frames?
Posted: 2013-08-14T17:24:18-07:00
by snibgo
For basic metadata of MP4 and other video, I use ffmprobe.
Code: Select all
D:\pictures\20130713>%FFM%ffprobe -show_streams d:\pictures\20130523\gopr0006.mp4
:
width=1920
height=1080
:
r_frame_rate=30000/1001
:
duration=1133.565767
:
The number of frames is the duration (seconds) multiplied by the frame rate (frames per second).
1133.565767 * 30000/1001 = 33973.00000999001 frames.
exiftool also works on MP4 files, but seems to give less precision.
exiftool works well for GIF files, giving an exact frame count.