
Recherche avancée
Autres articles (111)
-
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...)
Sur d’autres sites (4007)
-
AWS Lambda : ffmpeg thumbnails Generator : empty JPG
3 septembre 2020, par MagikeyWhen a video is uploaded on S3 i want to store a JPG screenshot.



On a lambda function with amazon AWS, i do :



...

 let tmpFile = createWriteStream(`/tmp/screenshot.jpg`)

 var ffmpeg = spawn(ffmpegPath, [
 "-ss","00:00:05",
 "-i", target,
 "-vf", "thumbnail,scale=200:200", 
 "-qscale:v" ,"2",
 "-frames:v", "1",
 "-f", "image2",
 "-c:v", "mjpeg",
 "pipe:1"
 ]);

 ffmpeg.stdout.pipe(tmpFile).on("error", err => {
 console.log("Error A: ",err);
 });

 ffmpeg.on('error', err => {
 console.log("Error B", err)
 reject()
 })

 ffmpeg.on('close', code => {
 tmpFile.end();
 console.log('Log A', ffmpeg);

 child_process.exec("echo `ls -l -R /tmp`",
 (error, stdout, stderr) => {
 console.log(stdout)
 });

 resolve()
 })
...




But the result is an empty JPG file in S3.



Logs shows no errors, my "target" is OK, stdout ls show me the empty JPG file.



I have try a lot of things, like use other version of ffmpeg but same.



There is the "console.log('Log A', ffmpeg)" :



