On Heroku I got FFMPEG::Error (Failed encoding.Errors: encoded file is invalid. Full output: )

Viewed 148

The code is:

tempfile = Tempfile.open('content')
tempfile.write(content)
movie = FFMPEG::Movie.new(tempfile.path)
screenshot_temp_file = Tempfile.open('screenshot')
movie.screenshot(screenshot_temp_file.path)

everything works fine locally, but when I try this on Heroku I got error at last row:

irb(main):013:0> movie.screenshot(screenshot_temp_file.path)
I, [2020-10-07T15:48:27.132114 #7]  INFO -- : Running transcoding...
["/app/vendor/ffmpeg/ffmpeg", "-y", "-i", "/tmp/content20201007-7-1g1955b", "-vframes", "1", "-f", "image2", "/tmp/screenshot20201007-7-1mmts7s"]

E, [2020-10-07T15:48:27.190572 #7] ERROR -- : Failed encoding...
["/app/vendor/ffmpeg/ffmpeg", "-y", "-i", "/tmp/content20201007-7-1g1955b", "-vframes", "1", "-f", "image2", "/tmp/screenshot20201007-7-1mmts7s"]


Errors: encoded file is invalid. 

Traceback (most recent call last):
        7: from /app/bin/irb:30:in `<main>'
        6: from /app/bin/irb:30:in `load'
        5: from /app/vendor/ruby-2.6.6/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        4: from (irb):13
        3: from /app/vendor/bundle/ruby/2.6.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/movie.rb:204:in `screenshot'
        2: from /app/vendor/bundle/ruby/2.6.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:45:in `run'
        1: from /app/vendor/bundle/ruby/2.6.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:112:in `validate_output_file'
FFMPEG::Error (Failed encoding.Errors: encoded file is invalid. Full output: )

I've try to pass some options, like :seek_time and validate: false but nothing changed. What am I doing wrong? Thank you so much!

EDIT: After Full output: ) there is nothing. I've install FFMPEG buildpack on Heroku, and can see it in ui:

enter image description here

0 Answers
Related