Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an animated GIF thumbnail from a video? #26

Open
bbozo opened this issue Jun 18, 2015 · 3 comments
Open

Create an animated GIF thumbnail from a video? #26

bbozo opened this issue Jun 18, 2015 · 3 comments

Comments

@bbozo
Copy link

bbozo commented Jun 18, 2015

I'm not sure if this is a feature request or it belongs to SO :) Is it possible to create an animated GIF from videos?

@owahab
Copy link
Member

owahab commented Jun 24, 2015

It's possible using FFMPEG but no current support in Ruby AV gem.

@jacobshiff
Copy link

I have been trying unsuccessfully to create an animated GIF from a video using FFMPEG settings. I have used the following settings so far. Any assistance would be much appreciated!

class CustomGif < ActiveRecord::Base

  has_attached_file :gif, styles: {
    original: {
      format: "gif",
      convert_options: {
        output: {
          t: "00:00:6.000"
        }
      }
    }
  }, :processors => [:transcoder]
  validates_attachment_content_type :gif, content_type: /\Avideo\/.*\Z/
end

When I run custom_gif = CustomGif.new(gif: params['video']), I receive the following output:

[AV] Running command: ffmpeg -ss 3 -i "/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-29940-1wvj48r.MOV" -f image2 -vframes 1 -t 00:00:6.000 -y "/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-29940-1wvj48r20160821-29940-1bfutyd.gif"
[paperclip] [transcoder] Successfully transcoded ac80cf3de4643bff7fec3a00dc9196d620160821-29940-1wvj48r to #<File:0x007f91da570468>
=> #<CustomGif:0x007f91da0e95c0
 id: nil,
 created_at: nil,
 updated_at: nil,
 gif_file_name: "capturedvideo.MOV",
 gif_content_type: "video/quicktime",
 gif_file_size: 15202,
 gif_updated_at: Sun, 21 Aug 2016 21:50:55 EDT -04:00>

And, when running custom_gif.save, I receive the following error:

Command :: file -b --mime '/var/folders/7g/9142rygs6bngwl84c7bh4d6c0000gn/T/ac80cf3de4643bff7fec3a00dc9196d620160821-29940-dxocga.MOV'
[paperclip] Content Type Spoof: Filename capturedvideo.MOV (video/quicktime from Headers, ["video/quicktime"] from Extension), content type discovered from file command: image/jpeg. See documentation to allow this combination.
   (2.2ms)  ROLLBACK
=> false

@wnm
Copy link

wnm commented Oct 24, 2016

ruby-av/av#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants