Domanda

I have a Rails app using Paperclip to upload and store videos on Amazon S3. I'm not particularly interested converting the video files into another format, or adding watermarks, nothing fancy. I just want to create thumbnails from the videos to use as poster images on my video players.

I see that Amazon Elastic Transcoder allows for free thumbnail creation (or rather, they don't charge for thumbnail creation), and since I'm already using Amazon services, I wanted to see if I can use this for my thumbnails.

Does anyone know how to set the input/output options such that no file is generated aside from thumbnails? Could I just do the following?

transcoder = AWS::ElasticTranscoder::Client.new
transcoder.create_job(
  pipeline_id: APP_CONFIG[Rails.env][:pipeline_id],
  input: {
    key: VIDEOPATH,
    frame_rate: 'auto',
    resolution: 'auto',
    aspect_ratio: 'auto',
    interlaced: 'auto',
    container: 'auto'
      },
       output: {
       key: , #LEAVE THIS BLANK TOO?
        preset_id: , #LEAVE THIS BLANK?
        thumbnail_pattern: "thumbnail", 
        rotate: '0'
      }
    )
È stato utile?

Soluzione

No.

There are no functions for creating only thumbnails.

It also is not possible to create a new transcoding job without actually transcoding anything. The input parameters require, at minimum, the name of an input video. The output parameters require, at minimum, the name of the output file and a preset ID. Parameters are checked prior to starting the job, and there are no options which would prevent the job from executing while creating a thumbnail.

You can read about all of the available functions here:

http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/api-reference.html

Give ffmpeg a look. It can be a little bit of a hassle to install, but it can create thumbnails from videos.

Altri suggerimenti

Amazon Elastic Transcoder does provide functionality for thumbnails. http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/preset-settings.html#preset-settings-thumbnails

It looks like you do indeed have to transcode a video file in order to get thumbnails though.

As mentioned in other comments, you need to pay the transcoding price for Elastic transcoder to generate a thumbnail.

Another similar option Amazon provides is MediaConvert. With MediaConvert, you can add an additional output of a number of image files that will be taken using a formula you need to provide (pick an image every X frames). As with Elastic Transcoder, this is expensive for getting only a thumbnail, and you are still not sure that the thumbnails you get are good images (not blurry and representative of the video).

As mentioned in another comment, using FFMpeg will work better in comparison. It's a pretty solution if you can maintain the infrastructure to do it (some sort of processing queue, running ffmpeg, and then uploading thumbnails).

Full disclosure: We faced a similar problem. Our volume was large enough that generating thumbnails by hand was getting cumbersome, and we'd often get blank thumbnails because it's hard to predict which frame is good across different videos. So we built a product that fixes this pain for us (and others in the same boat): https://mediamachine.io/

Instead of getting random thumbnails with no meaning (and, what is worst, paying for them), we use a ML algorithm to get the most representative thumbnail of the video, saving time AND money.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top