12

I'm trying to extract thumbnails from video via ImageMagick. I found some samples from their official site, but it makes GIF, not PNG. I want a solid thumbnail though.

Can it create the same output as with this ffmpeg command?

ffmpeg -ss 600 -i myVideo.mp4 -vframes 1 -s 420x270 Out.bmp

2 Answers 2

18

You can extract thumbnails from videos with ImageMagick like so (from here - another answer claims that ImageMagick uses ffmpeg 'under the hood', so I don't know if this will actually be any faster than just using ffmpeg):

convert input.mp4[100] thumbnail.png

the [100] tells ImageMagick to take the 100th frame from input.mp4. I've tested it on a H.264 video stream in an MP4 container. Obviously you can use whatever ImageMagick options you want, including deinterlacing as described in your link.


ImageMagick is really for dealing with individual images, though; for video, you should just use ffmpeg. Obviously there is some overlap here, since you're dealing with an individual frame, but I'd say that deinterlacing is more of a video-processing task.

You should use the yadif filter for deinterlacing. You can add it to your existing line thusly:

ffmpeg -ss 600 -i input.mp4 -vframes 1 -s 420x270 -filter:v 'yadif' output.png

when working with filters, I prefer to use the scale filter rather than -s:

ffmpeg -ss 600 -i input.mp4 -vframes 1 -filter:v 'yadif,scale=420:270' output.png
5
  • Maybe I'm misunderstanding the question, but the OP specifically asked how to achieve what the ffmpeg command does with ImageMagick. No idea if it's possible or not though…
    – slhck
    May 25, 2013 at 9:26
  • @slhck I interpreted the OP's actual problem as 'getting nice-looking thumbnails from interlaced video', and assumed that they were just trying to use the wrong tool for the job (i.e. get the thumbnail with ffmpeg -> deinterlace with ImageMagick). If anyone were to post a way of doing it with ImageMagick, though, they'd have my upvote.
    – evilsoup
    May 25, 2013 at 9:36
  • @evilsoup thanks for your answer. I uploaded this question because ffmpeg takes too much time to make thumbnail from video. And I heard from somewhere if I use imagemagick, I can make this faster. Is it true and possible? I've also searched it but there's no way to take thumbnail from video with only imagemagick. Sorry for my poor english. May 27, 2013 at 1:00
  • @JuneyoungOh taking thumbnails with ImageMagick is indeed possible, see the update to my answer. I doubt it'll be any faster, though, since it seems (from my superficial googling) that ImageMagick uses ffmpeg as a back-end for dealing with videos.
    – evilsoup
    May 27, 2013 at 10:49
  • @evilsoup Oh Thanks.I thought it is impossible. Now I can check which is faster:D many thanks. May 28, 2013 at 1:22
6

ImageMagick shells out to ffmpeg with this command:

ffmpeg -v -1 -vframes %S -i "%i" -vcodec pam -an -f rawvideo -y "%u.pam" 2> "%Z"

So the short answer is "no" (since it does not do it itself).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.