Giter Site home page Giter Site logo

paperclip-ffmpeg's Introduction

Hi there, it's Omar 👋

I'm a friendly geek who's interested in challenges that combine people and technology at scale in a friendly and growing environment.

Omar's github stats

paperclip-ffmpeg's People

Contributors

aarellano avatar charlotte-miller avatar dja avatar eprothro avatar esbanarango avatar fedetorre avatar florentmorin avatar fredkelly avatar nifuramu avatar nikita-v avatar owahab avatar petemichaud avatar phlipper avatar vinnividivicci avatar walterdavis avatar zmillman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

paperclip-ffmpeg's Issues

Black screen when trying to play video

When I try to upload videos it posts as a black screen with a play button that does not work. See
below. I added 'Paperclip.options[:command_path] = "/usr/local/bin" into my config.development folder and the 'paperclip-ffmpeg' gem has been included as well. Any ideas? I have been working on this for awhile. I have a post on stackoverflow as well however, I have had no feedback. Thanks any help is greatly appreciated.

Post Model

 class Post < ActiveRecord::Base

belongs_to :user

has_attached_file :image, :styles => { :medium => "300x300>", :thumb => "100x100>" }


  has_attached_file :video, :styles => {
  :medium => { :geometry => "300x300", :format => 'flv' },
 :thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10 }
 }, :processors => [:ffmpeg]

has_attached_file :video, :styles => {
:mobile => {:geometry => "400x300", :format => 'mp4', :streaming => true}
 }, :processors => [:ffmpeg, :qtfaststart]


validates_attachment_content_type :image, :content_type => ["video/mp4", "video.MOV",   "video/flv", "image/jpg", "image/jpeg", "image/png", "image/gif"]



validates :description, presence: true
validates :image, presence: false
validates :video, presence: false

  end

Migration

  class AddAttachmentImageToPosts < ActiveRecord::Migration
   def self.up
    change_table :posts do |t|
      t.attachment :image
      t.attachment :video
    end
   end

  def self.down
   drop_attached_file :posts, :image, :video
  end
end

 def change
    create_table :videos do |t|
     t.string :video_file_name
     t.string :video_content_type
     t.integer :video_file_size
     t.datetime :video_updated_at

     t.timestamps
   end
 end

screen shot 2014-08-08 at 8 24 07 pm

Cocaine::CommandNotFoundError

Can't find a solution for this anywhere. I'm trying to upload a video and a picture to my site. This only happens when I use mp4 and qtfaststart. If I do flv or wmv it works fine because I'm not calling qtfaststart. On the new view I submit my two files (doesn't work with just a video either) in my form. Chrome shows the % uploading, then "Waiting for localhost..." for 15-20 minutes and finally I get the error in the title with this as the application trace:
app/controllers/auctions_controller.rb:10:in 'new' app/controllers/auctions_controller.rb:10:in 'create'

model has_attached_file :vid, styles: { medium: { geometry: "640x480", format: 'mp4', :streaming => true }}, processors: [:ffmpeg, :qtfaststart]

show <video src= " <%= @auction.vid.url(:medium) %>" type="video/mp4"> Your browser does not support the video tag. </video>

new <%= form_for(@auction, html: { multipart: true }) do |f| %> <%= render 'shared/error_messages', object: f.object %> <%= f.label :vid, "Upload Patent Video" %> <%= f.file_field :vid, id: "shit" %> <%= f.submit "Add Video", class: "btn btn-big btn-primary", id: "sign_btn2" %>

controller class AuctionsController < ApplicationController

def index end

def new @auction = Auction.new end

def create @auction = Auction.new(params[:auction] ) if @auction.save flash[:success] = "Uploaded new video!" redirect_to @auction else render 'new' end end

def show @auction = Auction.find(params[:id]) end end

Newbie Trying to Install qt-faststart

Hello!

