Hi

It's extremely rare that I have to post something on the Rails list,  
but this is one of those times that I've been completely stuck for  
countless hours.

Environment: Rails 2.3.3

I've implemented a custom processor proc for video thumbnailing with  
Paperclip (latest trunk version as git submodule, and yes, it's  
updated) using the instructions posted at 
http://thewebfellas.com/blog/2009/2/22/video-thumbnails-with-ffmpeg-and-paperclip
 
. I've updated the interpolations section to reflect the new API, but  
that's completely beside the matter.

When I run my rspec test for video, it fails (images are thumbnailed  
correctly, non-video and non-image files are saved without processing,  
all as intended):

   it "should capture a video frame from video files (mimetyped test)"  
do
     test_file = './spec/models/files/dirt.mov'
     mimetype = 'video/quicktime'
     doc = Document.new(:asset =>  
ActionController::TestUploadedFile.new(test_file, mimetype))
     lambda {doc.save!}.should_not raise_error
   end

I'm mimicking an actual upload to stay as close to the real web  
interaction as possible.

It bombs with (making the test fail):

identify: no decode delegate for this image format `/var/folders/uQ/ 
uQCnby5GHUOu0O+CzWEVmk+++TI/-Tmp-/stream.6150.4' @ constitute.c/ 
ReadImage/488.

So for some reason it's still using ImageMagick to process the  
attachment, even though I even explicitely set the "video?" instance  
method to always return true (which should make it fail for normal  
image files, but even that it doesn't).

Inspecting the asset brings up the properties I expect to see:

--- &id004 !ruby/object:Paperclip::Attachment
_asset_content_type: video/quicktime
_asset_file_name: dirt.mov
_asset_file_size: 2162316
_asset_updated_at: 2009-08-17 15:35:29.113877 +02:00
convert_options: {}

...

   :processors: &id001 !ruby/object:Proc {}


For clarification, my Paperclip method in the model:

   has_attached_file :asset,
                     :styles => { :full => "1920x1080", :medium =>  
["205x154", :png], :large => ["450x",:png] },
                     :default_style => :full,
                     :url => "/ 
uploads/:attachment/:id/:style.:content_type_extension",
                     :processors => lambda { |a| a.video? ?  
[ :video_thumbnail ] : [ :thumbnail ] }


I'm completely stumped here, the VideoThumbnail class is never called,  
even though it's loaded correctly etc. Been looking and debugging  
Paperclip itself, hoping to find something in the plugin, but to no  
avail.

The proc does fire though: when I replace a.video? with a.image?, I  
can see ffmpeg firing for all images in the tests (failing to process  
them quite obviously).

Just to avoid needless tips on ffmpeg not being correctly installed or  
anything: I had it working with attachment_fu. The reason I switched  
to Paperclip is because I hate monkeypatching a plugin (with an extra  
custom plugin) up to a point where you're basically making all code  
ugly and prone to fail as you keep adding extra requirements (it was  
already getting up to that point). Paperclip just seemed to provide me  
with nice hooks to do what I want in a beautiful way... if it would  
work :-)

Anyone have some genious reason as to why this is happening?


Best regards

Peter De Berdt


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to