
Recherche avancée
Médias (2)
-
Granite de l’Aber Ildut
9 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
Géodiversité
9 septembre 2011, par ,
Mis à jour : Août 2018
Langue : français
Type : Texte
Autres articles (44)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation" -
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (6536)
-
use java-ffmpeg wrapper, or simply use java runtime to execute ffmpeg ?
12 mars 2017, par user156153I’m pretty new to Java, need to write a program that listen to video conversion instructions and convert the video once an new instruction arrives (instructions is stored in Amazon SQS, but it’s irrelevant to my question)
I’m facing a choice, either use Java RunTime to exec ’ffmpeg’ conversion (like from command line), or I can use a ffmpeg wrapper written inJava http://fmj-sf.net/ffmpeg-java/getting_started.php
I’d much prefer using Java Runtime to exec ffmpeg directly, and avoid using java-ffmpeg wrapper as I have to learn the library. so my question is are there any benefits using java-ffmpeg wrapper over exec ffmpeg directly using Runtime ? I don’t need ffmpeg to play videos, just convert videos
Thanks
-
Building my JAVA parameter array for FFMPEG
29 janvier 2016, par user3541092FFmpeg Version : N-63893-gc69defd Copyright (c) 2000-2014 the FFmpeg developers
built on Jul 16 2014 05:38:01 with gcc 4.6 (Debian 4.6.3-1)Machine : Amazon Linux t2.micro (free tier)
Sample File : sample_iTunes.mov
Sample File URL : https://support.apple.com/en-us/HT201549I’m trying to replicate the following FFmpeg command, using a string array and then pass this array into the Runtime.getRuntime().exec().
ffmpeg -i file:/var/local/ffmpegtest/media_input/sample_iTunes.mov -pix_fmt yuv420p -c:v libx264 -vtag mp42 -metadata major_brand="mp42" -b:v 8000k -minrate 8000k -maxrate 10000k -ac 2 -strict experimental -c:a aac -b:a 256k -metadata:s:a:0 handler="Stereo" /var/local/ffmpegtest/media_output/sample_iTunes.mp4 -y
NOTE : This works when I pass the full command, as a single string into Runtime.getRuntime().exec().
String _cmd = "ffmpeg -i %s -pix_fmt yuv420p -c:v libx264 -vtag mp42 -metadata major_brand=\"mp42\" "
+ "-b:v 8000k -minrate 8000k -maxrate 10000k -ac 2 -strict experimental -c:a aac -b:a 256k -metadata:s:a:0 handler=\"Stereo\" %s -y";
String _ffmpegCommand = String.format(_cmd, _inputFile, _outPutFile);
p = Runtime.getRuntime().exec(_ffmpegCommand);
BufferedReader _reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String _line = null;
while((_line = _reader.readLine()) != null) {
lw.writeLine(_logPath + _logName, _line);
System.out.println(_line);
}I started out with just a basic parameter list. As I add add each additional parameter, I re-build the JAR file and upload it to my EC2 instance to test for any errors.
The following string array works :
try
{
String[] _params = {"ffmpeg",
"-i",
String.format("%s", _inputFile),
"-pix_fmt",
"yuv420p",
"-c:v",
"libx264",
String.format("%s", _outPutFile),
"-y"};
p = Runtime.getRuntime().exec(_params);
BufferedReader _reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String _line = null;
while((_line = _reader.readLine()) != null) {
lw.writeLine(_logPath + _logName, _line);
System.out.println(_line);
}
}
catch (Exception e) {
BufferedReader _reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String _line = null;
while((_line = _reader.readLine()) != null) {
lw.writeLine(_logPath + _logName, _line);
System.out.println(_line);
}
}However, when I continue to build the array with additional parameters, I begin to experience problems (lets add -vtag mp42) :
try
{
String[] _params = {"ffmpeg",
"-i",
String.format("%s", _inputFile),
"-pix_fmt",
"yuv420p",
"-c:v",
"libx264",
"-vtag", // <---- New
"mp42", // <--- New
String.format("%s", _outPutFile),
"-y"};
p = Runtime.getRuntime().exec(_params);
BufferedReader _reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String _line = null;
while((_line = _reader.readLine()) != null) {
lw.writeLine(_logPath + _logName, _line);
System.out.println(_line);
}
}
catch (Exception e) {
BufferedReader _reader = new BufferedReader(new InputStreamReader(p.getErrorStream()));
String _line = null;
while((_line = _reader.readLine()) != null) {
lw.writeLine(_logPath + _logName, _line);
System.out.println(_line);
}
}Error Message : Could not write header for output file #0 (incorrect codec parameters ?) : Invalid data found when processing input
Full Log output for errant trail run :
29 Jan 2016 03:45:09 UTC - Running FFMpeg...
29 Jan 2016 03:45:09 UTC - Input file: /var/local/ffmpegtest/media_input/sample_iTunes.mov
29 Jan 2016 03:45:09 UTC - Output file: /var/local/ffmpegtest/media_output/sample_iTunes.mp4
29 Jan 2016 03:45:09 UTC - ffmpeg version N-63893-gc69defd Copyright (c) 2000-2014 the FFmpeg developers
29 Jan 2016 03:45:09 UTC - built on Jul 16 2014 05:38:01 with gcc 4.6 (Debian 4.6.3-1)
29 Jan 2016 03:45:09 UTC - configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
29 Jan 2016 03:45:09 UTC - libavutil 52. 89.100 / 52. 89.100
29 Jan 2016 03:45:09 UTC - libavcodec 55. 66.101 / 55. 66.101
29 Jan 2016 03:45:09 UTC - libavformat 55. 43.100 / 55. 43.100
29 Jan 2016 03:45:09 UTC - libavdevice 55. 13.101 / 55. 13.101
29 Jan 2016 03:45:09 UTC - libavfilter 4. 8.100 / 4. 8.100
29 Jan 2016 03:45:09 UTC - libswscale 2. 6.100 / 2. 6.100
29 Jan 2016 03:45:09 UTC - libswresample 0. 19.100 / 0. 19.100
29 Jan 2016 03:45:09 UTC - libpostproc 52. 3.100 / 52. 3.100
29 Jan 2016 03:45:09 UTC - Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/local/ffmpegtest/media_input/sample_iTunes.mov':
29 Jan 2016 03:45:09 UTC - Metadata:
29 Jan 2016 03:45:09 UTC - major_brand : qt
29 Jan 2016 03:45:09 UTC - minor_version : 537199360
29 Jan 2016 03:45:09 UTC - compatible_brands: qt
29 Jan 2016 03:45:09 UTC - creation_time : 2005-10-17 22:54:32
29 Jan 2016 03:45:09 UTC - Duration: 00:01:25.50, start: 0.000000, bitrate: 307 kb/s
29 Jan 2016 03:45:09 UTC - Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 261 kb/s, 10 fps, 10 tbr, 3k tbn, 25 tbc (default)
29 Jan 2016 03:45:09 UTC - Metadata:
29 Jan 2016 03:45:09 UTC - creation_time : 2005-10-17 22:54:33
29 Jan 2016 03:45:09 UTC - handler_name : Apple Video Media Handler
29 Jan 2016 03:45:09 UTC - encoder : 3ivx D4 4.5.1
29 Jan 2016 03:45:09 UTC - Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 43 kb/s (default)
29 Jan 2016 03:45:09 UTC - Metadata:
29 Jan 2016 03:45:09 UTC - creation_time : 2005-10-17 22:54:34
29 Jan 2016 03:45:09 UTC - handler_name : Apple Sound Media Handler
29 Jan 2016 03:45:09 UTC - [libx264 @ 0x30c2c00] using SAR=1/1
29 Jan 2016 03:45:09 UTC - [libx264 @ 0x30c2c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX AVX2 FMA3 BMI1 BMI2
29 Jan 2016 03:45:09 UTC - [libx264 @ 0x30c2c00] profile High, level 2.2
29 Jan 2016 03:45:09 UTC - [libx264 @ 0x30c2c00] 264 - core 129 r2230 1cffe9f - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 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=10 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
29 Jan 2016 03:45:09 UTC - [mp4 @ 0x30c21a0] Tag mp42/0x3234706d incompatible with output codec id '28' ([33][0][0][0])
29 Jan 2016 03:45:09 UTC - Output #0, mp4, to '/var/local/ffmpegtest/media_output/sample_iTunes.mp4':
29 Jan 2016 03:45:09 UTC - Metadata:
29 Jan 2016 03:45:09 UTC - major_brand : qt
29 Jan 2016 03:45:09 UTC - minor_version : 537199360
29 Jan 2016 03:45:09 UTC - compatible_brands: qt
29 Jan 2016 03:45:09 UTC - Stream #0:0(eng): Video: h264 (libx264) (mp42 / 0x3234706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 10 fps, 90k tbn, 10 tbc (default)
29 Jan 2016 03:45:09 UTC - Metadata:
29 Jan 2016 03:45:09 UTC - creation_time : 2005-10-17 22:54:33
29 Jan 2016 03:45:09 UTC - handler_name : Apple Video Media Handler
29 Jan 2016 03:45:09 UTC - encoder : Lavc55.66.101 libx264
29 Jan 2016 03:45:09 UTC - Stream #0:1(eng): Audio: aac (libvo_aacenc), 32000 Hz, mono, s16, 128 kb/s (default)
29 Jan 2016 03:45:09 UTC - Metadata:
29 Jan 2016 03:45:09 UTC - creation_time : 2005-10-17 22:54:34
29 Jan 2016 03:45:09 UTC - handler_name : Apple Sound Media Handler
29 Jan 2016 03:45:09 UTC - encoder : Lavc55.66.101 libvo_aacenc
29 Jan 2016 03:45:09 UTC - Stream mapping:
29 Jan 2016 03:45:09 UTC - Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
29 Jan 2016 03:45:09 UTC - Stream #0:1 -> #0:1 (aac (native) -> aac (libvo_aacenc))
29 Jan 2016 03:45:09 UTC - Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input -
Rails using stremio-ffmpeg gem to watermark a movie while uploading
16 juin 2016, par FelixI am using carrierwave to upload a movie to amazon s3 that works perfect.
Now I want to add a watermark to the movie while uploading or after uploading, I don’t know, what’s the best way ?
I tried this :
movie_controller.rb
action uploadVideomovie = FFMPEG::Movie.new(@vid.video.url)
puts "........................................"
puts movie.inspect
if @vid.saveJust to find out if the video is catched from stremio.
But then I got the error that the movie is not found, the problem is that it doesn’t look in the amazon s3 bucket, it looks on my local server
No such file or directory - the file '/uploads/tmp/1462954331-3471-8766/VID-20160424-WA0013.mp4' does not exist
What could be the solution ? or should I do this in carrierwave uploader ?
UPDATE :
When I do this after the .save action it looks at amazon s3 bucket .. but also says that the movie isn’t there. But if I call it directly in browser it’s displayed.
UPDATE Code :
#Laedt ein Video hoch
def uploadMovie
@user = User.find_by_id session[:user_id]
#Holt alle Channels für die er eine Berechtigung hat (Eingeloggter user)
@user = User.find_by_id session[:user_id]
@knowledgeproviderList = @user.knowledgeprovider
@channels = Channel.where(knowledgeprovider_id: @knowledgeproviderList.pluck(:id))
@vid = Movie.new(movies_params)
@channel = Channel.find(params[:vid][:channel_id])
@vid.channel = @channel
#Fügt dem Movie einen Tag hinzu
createTag params
createCategory params
if @vid.save
flash[:notice] = t("flash.saved")
#movie = FFMPEG::Movie.new(@vid.video.url)
#puts "........................................"
#puts movie.inspect
redirect_to :action => :add
else
redirect_to :action => :add
end
endUpdate error :
movie = FFMPEG::Movie.new(@vid.video.current_path)
options = {watermark: "mages/header.png", resolution: "640x360", watermark_filter: { position: "RT", padding_x: 10, padding_y: 10 } }
movie.transcode("movie.flv", options)Update :
Added the code in the uploader :process :watermark_movie
def watermark_movie
if self.file.path
options = {watermark: "images/header.png", resolution: "640x360", watermark_filter: { position: "RT", padding_x: 10, padding_y: 10 } }
self.model.file = FFMPEG::Movie.new(self.file.path).transcode("#{root}/#{cache_dir}/#{self.cache_id}/file.mp4", options)
end
endError :
multi_json (1.12.0) lib/multi_json/adapter.rb:19:in `load'
multi_json (1.12.0) lib/multi_json.rb:122:in `load'
streamio-ffmpeg (2.0.0) lib/ffmpeg/movie.rb:28:in `initialize'
app/uploaders/movie_uploader.rb:40:in `new'
app/uploaders/movie_uploader.rb:40:in `watermark_movie'
carrierwave (0.11.2) lib/carrierwave/uploader/processing.rb:84:in `block in process!'
carrierwave (0.11.2) lib/carrierwave/uploader/processing.rb:76:in `each'
carrierwave (0.11.2) lib/carrierwave/uploader/processing.rb:76:in `process!'
carrierwave_backgrounder (0.4.2) lib/backgrounder/delay.rb:14:in `process!'
carrierwave (0.11.2) lib/carrierwave/uploader/callbacks.rb:18:in `block in with_callbacks'
carrierwave (0.11.2) lib/carrierwave/uploader/callbacks.rb:18:in `each'
carrierwave (0.11.2) lib/carrierwave/uploader/callbacks.rb:18:in `with_callbacks'
carrierwave (0.11.2) lib/carrierwave/uploader/cache.rb:134:in `cache!'
carrierwave (0.11.2) lib/carrierwave/mount.rb:329:in `cache'
carrierwave (0.11.2) lib/carrierwave/mount.rb:163:in `video='
carrierwave (0.11.2) lib/carrierwave/orm/activerecord.rb:39:in `video='
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:54:in `public_send'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
actionpack (4.2.1) lib/action_controller/metal/strong_parameters.rb:183:in `each_pair'
actionpack (4.2.1) lib/action_controller/metal/strong_parameters.rb:183:in `each_pair'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
activerecord (4.2.1) lib/active_record/core.rb:559:in `init_attributes'
activerecord (4.2.1) lib/active_record/core.rb:281:in `initialize'
activerecord (4.2.1) lib/active_record/inheritance.rb:61:in `new'
activerecord (4.2.1) lib/active_record/inheritance.rb:61:in `new'
app/controllers/movies_controller.rb:71:in `uploadMovie'
actionpack (4.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.1) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.1) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.1) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.1) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.1) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `call'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:819:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:38:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.1) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
activerecord (4.2.1) lib/active_record/migration.rb:378:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.3.0) lib/web_console/middleware.rb:20:in `block in call'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.1) lib/rails/engine.rb:518:in `call'
railties (4.2.1) lib/rails/application.rb:164:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
/home/felix/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/home/felix/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/home/felix/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'UPDATE — Movie Uploader
# encoding: utf-8
class MovieUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
include CarrierWave::Video
include CarrierWave::Video::Thumbnailer
include CarrierWave::Backgrounder::Delay
require 'rubygems'
require 'streamio-ffmpeg'
# Choose what kind of storage to use for this uploader:
storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
process :watermark_movie
def watermark_movie
puts "ssssssssssssssssssssssssssssssssss"
puts self.file.inspect
if self.file.path
options = {watermark: "http://felix-hohlwegler.de/holz-soft/include/designs/design13/images/header.png", resolution: "640x360", watermark_filter: { position: "RT", padding_x: 10, padding_y: 10 } }
self.model.file = FFMPEG::Movie.new(self.file.path).transcode("#{root}/#{cache_dir}/#{self.cache_id}/file.mp4", options)
end
end
version :thumb do
process thumbnail: [{format: 'png', quality: 10, size: 1200, strip: false, seek: 10, logger: Rails.logger}]
def full_filename for_file
png_name for_file, version_name
end
end
def png_name for_file, version_name
%Q{#{version_name}_#{for_file.chomp(File.extname(for_file))}.png}
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(mov avi mkv mpeg mpeg2 mp4 3gp)
end
end