I'm a programming newbie using Ruby on Rails. I'm playing around with making a hacker news clone. I want to allow users to upload videos to their posts and other users to view those videos. I'd trying to use your gem to implement that. I used bundle to install paperclip and homebrew to install ffmpeg. How should I install qt-faststart? I didn't understand https://github.com/danielgtaylor/qtfaststart.

I would also love suggestions for how to display videos in the post view page.

Any help would be greatly appreciated! Thanks so much and I apologize if this is a misuse of the wiki. I wasn't sure where would be the best place to ask this question.

Failing tests

4 tests are failing when running rspec tests...

rspec ./spec/integration/paperclip-ffmpeg_spec.rb:4 # Video should be saved
rspec ./spec/integration/paperclip-ffmpeg_spec.rb:19 # Thumbnail file should exist
rspec ./spec/integration/paperclip-ffmpeg_spec.rb:30 # Thumbnail file should be empty
rspec ./spec/integration/paperclip-ffmpeg_spec.rb:35 # Thumbnail file should be 100*100

playback error

video uploads and converts ok, but on video_tag it does not play, not even by visiting the mp4 link directly,

ArgumentError: invalid byte sequence in UTF-8

When processing a song with UTF-8 metadata, paperclip-ffmpeg fails with:

ruby-1.9.2-p180 :001 > DelayedPaperclip.process_job "Audio", 1, "file"
  Audio Load (57.4ms)  SELECT `documents`.* FROM `documents` WHERE `documents`.`type` IN ('Audio') AND `documents`.`id` = ? LIMIT 1  [["id", 1]]
