Note that there are some explanatory texts on larger screens.

plurals
  1. PORails: Encoder error when converting video using FFMPEG on Heroku
    primarykey
    data
    text
    <p>I'm trying to upload a video and convert the file to mp4 and reduce the file size using the <code>paperclip-ffmpeg</code> and <code>paperclip</code> gems. Everything works fine running a local server and I'm only getting this problem on heroku. I have ffmpeg installed in vendor/ffmpeg/ (I followed these steps: <a href="https://gist.github.com/3963576" rel="nofollow">https://gist.github.com/3963576</a>). Here is the code I've got and the error I'm getting:</p> <p>models/video.rb:</p> <pre><code>class Video &lt; ActiveRecord::Base attr_accessible :content, :user_id, :video has_attached_file :video , :styles =&gt; { :medium =&gt; { :geometry =&gt; "500x500", :format =&gt; 'mp4', :convert_options =&gt; { :output =&gt; { :vcodec =&gt; 'libx264', :b =&gt; '1000k', :bt =&gt; '200k', :acodec =&gt; 'libfaac', :ab =&gt; '56k', :ac =&gt; 2 } } } }, :processors =&gt; [:ffmpeg] belongs_to :user end </code></pre> <p>when I run <code>heroku logs</code>:</p> <pre><code>2013-01-02T00:38:20+00:00 app[web.1]: Started POST "/videos" for 101.170.255.251 at 2013-01-02 00:38:20 +0000 2013-01-02T00:38:20+00:00 app[web.1]: Processing by VideosController#create as HTML 2013-01-02T00:38:20+00:00 app[web.1]: Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"X0IKts46TF8aFvEb1I/szFo/28omlVBXIIyJ3APz3YA=", "video"=&gt;{"content"=&gt;"", "video"=&gt;#&lt;ActionDispatch::Http::UploadedFile:0x00000004ac88a8 @original_filename="sample.mov", @content_type="video/quicktime", @headers="Content-Disposition: form-data; name=\"video[video]\"; filename=\"sample.mov\"\r\nContent-Type: video/quicktime\r\n", @tempfile=#&lt;File:/tmp/RackMultipart20130102-2-1ch9zcp&gt;&gt;}, "commit"=&gt;"Post"} 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] ffmpeg -i "/tmp/sample20130102-2-4j5sgh.mov" 2&gt;&amp;1 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Resize 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Command Success 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Making... 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Building Destination File: 'sample20130102-2-4j5sgh' + 'mp4' 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Destination File Built 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Adding Source 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Adding Geometry 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Convert Options: 500x280 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Adding Format 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] -i :source -y -vcodec libx264 -b 1000k -bt 200k -acodec libfaac -ab 56k -ac 2 -s 500x280 :dest 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Extracting Target Dimensions 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Building Parameters 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Target Size is Available 2013-01-02T00:38:20+00:00 app[web.1]: [paperclip] [ffmpeg] Keeping Aspect Ratio 2013-01-02T00:38:20+00:00 app[web.1]: Command :: ffmpeg -i '/tmp/sample20130102-2-4j5sgh.mov' -y -vcodec libx264 -b 1000k -bt 200k -acodec libfaac -ab 56k -ac 2 -s 500x280 '/tmp/sample20130102-2-4j5sgh20130102-2-1mr35ix.mp4' 2013-01-02T00:38:20+00:00 app[web.1]: ffmpeg version git-2013-01-01-d079d1d Copyright (c) 2000-2012 the FFmpeg developers 2013-01-02T00:38:20+00:00 app[web.1]: built on Jan 1 2013 12:59:49 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5) 2013-01-02T00:38:20+00:00 app[web.1]: configuration: --enable-shared --disable-asm --prefix=/app/vendor/ffmpeg 2013-01-02T00:38:20+00:00 app[web.1]: libavfilter 3. 30.102 / 3. 30.102 2013-01-02T00:38:20+00:00 app[web.1]: libavcodec 54. 85.100 / 54. 85.100 2013-01-02T00:38:20+00:00 app[web.1]: libavdevice 54. 3.102 / 54. 3.102 2013-01-02T00:38:20+00:00 app[web.1]: libavutil 52. 13.100 / 52. 13.100 2013-01-02T00:38:20+00:00 app[web.1]: libswresample 0. 17.102 / 0. 17.102 2013-01-02T00:38:20+00:00 app[web.1]: libswscale 2. 1.103 / 2. 1.103 2013-01-02T00:38:20+00:00 app[web.1]: libavformat 54. 58.100 / 54. 58.100 2013-01-02T00:38:21+00:00 app[web.1]: creation_time : 2013-01-02 00:36:58 2013-01-02T00:38:21+00:00 app[web.1]: minor_version : 0 2013-01-02T00:38:21+00:00 app[web.1]: major_brand : qt 2013-01-02T00:38:21+00:00 app[web.1]: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/sample20130102-2-4j5sgh.mov': 2013-01-02T00:38:21+00:00 app[web.1]: model : iPhone 4 2013-01-02T00:38:21+00:00 app[web.1]: compatible_brands: qt 2013-01-02T00:38:21+00:00 app[web.1]: model-eng : iPhone 4 2013-01-02T00:38:21+00:00 app[web.1]: make-eng : Apple 2013-01-02T00:38:21+00:00 app[web.1]: date-eng : 2012-12-28T00:39:34+1100 2013-01-02T00:38:21+00:00 app[web.1]: encoder : 6.0 2013-01-02T00:38:21+00:00 app[web.1]: encoder-eng : 6.0 2013-01-02T00:38:21+00:00 app[web.1]: Duration: 00:00:00.03, start: 0.000000, bitrate: 9465 kb/s 2013-01-02T00:38:21+00:00 app[web.1]: Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 75 kb/s 2013-01-02T00:38:21+00:00 app[web.1]: date : 2012-12-28T00:39:34+1100 2013-01-02T00:38:21+00:00 app[web.1]: creation_time : 2013-01-02 00:36:58 2013-01-02T00:38:21+00:00 app[web.1]: make : Apple 2013-01-02T00:38:21+00:00 app[web.1]: Metadata: 2013-01-02T00:38:21+00:00 app[web.1]: Metadata: 2013-01-02T00:38:21+00:00 app[web.1]: handler_name : Core Media Data Handler 2013-01-02T00:38:21+00:00 app[web.1]: Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 8605 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc 2013-01-02T00:38:21+00:00 app[web.1]: Metadata: 2013-01-02T00:38:21+00:00 app[web.1]: handler_name : Core Media Data Handler 2013-01-02T00:38:21+00:00 app[web.1]: Unknown encoder 'libx264' 2013-01-02T00:38:21+00:00 app[web.1]: Please use -b:a or -b:v, -b is ambiguous 2013-01-02T00:38:21+00:00 app[web.1]: creation_time : 2013-01-02 00:36:58 2013-01-02T00:38:21+00:00 app[web.1]: [paperclip] An error was received while processing: #&lt;Paperclip::Error: error while processing video for sample20130102-2-4j5sgh: Command 'ffmpeg -i :source -y -vcodec libx264 -b 1000k -bt 200k -acodec libfaac -ab 56k -ac 2 -s 500x280 :dest' returned 1. Expected 0&gt; 2013-01-02T00:38:21+00:00 app[web.1]: Rendered videos/new.html.erb within layouts/application (3.2ms) 2013-01-02T00:38:21+00:00 heroku[router]: at=info method=POST path=/videos host=stark-sea-5654.herokuapp.com fwd=101.170.255.251 dyno=web.1 queue=0 wait=0ms connect=3ms service=3685ms status=200 bytes=1878 2013-01-02T00:38:21+00:00 app[web.1]: Rendered layouts/_footer.html.erb (0.0ms) 2013-01-02T00:38:21+00:00 app[web.1]: Completed 200 OK in 342ms (Views: 124.8ms | ActiveRecord: 10.4ms) 2013-01-02T00:38:21+00:00 app[web.1]: Rendered layouts/_header.html.erb (1.2ms) </code></pre> <p>Everything works fine until the message <code>Unknown encoder 'libx264'</code> so I'm thinking it's something to do with ffmpeg perhaps?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload