"Not Found" when generating thumbnail

Subscribe to "Not Found" when generating thumbnail 8 posts, 2 voices

 
Avatar Shpigford 30 posts

I’m trying to generate a thumbnail like so:

HeyWatch::EncodedVideo.find("284387").thumbnail :start => 2, :width => 640, :height => 480

When doing that, Rails throws a “Not Found” error. Just doing HeyWatch::EncodedVideo.find("284387") by itself returns fine…it’s just adding the .thumbnail that doesn’t seem to work.

 
Avatar Shpigford 30 posts

As an update to this, when doing File.open on the .thumbnail generation I get:

A Errno::ENOENT occurred in ping#encode:

No such file or directory - ÿØÿþ
 
Avatar Bruno Celeste 374 posts

With your browser, go to http://heywatch.com/encoded_video/284387.jpg?start=2&width=640&height=480

What is the response?

 
Avatar Shpigford 30 posts

That works, but when I try to do that with File.open I get a 401 Unauthorized message.

 
Avatar Bruno Celeste 374 posts

Hmm, the thumbnail method returns binary data directly. What is your code?

You should do this:

thumb = HeyWatch::EncodedVideo.find("284387").thumbnail :start => 2, :width => 640, :height => 480
File.open("thumb.jpg", "wb") {|f| f.write(thumb) }
 
Avatar Shpigford 30 posts

What does “thumb.jpg” reference? I’m trying to upload the generated thumbnail to S3 like so:

@videothumb = HeyWatch::EncodedVideo.find("284387").thumbnail :start => 2, :width => 640, :height => 480

S3Object.store(
      "video/#{@item.id}/#{@item.key}.jpg",
      File.open(@videothumb, "r"),
      "media.pugspot.com",
      :access => :public_read
    )
 
Avatar Bruno Celeste 374 posts

It’s not correct since @videothumb is not a file but binary data.

@videothumb = HeyWatch::EncodedVideo.find("284387").thumbnail :start => 2, :width => 640, :height => 480

S3Object.store(
      "video/#{@item.id}/#{@item.key}.jpg",
      @videothumb,
      "media.pugspot.com",
      :access => :public_read
    )
 
Avatar Shpigford 30 posts

Ah, there we go. :) That worked.

Thanks Bruno!