[paperclip] ffmpeg -i /tmp/paperclip-reprocess20111024-10174-cvvqae 2>&1
ArgumentError: invalid byte sequence in UTF-8
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-ffmpeg-0.7.0/lib/paperclip-ffmpeg.rb:135:in `block in identify'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-ffmpeg-0.7.0/lib/paperclip-ffmpeg.rb:134:in `each'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-ffmpeg-0.7.0/lib/paperclip-ffmpeg.rb:134:in `identify'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-ffmpeg-0.7.0/lib/paperclip-ffmpeg.rb:37:in `initialize'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/processor.rb:33:in `new'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/processor.rb:33:in `make'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:344:in `block (2 levels) in post_process_styles'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:343:in `each'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:343:in `inject'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:343:in `block in post_process_styles'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:339:in `each'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:339:in `post_process_styles'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:333:in `block (2 levels) in post_process'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:390:in `_run_file_post_process_callbacks'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/callback_compatability.rb:54:in `run_paperclip_callbacks'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:332:in `block in post_process'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:390:in `_run_post_process_callbacks'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/callback_compatability.rb:54:in `run_paperclip_callbacks'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:331:in `post_process'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/paperclip-2.3.11/lib/paperclip/attachment.rb:254:in `reprocess!'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/delayed_paperclip-0.7.2/lib/delayed_paperclip.rb:149:in `process_delayed!'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/delayed_paperclip-0.7.2/lib/delayed_paperclip.rb:31:in `process_job'
        from (irb):1
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start'
        from /home/atd/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.1.1/lib/rails/commands.rb:40:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'ruby-1.9.2-p180 :002 > 

Different behavior based on ffmpeg installation

I have different styles defined in my attachment model:

  styles: lambda { |s|
    if s.instance.type_image?
      { screen: "1000x1000>", medium: "200x200#", thumb: "90x80#" }
    elsif s.instance.type_video?
      { screen: { geometry: "1000x1000>", format: 'jpg', time: 10 },
        medium: { geometry: "200x200#", format: 'jpg', time: 10 },
        thumb: { geometry: "90x80#", format: 'jpg', time: 10 } }
    end
  },

It works correctly when run in my dev environment, but in production I only get the first style (screen), the other two are not generated.

The only thing that I can think of is that both ffmpeg implementations are not the same
I'm developing on OS X, and installed ffmpeg using brew, so my ffmpeg version is:

ffmpeg version 1.1.3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 25 2013 19:52:57 with Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)

My production server runs on Ubuntu, so I installed ffmpeg using apt-get, and so the version is:

FFmpeg version SVN-r0.5.10-4:0.5.10-1, Copyright (c) 2000-2009 Fabrice Bellard, et al.

Misunderstanding how to get meta information

Firstly, this is a really excellent bit of work, so thank you!

I'm still a Rails newbie, so apologies if I'm oversimplifying things but, while I have the gem up and running exactly as I want it, I'm still slightly confused about how I should go about getting metadata (and, specifically, the length of a video attachment) using Paperclip FFMPEG. I've tried to follow the response in a previous issue but my inexperience is letting me down.

My (Rails 3.2) model ("Video") looks a bit like this, in which :sourcefile represents the file attachment (elided code):

class Video < ActiveRecord::Base

attr_accessible :description, :title, :sourcefile

has_attached_file :sourcefile, [...etc...] 

...
end

My migration for the Video model looks like this:

class CreateVideos < ActiveRecord::Migration
  def change
    create_table :videos do |t|
      t.string :title
      t.text :description

      t.timestamps
    end
  end
end

Finally, the migration for the attachment is as follows:


class AddAttachmentSourcefileToVideos < ActiveRecord::Migration
  def self.up
    change_table :videos do |t|
      t.has_attached_file :sourcefile
    end
  end

  def self.down
    drop_attached_file :videos, :sourcefile
  end
end

So, my questions are:

  1. What do I need to add to these to access the metadata (particularly the length of the video) and
  2. How should I express this in my view?

Thanks for any help!

[documentation] FLV parameters

Thanks for this awesome gem, it is very useful.

Trying to convert to FLV triggers this error: FLV does not support sample rate 32000, choose from (44100, 22050, 11025)

Is there a resampling option built into the gem, or any other solution?

Unitialized constant error when trying to catch ffmpeg exception

The following error is raised by ffmpeg processor when error output is given by shell.

uninitialized constant Paperclip::Ffmpeg::PaperclipError

Seems like there is a typo in ffmpeg.rb processor. Here's the patch:

--- /tmp/ffmpeg.rb  2012-07-17 00:17:22.000000000 -0400
+++ ffmpeg.rb   2012-07-17 00:17:30.000000000 -0400
@@ -119,7 +119,7 @@
       begin
         success = Paperclip.run("ffmpeg", parameters, :source => "#{File.expand_path(src.path)}", :dest => File.expand_path(dst.path))
       rescue Cocaine::ExitStatusError => e
-        raise PaperclipError, "error while processing video for #{@basename}: #{e}" if @whiny
+        raise Paperclip::Error, "error while processing video for #{@basename}: #{e}" if @whiny
       end

       dst

Cocaine::ExitStatusError when I switch from paperclip-ffmpeg 1.0.1 to 1.2.0

Everything is fine with the version 1.0.1 but when I switch to version 1.2.0 I get this stack:

Command :: PATH=/usr/local/bin/ffmpeg:$PATH file -b --mime '/var/folders/43/t8s11k6d145c4wtwfpnbxh640000gn/T/6c84cbd30cf9350a990bad2bcc1bec5f20150205-9509-104fieg.MOV'
sh: -c: line 0: syntax error near unexpected token `then'
sh: -c: line 0: `PATH=/usr/local/bin/ffmpeg:$PATH if command -v ffprobe 2>/dev/null; then echo "true"; else echo "false"; fi'
Could not log "process_action.action_controller" event. Encoding::UndefinedConversionError: "\xEA" from ASCII-8BIT to UTF-8 [...]

Cocaine::ExitStatusError - Command 'PATH=/usr/local/bin/ffmpeg:$PATH if command -v ffprobe 2>/dev/null; then echo "true"; else echo "false"; fi' returned 2. Expected 0
Here is the command output:

:
  cocaine (0.5.5) lib/cocaine/command_line.rb:92:in `run'
  paperclip-ffmpeg (1.2.0) lib/paperclip_processors/ffmpeg.rb:249:in `detect_command'
  paperclip-ffmpeg (1.2.0) lib/paperclip_processors/ffmpeg.rb:233:in `detect_ffprobe_or_avprobe'
  paperclip-ffmpeg (1.2.0) lib/paperclip_processors/ffmpeg.rb:183:in `identify'
  paperclip-ffmpeg (1.2.0) lib/paperclip_processors/ffmpeg.rb:36:in `initialize'
  paperclip (4.2.1) lib/paperclip/processor.rb:33:in `make'
  paperclip (4.2.1) lib/paperclip/attachment.rb:522:in `block in post_process_style'
  paperclip (4.2.1) lib/paperclip/attachment.rb:521:in `post_process_style'
  paperclip (4.2.1) lib/paperclip/attachment.rb:512:in `block in post_process_styles'
  paperclip (4.2.1) lib/paperclip/attachment.rb:511:in `post_process_styles'
  paperclip (4.2.1) lib/paperclip/attachment.rb:503:in `block (2 levels) in post_process'

