Advertisement
rowntreerob

heroku ffmpeg

Dec 24th, 2012
1,541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dont have to use Vulcan to build ffmpeg libs on heroku hardware. The precompiled linux-64 binary from the download page will work. Just get it and include in ./vendor/bin of your project.
  2.  
  3. download the static binary for linux-64 from ffmpeg/downloads page and include in heroku project
  4. insert following bash script into heroku project
  5. push to heroku
  6. alter heroku PATH to include the new binaries ( script, ffmpeg )
  7.  
  8. run the script
  9.  
  10. #!/bin/bash
  11. # get 2 input files ( jpg , wav ) and use them in 2pass ffmpeg to create an .mp4 output file
  12. shopt -s globstar
  13. uri=$1
  14. filnam="${uri##*/}"
  15. uri2=$2
  16. filnam2="${uri2##*/}"
  17. curl -#LO  $uri
  18. curl -#LO  $uri2
  19. ffmpeg -y -i "$filnam" -i "$filnam2" -r 1/2 -pass 1 -vcodec libx264 -b:v 200k -bt 50k  -an -f mp4 -strict -2 -passlogfile mydummy /dev/null
  20. ffmpeg -y -i "$filnam" -i "$filnam2" -r 1/2 -pass 2 -vcodec libx264 -b:v 200k -bt 50k  -f mp4 -strict -2 -passlogfile mydummy -ar 44100 filot.mp4
  21.  
  22. $ vendor/bin/pars_submit http://files.parse.com/1315e4d8-f302-4337-adbe-d8650ab5c312/c74489cb-c962-4678-b762-f7e990cb397b-me760935400.jpg http://files.parse.com/1315e4d8-f302-4337-adbe-d8650ab5c312/f780cfa6-d569-40c6-9b23-8632db887d5c-20121216113810.wav
  23. http://files.parse.com/1315e4d8-f302-4337-adbe-d8650ab5c312/c74489cb-c962-4678-b762-f7e990cb397b-me760935400.jpg
  24. c74489cb-c962-4678-b762-f7e990cb397b-me760935400.jpg
  25.  
  26. ############################################################################################################################# 100.0%
  27. ############################################################################################################################# 100.0%
  28. ffmpeg version N-47810-geee8c94 Copyright (c) 2000-2012 the FFmpeg developers
  29.   built on Dec 13 2012 09:06:31 with gcc 4.7 (Debian 4.7.2-4)
  30.   configuration: --extra-cflags=-I../static/include --extra-ldflags='-L../static/lib -static' --enable-gpl --enable-version3 --enable-static --disable-shared --disable-debug --enable-runtime-cpudetect --disable-x11grab --enable-libmp3lame --enable-libx264 --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --disable-ffserver
  31.   libavutil      52. 12.100 / 52. 12.100
  32.   libavcodec     54. 79.102 / 54. 79.102
  33.   libavformat    54. 49.101 / 54. 49.101
  34.   libavdevice    54.  3.102 / 54.  3.102
  35.   libavfilter     3. 27.101 /  3. 27.101
  36.   libswscale      2.  1.103 /  2.  1.103
  37.   libswresample   0. 17.102 /  0. 17.102
  38.   libpostproc    52.  2.100 / 52.  2.100
  39. Input #0, image2, from 'c74489cb-c962-4678-b762-f7e990cb397b-me760935400.jpg':
  40.   Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
  41.     Stream #0:0: Video: mjpeg, yuvj420p, 1296x972 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
  42. [wav @ 0x2984700] max_analyze_duration 5000000 reached at 5120000
  43. Guessed Channel Layout for  Input Stream #1.0 : mono
  44. Input #1, wav, from 'f780cfa6-d569-40c6-9b23-8632db887d5c-20121216113810.wav':
  45.   Duration: 00:00:21.27, bitrate: 256 kb/s
  46.     Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s
  47. File '/dev/null' already exists. Overwrite ? [y/N] y
  48. using SAR=1/1
  49. [libx264 @ 0x298b000] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
  50. [libx264 @ 0x298b000] profile Main, level 3.2
  51. [libx264 @ 0x298b000] 264 - core 129 r2230 1cffe9f - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
  52. Output #0, mp4, to '/dev/null':
  53.   Metadata:
  54.     encoder         : Lavf54.49.101
  55.     Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1296x972 [SAR 1:1 DAR 4:3], q=-1--1, pass 1, 200 kb/s, 16384 tbn, 0.50 tbc
  56. Stream mapping:
  57.   Stream #0:0 -> #0:0 (mjpeg -> libx264)
  58. Press [q] to stop, [?] for help
  59. frame=    1 fps=0.0 q=4.0 Lsize=     848kB time=00:00:02.00 bitrate=3472.1kbits/s    
  60. video:847kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.087747%
  61. [libx264 @ 0x298b000] frame I:1     Avg QP: 5.49  size:866529
  62. [libx264 @ 0x298b000] mb I  I16..4:  7.4%  0.0% 92.6%
  63. [libx264 @ 0x298b000] final ratefactor: 28.98
  64. [libx264 @ 0x298b000] coded y,uvDC,uvAC intra: 99.8% 99.8% 99.7%
  65. [libx264 @ 0x298b000] i16 v,h,dc,p: 10%  5% 70% 15%
  66. [libx264 @ 0x298b000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 14% 12%  6%  6%  7% 14%  8% 13%
  67. [libx264 @ 0x298b000] i8c dc,h,v,p: 45% 19% 22% 14%
  68. [libx264 @ 0x298b000] kb/s:3466.12
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement