Can ImageMagick make thumbnails from video?

20,526

Solution 1

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

Solution 2

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

Share:
20,526

Related videos on Youtube

Juneyoung Oh
Author by

Juneyoung Oh

Updated on September 18, 2022

Comments

  • Juneyoung Oh
    Juneyoung Oh almost 2 years

    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
    
  • evilsoup
    evilsoup about 11 years
    @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
    evilsoup about 11 years
    @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.
  • Juneyoung Oh
    Juneyoung Oh about 11 years
    @evilsoup Oh Thanks.I thought it is impossible. Now I can check which is faster:D many thanks.