ChildProcess {
 _events: [Object: null prototype] { error: [Function], close: [Function] },
 _eventsCount: 2,
 _maxListeners: undefined,
 _closesNeeded: 3,
 _closesGot: 3,
 connected: false,
 signalCode: 'SIGSEGV',
 exitCode: null,
 killed: false,
 spawnfile: '/opt/nodejs/ffmpeg',
 _handle: null,
 spawnargs: [
 '/opt/nodejs/ffmpeg',
 '-ss',
 '00:00:05',
 '-i',
 'https://xxxxxxxxx',
 '-vf',
 'thumbnail,scale=200:200',
 '-qscale:v',
 '2',
 '-frames:v',
 '1',
 '-f',
 'image2',
 '-v',
 '16',
 '-c:v',
 'mjpeg',
 'pipe:1'
 ],
 pid: 24,
 stdin: Socket {
 connecting: false,
 _hadError: false,
 _parent: null,
 _host: null,
 _readableState: ReadableState {
 objectMode: false,
 highWaterMark: 16384,
 buffer: BufferList { head: null, tail: null, length: 0 },
 length: 0,
 pipes: null,
 pipesCount: 0,
 flowing: null,
 ended: false,
 endEmitted: false,
 reading: false,
 sync: true,
 needReadable: false,
 emittedReadable: false,
 readableListening: false,
 resumeScheduled: false,
 paused: true,
 emitClose: false,
 autoDestroy: false,
 destroyed: true,
 defaultEncoding: 'utf8',
 awaitDrain: 0,
 readingMore: false,
 decoder: null,
 encoding: null
 },
 readable: false,
 _events: [Object: null prototype] { end: [Function: onReadableStreamEnd] },
 _eventsCount: 1,
 _maxListeners: undefined,
 _writableState: WritableState {
 objectMode: false,
 highWaterMark: 16384,
 finalCalled: false,
 needDrain: false,
 ending: false,
 ended: false,
 finished: false,
 destroyed: true,
 decodeStrings: false,
 defaultEncoding: 'utf8',
 length: 0,
 writing: false,
 corked: 0,
 sync: true,
 bufferProcessing: false,
 onwrite: [Function: bound onwrite],
 writecb: null,
 writelen: 0,
 bufferedRequest: null,
 lastBufferedRequest: null,
 pendingcb: 0,
 prefinished: false,
 errorEmitted: false,
 emitClose: false,
 autoDestroy: false,
 bufferedRequestCount: 0,
 corkedRequestsFree: [Object]
 },
 writable: false,
 allowHalfOpen: false,
 _sockname: null,
 _pendingData: null,
 _pendingEncoding: '',
 server: null,
 _server: null,
 [Symbol(asyncId)]: 5,
 [Symbol(kHandle)]: null,
 [Symbol(lastWriteQueueSize)]: 0,
 [Symbol(timeout)]: null,
 [Symbol(kBuffer)]: null,
 [Symbol(kBufferCb)]: null,
 [Symbol(kBufferGen)]: null,
 [Symbol(kBytesRead)]: 0,
 [Symbol(kBytesWritten)]: 0
 },
 stdout: Socket {
 connecting: false,
 _hadError: false,
 _parent: null,
 _host: null,
 _readableState: ReadableState {
 objectMode: false,
 highWaterMark: 16384,
 buffer: BufferList { head: null, tail: null, length: 0 },
 length: 0,
 pipes: null,
 pipesCount: 0,
 flowing: false,
 ended: true,
 endEmitted: true,
 reading: false,
 sync: false,
 needReadable: false,
 emittedReadable: false,
 readableListening: false,
 resumeScheduled: false,
 paused: false,
 emitClose: false,
 autoDestroy: false,
 destroyed: true,
 defaultEncoding: 'utf8',
 awaitDrain: 0,
 readingMore: false,
 decoder: null,
 encoding: null
 },
 readable: false,
 _events: [Object: null prototype] {
 end: [Function: onReadableStreamEnd],
 close: [Function]
 },
 _eventsCount: 2,
 _maxListeners: undefined,
 _writableState: WritableState {
 objectMode: false,
 highWaterMark: 16384,
 finalCalled: false,
 needDrain: false,
 ending: false,
 ended: false,
 finished: false,
 destroyed: true,
 decodeStrings: false,
 defaultEncoding: 'utf8',
 length: 0,
 writing: false,
 corked: 0,
 sync: true,
 bufferProcessing: false,
 onwrite: [Function: bound onwrite],
 writecb: null,
 writelen: 0,
 bufferedRequest: null,
 lastBufferedRequest: null,
 pendingcb: 0,
 prefinished: false,
 errorEmitted: false,
 emitClose: false,
 autoDestroy: false,
 bufferedRequestCount: 0,
 corkedRequestsFree: [Object]
 },
 writable: false,
 allowHalfOpen: false,
 _sockname: null,
 _pendingData: null,
 _pendingEncoding: '',
 server: null,
 _server: null,
 write: [Function: writeAfterFIN],
 [Symbol(asyncId)]: 6,
 [Symbol(kHandle)]: null,
 [Symbol(lastWriteQueueSize)]: 0,
 [Symbol(timeout)]: null,
 [Symbol(kBuffer)]: null,
 [Symbol(kBufferCb)]: null,
 [Symbol(kBufferGen)]: null,
 [Symbol(kBytesRead)]: 0,
 [Symbol(kBytesWritten)]: 0
 },
 stderr: Socket {
 connecting: false,
 _hadError: false,
 _parent: null,
 _host: null,
 _readableState: ReadableState {
 objectMode: false,
 highWaterMark: 16384,
 buffer: BufferList { head: null, tail: null, length: 0 },
 length: 0,
 pipes: null,
 pipesCount: 0,
 flowing: null,
 ended: true,
 endEmitted: true,
 reading: false,
 sync: false,
 needReadable: false,
 emittedReadable: false,
 readableListening: false,
 resumeScheduled: false,
 paused: true,
 emitClose: false,
 autoDestroy: false,
 destroyed: true,
 defaultEncoding: 'utf8',
 awaitDrain: 0,
 readingMore: false,
 decoder: null,
 encoding: null
 },
 readable: false,
 _events: [Object: null prototype] {
 end: [Function: onReadableStreamEnd],
 close: [Function]
 },
 _eventsCount: 2,
 _maxListeners: undefined,
 _writableState: WritableState {
 objectMode: false,
 highWaterMark: 16384,
 finalCalled: false,
 needDrain: false,
 ending: false,
 ended: false,
 finished: false,
 destroyed: true,
 decodeStrings: false,
 defaultEncoding: 'utf8',
 length: 0,
 writing: false,
 corked: 0,
 sync: true,
 bufferProcessing: false,
 onwrite: [Function: bound onwrite],
 writecb: null,
 writelen: 0,
 bufferedRequest: null,
 lastBufferedRequest: null,
 pendingcb: 0,
 prefinished: false,
 errorEmitted: false,
 emitClose: false,
 autoDestroy: false,
 bufferedRequestCount: 0,
 corkedRequestsFree: [Object]
 },
 writable: false,
 allowHalfOpen: false,
 _sockname: null,
 _pendingData: null,
 _pendingEncoding: '',
 server: null,
 _server: null,
 write: [Function: writeAfterFIN],
 [Symbol(asyncId)]: 7,
 [Symbol(kHandle)]: null,
 [Symbol(lastWriteQueueSize)]: 0,
 [Symbol(timeout)]: null,
 [Symbol(kBuffer)]: null,
 [Symbol(kBufferCb)]: null,
 [Symbol(kBufferGen)]: null,
 [Symbol(kBytesRead)]: 0,
 [Symbol(kBytesWritten)]: 0
 },
 stdio: [
 Socket {
 connecting: false,
 _hadError: false,
 _parent: null,
 _host: null,
 _readableState: [ReadableState],
 readable: false,
 _events: [Object: null prototype],
 _eventsCount: 1,
 _maxListeners: undefined,
 _writableState: [WritableState],
 writable: false,
 allowHalfOpen: false,
 _sockname: null,
 _pendingData: null,
 _pendingEncoding: '',
 server: null,
 _server: null,
 [Symbol(asyncId)]: 5,
 [Symbol(kHandle)]: null,
 [Symbol(lastWriteQueueSize)]: 0,
 [Symbol(timeout)]: null,
 [Symbol(kBuffer)]: null,
 [Symbol(kBufferCb)]: null,
 [Symbol(kBufferGen)]: null,
 [Symbol(kBytesRead)]: 0,
 [Symbol(kBytesWritten)]: 0
 },
 Socket {
 connecting: false,
 _hadError: false,
 _parent: null,
 _host: null,
 _readableState: [ReadableState],
 readable: false,
 _events: [Object: null prototype],
 _eventsCount: 2,
 _maxListeners: undefined,
 _writableState: [WritableState],
 writable: false,
 allowHalfOpen: false,
 _sockname: null,
 _pendingData: null,
 _pendingEncoding: '',
 server: null,
 _server: null,
 write: [Function: writeAfterFIN],
 [Symbol(asyncId)]: 6,
 [Symbol(kHandle)]: null,
 [Symbol(lastWriteQueueSize)]: 0,
 [Symbol(timeout)]: null,
 [Symbol(kBuffer)]: null,
 [Symbol(kBufferCb)]: null,
 [Symbol(kBufferGen)]: null,
 [Symbol(kBytesRead)]: 0,
 [Symbol(kBytesWritten)]: 0
 },
 Socket {
 connecting: false,
 _hadError: false,
 _parent: null,
 _host: null,
 _readableState: [ReadableState],
 readable: false,
 _events: [Object: null prototype],
 _eventsCount: 2,
 _maxListeners: undefined,
 _writableState: [WritableState],
 writable: false,
 allowHalfOpen: false,
 _sockname: null,
 _pendingData: null,
 _pendingEncoding: '',
 server: null,
 _server: null,
 write: [Function: writeAfterFIN],
 [Symbol(asyncId)]: 7,
 [Symbol(kHandle)]: null,
 [Symbol(lastWriteQueueSize)]: 0,
 [Symbol(timeout)]: null,
 [Symbol(kBuffer)]: null,
 [Symbol(kBufferCb)]: null,
 [Symbol(kBufferGen)]: null,
 [Symbol(kBytesRead)]: 0,
 [Symbol(kBytesWritten)]: 0
 }
 ]
} ```



-
how to scale server setup with ffmpeg for converting videos on website
26 mai 2020, par TomI have a website that will offer video conversion service with ffmpeg. Users will select some options and click a button to process and create a video. The site is currently using laravel/php. If there are many requests at the same time, how should I handle the scaling up ? How can it be done with traditional ISP ? How about cloud service, e.g. Amazon, Digital Ocean ?


-
"File doesn't exist" - streamio FFMPEG on screenshot after create method
3 mai 2013, par dodgerogers747I have videos being directly uploaded to S3 using Amazon's CORS configuration. Videos are uploaded via a dedicated S3 form, once they have been uploaded successfully the URL of the video is appended to the @video.file hidden_field via javascript and then the video saves.
I can't get this
after_save
method to work which takes a screenshot of the video and saves it to S3 via carrierwave after the video has been saved as a rails object. ( It was previously working using a carrierwave video upload instance )It errors out with
Errno::ENOENT - No such file or directory - the file 'http://bucket-name.s3.amazonaws.com/uploads/video/file/secure-random-hex/video_name.m4v' does not exist:
I have tried running this method as a class method to call it from the console but it always comes back with the same error, even though the video exists.My bucket is set to public, read and write. How come it doesn't think the file exists ?
If anyone needs more code just shout, thanks in advance.
application trace
Started POST "/videos" for 127.0.0.1 at 2013-05-03 10:48:07 -0700
Processing by VideosController#create as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"MAHxrVcmPDtVIMfDWZBwL0YnzaAaAe1PTGip5M4OVoY=", "video"=>{"user_id"=>"5", "file"=>"http://bucket-name.s3.amazonaws.com/uploads/video/file/secure-random-hex/video.m4v"}}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 5 LIMIT 1
(0.1ms) BEGIN
SQL (20.5ms) INSERT INTO `videos` (`created_at`, `file`, `question_id`, `screenshot`, `updated_at`, `user_id`) VALUES ('2013-05-03 17:48:07', 'http://teebox-network.s3.amazonaws.com/uploads/video/file/secure-random-hex/video.m4v', NULL, NULL, '2013-05-03 17:48:07', 5)
(44.0ms) ROLLBACK
Completed 500 Internal Server Error in 71ms
Errno::ENOENT - No such file or directory - the file 'http://teebox-network.s3.amazonaws.com/uploads/video/file/secure-random-hex/video.m4v' does not exist:
(gem) streamio-ffmpeg-0.9.0/lib/ffmpeg/movie.rb:10:in `initialize'
app/models/video.rb:25:in `new'
app/models/video.rb:25:in `take_screenshot'video.rb
attr_accessible :user_id, :question_id, :file, :screenshot
belongs_to :question
belongs_to :user
default_scope order('created_at DESC')
after_create :take_screenshot
mount_uploader :screenshot, ImageUploader
validates_presence_of :user_id, :file
def take_screenshot
FFMPEG.ffmpeg_binary = '/opt/local/bin/ffmpeg'
movie = FFMPEG::Movie.new("#{self.file}")
self.screenshot = movie.screenshot("#{Rails.root}/public/uploads/tmp/screenshots/#{File.basename(self.file)}.jpg", seek_time: 2 )
self.save!
endvideos/_form.html.erb
<form action="http://bucket-name.s3.amazonaws.com" data-remote="true" class="direct-upload" enctype="multipart/form-data" method="post">
<input type="hidden" />
<input type="hidden" value="ACCESS_KEY" />
<input type="hidden" value="public-read" />
<input type="hidden" />
<input type="hidden" />
<input type="hidden" value="201" />
<input type="file" />
</form>
<%= form_for @video, html: { multipart: true, id: "new_video" }, remote: true do |f| %>
<% if @video.errors.any? %>
<div>
<h2><%= pluralize(@video.errors.count, "error") %> prohibited this post from being saved:</h2>
<ul>
<% @video.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.hidden_field :user_id, value: current_user.id %>
<%= f.hidden_field :file %><br />
<% end %>ImageUploader
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
include Sprockets::Helpers::RailsHelper
include Sprockets::Helpers::IsolatedHelper
storage :fog
before :store, :remember_cache_id
after :store, :delete_tmp_dir
def cache_dir
Rails.root.join('public/uploads/tmp/')
end
def remember_cache_id(new_file)
@cache_id_was = cache_id
end
def delete_tmp_dir(new_file)
if @cache_id_was.present? && @cache_id_was =~ /\A[\d]{8}\-[\d]{4}\-[\d]+\-[\d]{4}\z/
FileUtils.rm_rf(File.join(root, cache_dir, @cache_id_was))
end
end
process resize_and_pad: [306, 150, '#000']
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def extension_white_list
%w(jpg)
# %w(ogg ogv 3gp mp4 m4v webm mov)
end