If i try to execute the command in my terminal:

$ PATH=/usr/local/bin/ffmpeg:$PATH if command -v ffprobe 2>/dev/null; then echo "true"; else echo "false"; fi
bash: syntax error near unexpected token `then'

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

uninitialized constant Paperclip::Error with paperclip-ffmpeg

I am using Paperclip , and paperclip-ffmpeg for processing uploads. Below is my code

class Asset < ActiveRecord::Base

 belongs_to :profile  
 has_attached_file :photo, :styles => {
      :mobile => {:geometry => "400x300", :format => 'mp4', :streaming => true}
  }, :processors => [:ffmpeg]


 validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png',  'image/gif', 'application/msword', 'application/pdf', 'video/x-flv']

end

when i upload image or video file then it is working properly. But when i upload PDF or doc

file, this error occurs.

       "uninitialized constant Paperclip::Error" 

Any help??

Or How i can put if condition validation if upload file is PDF or Doc. Then i can skip this

below code. Because this is cause of error when file type is PDF or Doc.

        ":styles => {
      :mobile => {:geometry => "400x300", :format => 'mp4', :streaming => true}
  }, :processors => [:ffmpeg]" 

Thanks

<attachment>_meta missing using qtfaststart

I'm finding using the plugin in combination with the :processors => [:ffmpeg, :qtfaststart] & :streaming => true options looses the meta hash that is normally added to the <attachment>_meta field - is this a known issue?

Request: Exiftool for metadata

I'd like to request adding the ability to use Exiftool to produce the metadata hash, instead of ffprobe.. There's things like rotation that would be super useful in determining whether or not to rotate a video, and other metadata that's more robust than ffprobe offers.

Thanks!

Extracted thumbnail has no EXIF:rotated

I'm extracting a thumbnail from rotated video- it has a "rotate : 90" in metadata, and the output image is rotate too but with no metadata.
shouldn't the library should rotate it according to metadata or at least save the metadata in EXIF?

Video Thumbnails not cropping for vertical videos?

Hi, this maybe a very noobish issue, but I'm using this gem to get video thumbnails from images as previews.

Simply having:

:thumb => { :geometry => "200x200#", :format => 'jpg', :time => 1 }

Works for horizontal and most videos, but when I have a vertical video, it ignores the cropping and just creates a 200xLARGER thumbnail. Anyway of getting this to crop properly for vertical videos?

Should throw an exception with thumb.time > video.length

I'm using the following thumbnail style: :thumb => { :geometry => '128x120', :format => 'jpg', :time => 5}

The problem is that thumbnail generation silently fails for videos that are less than 5 seconds in length, producing a thumbnail that is zero bytes in length.

Should there be either a raised exception, or retry for thumbnail generation for example from the beginning of video?

Unknown issue thumbnails not being generated and returning an error.

Video error while processing video for small20130705-2436-1im7njj: Command 'ffmpeg -i '/tmp/small20130705-2436-1im7njj.mp4' -s 640x364 -y '/tmp/small20130705-2436-1im7njj20130705-2436-f413zk.mp4'' returned 1. Expected 0 Here is the command output:

ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:00:59 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/small20130705-2436-aolk6b.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2010-03-20 21:29:11
encoder : HandBrake 0.9.4 2009112300
Duration: 00:00:05.56, start: 0.000000, bitrate: 551 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 560x320, 465 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc
Metadata:
creation_time : 2010-03-20 21:29:11
Stream #0.1(eng): Audio: aac, 48000 Hz, mono, s16, 83 kb/s
Metadata:
creation_time : 2010-03-20 21:29:11
[buffer @ 0xa02c220] w:560 h:320 pixfmt:yuv420p
[scale @ 0xa0257c0] w:560 h:320 fmt:yuv420p -> w:640 h:364 fmt:yuv420p flags:0x4
encoder 'aac' is experimental and might produce bad results.
Add '-strict experimental' if you want to use it.
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:00:59 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/small20130705-2436-aolk6b.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2010-03-20 21:29:11
encoder : HandBrake 0.9.4 2009112300
Duration: 00:00:05.56, start: 0.000000, bitrate: 551 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 560x320, 465 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc
Metadata:
creation_time : 2010-03-20 21:29:11
Stream #0.1(eng): Audio: aac, 48000 Hz, mono, s16, 83 kb/s
Metadata:
creation_time : 2010-03-20 21:29:11
Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p'
[buffer @ 0x9551000] w:560 h:320 pixfmt:yuv420p
[scale @ 0x9551360] w:560 h:320 fmt:yuv420p -> w:320 h:182 fmt:yuvj420p flags:0x4
Output #0, image2, to '/tmp/small20130705-2436-aolk6b20130705-2436-lik82o.jpg':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2010-03-20 21:29:11
encoder : Lavf53.21.1
Stream #0.0(und): Video: mjpeg, yuvj420p, 320x182, q=2-31, 200 kb/s, 90k tbn, 30 tbc
Metadata:
creation_time : 2010-03-20 21:29:11
Stream mapping:
Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
frame= 0 fps= 0 q=0.0 Lsize= -0kB time=10000000000.00 bitrate= -0.0kbits/s dup=0 drop=166
video:0kB audio:0kB global headers:0kB muxing overhead -inf%

[paperclip] [ffmpeg] ffmpeg -i "/tmp/small20130705-2436-aolk6b.mp4" 2>&1
[paperclip] [ffmpeg] Command Success
[paperclip] [ffmpeg] Making...
[paperclip] [ffmpeg] Building Destination File: 'small20130705-2436-aolk6b' + 'mp4'
[paperclip] [ffmpeg] Destination File Built
[paperclip] [ffmpeg] Adding Geometry
[paperclip] [ffmpeg] Extracting Target Dimensions
[paperclip] [ffmpeg] Target Size is Available
[paperclip] [ffmpeg] Keeping Aspect Ratio
[paperclip] [ffmpeg] Resize
[paperclip] [ffmpeg] Convert Options: 640x364
[paperclip] [ffmpeg] Adding Format
[paperclip] [ffmpeg] Adding Source
[paperclip] [ffmpeg] Building Parameters
[paperclip] [ffmpeg] -i :source -s 640x364 -y :dest
Command :: ffmpeg -i '/tmp/small20130705-2436-aolk6b.mp4' -s 640x364 -y '/tmp/small20130705-2436-aolk6b20130705-2436-1f6hdz1.mp4'
[paperclip] An error was received while processing: #<Paperclip::Error: error while processing video for small20130705-2436-aolk6b: Command 'ffmpeg -i '/tmp/small20130705-2436-aolk6b.mp4' -s 640x364 -y '/tmp/small20130705-2436-aolk6b20130705-2436-1f6hdz1.mp4'' returned 1. Expected 0
Here is the command output:

[paperclip] [ffmpeg] ffmpeg -i "/tmp/small20130705-2436-aolk6b.mp4" 2>&1
[paperclip] [ffmpeg] Command Success
[paperclip] [ffmpeg] Making...
[paperclip] [ffmpeg] Building Destination File: 'small20130705-2436-aolk6b' + 'jpg'
[paperclip] [ffmpeg] Destination File Built
[paperclip] [ffmpeg] Adding Geometry
[paperclip] [ffmpeg] Extracting Target Dimensions
[paperclip] [ffmpeg] Target Size is Available
[paperclip] [ffmpeg] Keeping Aspect Ratio
[paperclip] [ffmpeg] Resize
[paperclip] [ffmpeg] Convert Options: 320x182
[paperclip] [ffmpeg] Adding Format
[paperclip] [ffmpeg] Adding Source
[paperclip] [ffmpeg] Building Parameters
[paperclip] [ffmpeg] -ss 10 -i :source -s 320x182 -vframes 1 -f image2 -y :dest
Command :: ffmpeg -ss 10 -i '/tmp/small20130705-2436-aolk6b.mp4' -s 320x182 -vframes 1 -f image2 -y '/tmp/small20130705-2436-aolk6b20130705-2436-lik82o.jpg'

Any idea what the problem might be? Attempting to manually generate thumbnails through ffmpeg work fine.

Metadata is parsing incorrectly

I'm getting a strange result from this gem. The issue seems to be related to the version of ffmpeg on the server. Note the different output from ffmpeg -i

On my Mac:
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 960x540, 6520 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc

On the server:
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 960x540, 6520 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)

When decoded from the meta store, this results in the following:
{:fps=>98, :size=>"bt709)", :aspect=>NaN, :length=>"0:00:12.05"}

I've only glanced at the code in this area, but it seems like the added parentheses in there are throwing things off.

Meta information?

The doc says:

You may optionally add <attachment>_meta to your model and paperclip-ffmpeg will add information about the processed video.

I'm struggling to understand where I can add this, and how I can then access this meta data?

ffmpeg is deprecated, need to use avconv in the future

I was watching ffmpeg run in the command line of an ubuntu 12.10 server and saw this:

*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.

With a little research I found this:
http://superuser.com/questions/507386/libav-vs-ffmpeg-better-to-use-libav-avconv-today

This might not break paperclip-ffmpeg now, but seems it will in the future.

paperclip-avconv anyone?

error on with cocaine

am getting these error ,I am using windows 7 on development

     Cocaine::ExitStatusError at /videos

      Command 'if command -v ffprobe 2>/dev/null; then echo "true"; else echo "false"; fi' r     returned 1. Expected 0 Here is the command output:

in my model

    has_attached_file :vid  ,
  :bucket => "egyactvideos",:styles => {
     :medium => { :geometry => "640x480", :format => 'flv' },
    :thumb => { :geometry => "100x100#", :format => 'jpg', :time => 10 }
  },:processors => [:ffmpeg]

if I removed the processors=>[:ffmpeg] it works and video uploaded as normal upload

meta not populating with delayed processing

Long time fan, first time caller...

Using delayed_paperclip in conjunction with paperclip-ffmpeg on Rails 4..._meta is never being populated. Here's the schema:

create_table "file_assets", force: true do |t|
t.string "name", null: false
t.text "description"
t.string "file_file_name"
t.string "file_content_type"
t.integer "file_file_size"
t.datetime "file_updated_at"
t.string "file_fingerprint"
t.date "active_date"
t.date "end_date"
t.string "slug", null: false
t.integer "position"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "category_id"
t.string "tags"
t.boolean "is_featured", default: false, null: false
t.float "progress", default: 0.0
t.boolean "file_processing"
t.text "file_meta"
end

After the file is processed I still have nil in file_meta. Am I right to assume this is due to the delayed processing? Any thoughts on how to make it work?

Dimensions not being added?

I have the following options set:

class MyClass < ActiveRecord::Base
  ...
  has_attached_file :video, :styles => {
    :mp4    => { :geometry => '640x360', :format => 'mp4' },
    :ogg    => { :geometry => '640x360', :format => 'ogg' },
    :thumb  => { :geometry => '320x180', :format => 'jpg', :time => 10 }
  }, :processors => [:ffmpeg]
end

When I try running an upload I don't seem to get the dimensions added to the ffmpeg command:

[paperclip] [ffmpeg] -i :source -y :dest
...
[paperclip] [ffmpeg] -i :source -y :dest
...
[paperclip] [ffmpeg] -ss 10 -i :source -y -vframes 1 -f image2 :dest

The files are getting created fine, but at their original sizes. I can see that the source file dimensions are being fed in fine - can't quite work out why the parameters are not being added?

Error when generating thumbnail only at certain sizes

I am seeing an error when creating thumbnails, but only at a specific geometry and with a specific source video size.

  • Geometry: 150x85#
  • Source Video Dimensions: 968x542

NOTE: If I change the geometry to something like 150x86#, or if I use a differently-sized source video, everything works.

Error from paperclip:

Command :: ffmpeg -ss 5 -i '/var/folders/_2/zlzsrrxx05l97m4r3lnyk7l40000gn/T/qsa-30MB20131003-5657-1b3y15e20131003-5657-18tb8tb20131003-5657-1mr8ohd.mp4' -vf scale=150:-1,pad=150:85:0:0.5:black -vframes 1 -f image2 -y '/var/folders/_2/zlzsrrxx05l97m4r3lnyk7l40000gn/T/qsa-30MB20131003-5657-1b3y15e20131003-5657-18tb8tb20131003-5657-1mr8ohd20131003-5657-vzvqd8.jpg'
[paperclip] An error was received while processing: #<Paperclip::Error: error while processing video for qsa-30MB20131003-5657-1b3y15e20131003-5657-18tb8tb20131003-5657-1mr8ohd: Command 'ffmpeg -ss 5 -i '/var/folders/_2/zlzsrrxx05l97m4r3lnyk7l40000gn/T/qsa-30MB20131003-5657-1b3y15e20131003-5657-18tb8tb20131003-5657-1mr8ohd.mp4' -vf scale=150:-1,pad=150:85:0:0.5:black -vframes 1 -f image2 -y '/var/folders/_2/zlzsrrxx05l97m4r3lnyk7l40000gn/T/qsa-30MB20131003-5657-1b3y15e20131003-5657-18tb8tb20131003-5657-1mr8ohd20131003-5657-vzvqd8.jpg'' returned 1. Expected 0
Here is the command output:

>

Running the command manually yields the following result:

gregs-macbook:road_pictures gregwoods$ ffmpeg -ss 5 -i '/Users/gregwoods/Desktop/qsa-30MB.mp4' -vf scale=150:-1,pad=149:84:0:0.5:black -vframes 1 -f image2 -y '/Users/gregwoods/Desktop/qsa-30MB.jpg'
ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug 27 2013 13:55:08 with Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/gregwoods/Desktop/qsa-30MB.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2013-10-02 20:08:21
    encoder         : HandBrake 0.9.9 2013051800
  Duration: 00:06:04.46, start: 0.000000, bitrate: 379 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x362 [SAR 136:135 DAR 8704:4887], 250 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
    Metadata:
      creation_time   : 2013-10-02 20:08:21
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 124 kb/s
    Metadata:
      creation_time   : 2013-10-02 20:08:21
[Parsed_pad_1 @ 0x7fe0e9c0ebe0] Input area 0:0:150:85 not within the padded area 0:0:148:84 or zero-sized
[Parsed_scale_0 @ 0x7fe0e9c0cfc0] Failed to configure input pad on Parsed_pad_1
Error opening filters!

This issue might be related to #25.

Problem using :output => { :fpre => path }

Hey,

I'm using paperclip-ffmpeg for quite a while now. I've always battled the difference between what I pass in the convert options and what with the fpre in the ffpreset file. But with time I got a decent way of dealing with the amount of options in the file and through the hash.

Can we see some more documentation on the matter or a possible sync in some way?
More complex commands are getting harder and harder to execute to the point where I can't add more commands than what I already have.

I don't know what test case to provide exactly but this is all I have working now.
Most other stuff like audio sync I can't get it to work through the gem.

strict=experimental
threads=0

vcodec=libx264
maxrate=5500k
bufsize=5500k
crf=16

acodec=aac
ab=96k
ac=2

g=15
refs=3
b_strategy=2
me_method=tesa
me_range=32
subq=9
aq-strength=1.0
partitions=all
coder=1
trellis=2
flags=+loop
cmp=+chroma

qcomp=0.60
qmax=51
qmin=0
qdiff=4

Regards,
Yavor

“No child processes” when default url and path are overwritten

I am not sure why this issue is called and I was not able to find help anywhere so I am writing here.

I have overwrite the default "url" and "path" where video files are stored as follows:

has_attached_file :video, styles: {medium: { geometry: "640x480", format: 'flv', :streaming => true },
thumb: { geometry: "100x100#", format: 'jpg', time:10 } },
processors: [:ffmpeg],
url: "/assets/webinars/:id/:style/:basename.:extension",
path: ":rails_root/public/assets/webinars/:id/:style/:basename.:extension"

and I get the following error: "No child processes - No child processes"

Here you can find more details about my system settings: http://stackoverflow.com/questions/16262204/no-child-processes-when-attaching-video-file-with-paperclip-ffmpeg

The interesting thing is that creating a folder "webinars" in the app/assets folder fix the issue, but the videos are uploaded in the public/assets/webinars folder which has been created automatically (as it is shown on the screen shot below)

a1

avprobe cannot recognise temporary file types

Using ffmpeg on my macbook and everything works fine. Using avconv on my linux box and things go wrong.

avprobe "/tmp/90b74c09188b1ae8690164b83a8e4f3e20141127-24892-1g2ge1o" 2>&1 raises the following error:

avprobe version 9.16-6:9.16-0ubuntu0.14.04.1, Copyright (c) 2007-2014 the Libav developers
  built on Aug 10 2014 18:16:02 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
/tmp/90b74c09188b1ae8690164b83a8e4f3e20141127-24892-1g2ge1o: Invalid data found when processing input

Renaming the file to contain the .gif extension and avprobe runs fine. Any ideas?

avprobe version 9.16-6:9.16-0ubuntu0.14.04.1, Copyright (c) 2007-2014 the Libav developers built on Aug 10 2014 18:16:02 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) avprobe 9.16-6:9.16-0ubuntu0.14.04.1 libavutil 52. 3. 0 / 52. 3. 0 libavcodec 54. 35. 0 / 54. 35. 0 libavformat 54. 20. 4 / 54. 20. 4 libavdevice 53. 2. 0 / 53. 2. 0 libavfilter 3. 3. 0 / 3. 3. 0 libavresample 1. 0. 1 / 1. 0. 1 libswscale 2. 1. 1 / 2. 1. 1

paperclip: 4.2.0
paperclip-ffmpeg: 1.2.0

command error: Cocaine::ExitStatusError (Command 'PATH=/usr/local/bin/:$PATH if command -v ffprobe 2>/dev/null; then echo "true"; else echo "false"; fi' returned 2. Expected 0

sh: -c: line 0: syntax error near unexpected token `then'
sh: -c: line 0: `PATH=/usr/local/bin/:$PATH if command -v ffprobe 2>/dev/null; then echo "true"; else echo "false"; fi'


Cocaine::ExitStatusError (Command 'PATH=/usr/local/bin/:$PATH if command -v ffprobe 2>/dev/null; then echo "true"; else echo "false"; fi' returned 2. Expected 0
Here is the command output:

):

Whats the Problem here.

Here is my video.rb

has_attached_file :video,
    styles: {:thumb => { :geometry => "100x100#", :format => 'jpg',
   :time => 10 }}, :processors => [:ffmpeg]
  validates_attachment_content_type :video, :content_type => "video/mp4"#/\Avideo\/.*\Z/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.