streamio / streamio-ffmpeg

Simple yet powerful ruby ffmpeg wrapper for reading metadata and transcoding movies
MIT License
1.64k stars 411 forks source link

Internal HEAD request not working with Pre-signed URLs #189

Open mhluska opened 6 years ago

mhluska commented 6 years ago

It looks like only URLs without query params are supported. The gem seems to toss away the query part which may result in 403 errors for Amazon S3 resources where the auth token is part of the query param. On top of that, the gem just throws a "the file does not exist" error which totally obscures the 403 code.


As a workaround, I'm doing this:

def ffmpeg_video_from_remote(remote_file_url)
  open(File.join('public', file.file.filename), 'wb') do |file|
    file << open(remote_file_url).read
    FFMPEG::Movie.new(Rails.root.join(file.path).to_s)
  end
end

Edit: I was wrong. It looks like the query params do get used but what is happening is my pre-signed URL to Amazon S3 is only meant to be used with GET but the library does a HEAD request.

atash66 commented 6 years ago

Ok