Recherche avancée

Médias (91)

Autres articles (98)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

Sur d’autres sites (12472)

  • Rails ActionController::Live - Sends everything at once instead of async

    28 janvier 2016, par Michael B

    I have an issue with rails ActionController::Live

    In the end I want to show the progress of FFMPEG to the user, but for now I want to get this minimal example running :

    Rails media_controller.rb :

    class MediaController < ApplicationController
     include ActionController::Live

     def stream
       puts "stream function loaded"

         response.headers['Content-Type'] = 'text/event-stream'
         i = 0
         begin
           response.stream.write "data: 1\n\n"
           sleep 0.5
           i += 1
           puts "response... data: " + i.to_s
         end while i < 10
       response.stream.close
     end
    end

    Javascript :

    source = new EventSource("/test/0");
    source.addEventListener("message", function(response) {
     // Do something with response.data
     console.log('I have received a response from the server: ' + response);
    }, false);

    When I navigate to the site, there are no JavaScript Errors showing. As soon as I navigate to the site, the "stream"-Action of the MediaController gets successfully called. I can verify this, by looking at the Server-Console. It gives me the following output. After every response line, there is a 500ms delay, like expected :

    stream function loaded
    response... data: 1
    response... data: 2
    response... data: 3
    response... data: 4
    response... data: 5
    response... data: 6
    response... data: 7
    response... data: 8
    response... data: 9
    response... data: 10
    Completed 200 OK in 5005ms (ActiveRecord: 0.8ms)

    On the JavaScript Side, it gives me the following Output :

    (10x) I have received a response from the server: [object MessageEvent]

    But the problem is here, that it sends all these 10 Messages from the server after 5 seconds at the same time ! The expected behavior however is, that it should send me 1 message every 0.5 seconds !

    So what am I doing wrong here ? Where is the error ?

    Screenshot Rails Console / JavaScript Console

  • How to know if ffmpeg conversion succeeded in Ruby ?

    11 septembre 2015, par 1.44mb

    I run the ffmpeg command to convert audio files to mp3 in my rails application :

    # Convert to MP3
    conversion_result = `ffmpeg -i "#{Refile::cache.directory}/#{self.file.id}" -f mp3 "#{_path_to_mp3}" 2>&1`

    After the conversion, an example of conversion_result is as follows :

    "ffmpeg version N-74748-gbaeb8f5 Copyright (c) 2000-2015 the FFmpeg
    developers\n built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1 14.04)\n
    configuration : —extra-libs=-ldl —prefix=/opt/ffmpeg
    —enable-avresample —disable-debug —enable-nonfree —enable-gpl —enable-version3 —enable-libopencore-amrnb —enable-libopencore-amrwb —disable-decoder=amrnb —disable-decoder=amrwb —enable-libpulse —enable-libdcadec —enable-libfreetype —enable-libx264 —enable-libx265 —enable-libfdk-aac —enable-libvorbis —enable-libmp3lame —enable-libopus —enable-libvpx —enable-libspeex —enable-libass —enable-avisynth —enable-libsoxr —enable-libxvid —enable-libvo-aacenc —enable-libvidstab\n libavutil 54. 31.100 / 54. 31.100\n libavcodec 56. 59.100 / 56. 59.100\n libavformat 56. 40.101 / 56. 40.101\n libavdevice 56. 4.100 / 56. 4.100\n libavfilter 5. 40.100 / 5. 40.100\n libavresample 2. 1. 0 / 2. 1. 0\n libswscale 3. 1.101 /
    3. 1.101\n libswresample 1. 2.101 / 1. 2.101\n libpostproc 53. 3.100 / 53. 3.100\nInput #0, mov,mp4,m4a,3gp,3g2,mj2, from ’../mey_attachments/cache/25888dc028deaabaee4d4de19d4726573860dbce0b907131e9919d294113’ :\n
    Metadata :\n major_brand : 3gp4\n minor_version : 0\n
    compatible_brands : isom3gp4\n creation_time : 2015-09-01 16:34:01\n
    Duration : 00:00:08.57, start : 0.000000, bitrate : 426 kb/s\n Stream

    0:0(eng) : Audio : aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 48 kb/s (default)\n Metadata :\n creation_time : 2015-09-01 16:34:01\n

    handler_name : SoundHandle\nOutput #0, mp3, to
    ’/tmp/Voice00045.mp3’ :\n Metadata :\n major_brand : 3gp4\n
    minor_version : 0\n compatible_brands : isom3gp4\n TSSE :
    Lavf56.40.101\n Stream #0:0(eng) : Audio : mp3 (libmp3lame), 44100 Hz,
    mono, fltp (default)\n Metadata :\n creation_time : 2015-09-01
    16:34:01\n handler_name : SoundHandle\n encoder : Lavc56.59.100
    libmp3lame\nStream mapping :\n Stream #0:0 -> #0:0 (aac (native) -> mp3
    (libmp3lame))\nPress [q] to stop, [?] for help\nsize= 67kB
    time=00:00:08.56 bitrate= 64.5kbits/s \nvideo:0kB audio:67kB
    subtitle:0kB other streams:0kB global headers:0kB muxing overhead :
    0.465427%\n"

    How can i make sure the conversion succeeded after the command executes ?

  • Background Video Processing with Rails

    23 octobre 2013, par Matthew Snyder

    I am trying to get uploaded videos to be converted in the background, running windows. Some of what I am using :

    gem 'paperclip'
    gem 'delayed_job_active_record'
    gem 'ffmpeg'

    I have edited the registry to allow the ffmpeg command to be ran from anywhere, I get a popup that I assume is ffmpeg because it goes away too quickly, guess the command is wrong so if anyone knows what's wrong with it please let me know. But the real problem is that it just hangs there, it says :

    [2012-12-09 22:47:03] ERROR invalid body size.
    [2012-12-09 22:47:03] ERROR Errno::ECONNABORTED: An established connection was a
    borted by the software in your host machine.
           C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpresponse.rb:396:i
    n `write'
           C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpresponse.rb:396:i
    n `<<'
           C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpresponse.rb:396:i
    n `_write_data'
           C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpresponse.rb:368:i
    n `send_body_string'
           C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpresponse.rb:249:i
    n `send_body'
           C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpresponse.rb:152:i
    n `send_response'
           C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:110:in
    `run'
           C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `blo
    ck in start_thread'

    Does anyone know how to properly get this working ? I've went through a few tutorials that have bits and pieces of what I need but I can't get them working together. Here's what I have so far, lemme know if you need more :

    Model :

    class Video < ActiveRecord::Base

     belongs_to :user
     has_many :comments, dependent: :destroy
     attr_accessible :video, :user_id, :video_file_name, :title, :public, :description, :views

     has_attached_file :video, url: "/users/:user_id/videos/:id/:basename_:style.:extension"

     #process_in_background :video #causes death

     validates :video, presence: true
     validates :description, presence: true, length: { minimum: 5, maximum: 100}
     validates :title, presence: true, length: { minimum: 1, maximum: 15 }

     validates_attachment_size :video, less_than: 1.gigabytes
     validates_attachment :video, presence: true

     default_scope order: 'created_at DESC'

     Paperclip.interpolates :user_id do |attachment, style|attachment.instance.user_id
     end

     #before_post_process do |video|
      # false if video.status == "converting"
     #end

     def perform
       command = <<-end_command
         start ffmpeg -i #{ '/public/users/:user_id/videos/:id/:basename_:style.:extension' }  -ar 22050 -ab 32 -s 1280x720 -vcodec webm -r 25 -qscale 8 -f webm -y #{ '/public/users/:user_id/videos/:id/:basename_.webm' }

       end_command
       success = system(command)
       logger.debug 'Converting File: ' + success.to_s
       if success && $?.exitstatus.to_i == 0
         #self.converted!
         self.status = "converted"
       else
         #self.failure!
         self.status = "failed"
       end
     end

     handle_asynchronously :perform

     def self.search(search)
       if search
         find(:all, conditions: ["public = 't' AND title LIKE ?", "%#{search}%"], order: "created_at DESC")
       else
         find(:all, conditions: ["public = 't'"], order: "created_at DESC")
       end
     end

     def self.admin_search(search)
       if search
         find(:all, conditions: ['title LIKE ?', "%#{search}%"], order: "created_at DESC")
       else
         find(:all, order: "created_at DESC")
       end
     end

     private

       # This updates the stored filename with the new flash video file
       def set_new_filename
         #update_attribute(:filename, "#{filename}.#{id}.webm")
         update_attribute(:content_type, "video/x-webm")
       end

    end

    Controller :

    class VideosController < ApplicationController
       before_filter :signed_in_user, only: [:upload, :update, :destroy]
       before_filter :admin_user, only: :admin_index

       def upload
           @video = Video.new
           # generate a unique id for the upload
           @uuid = (0..29).to_a.map {|x| rand(10)}
       end

       def create
           @video = Video.new(params[:video])
           @video.user_id = current_user.id

           if @video.save
               @video.delay.perform
               flash[:success] = "Uploaded Succefully!"
               redirect_to @video.user
               Delayed::Worker.new.start
           else
               render 'upload'
           end
       end

       def show
           @video = Video.find(params[:id])
           @comments = @video.comments.paginate(page: params[:page], per_page: 6)
           if !@video.public
               if !signed_in? || current_user.id != @video.user_id  && !current_user.admin && !current_user.approved?(@video.user)
               flash[:notice] = "Video is private"
               redirect_to root_path
           end
       end
       end

       def update
           @video = Video.find(params[:id])
           if @video.update_attributes(params[:video])
         flash[:success] = "Video preferences saved"
       else
           flash[:fail] = "Failed to update video preferences"
       end
       redirect_to :back
     end

       def destroy
           @video = Video.find(params[:id])
           @video.destroy
           flash[:deleted] = "Deleted Succefully!"
           redirect_to :back
       end

       def index
           @videos = Video.paginate(page: params[:page], per_page: 6).search(params[:search])
       end

       def admin_index
           @videos = Video.paginate(page: params[:page], per_page: 6).admin_search(params[:search])
       end

       def ajax_video_comments
           @video = Video.find(params[:id])
           @comments = @video.comments.paginate(page: params[:page], per_page: 6)

           respond_to do |format|
           format.js   { render partial: 'shared/comments', content_type: 'text/html' }
       end
       end

       def ajax_video_watched
           @video = Video.find(params[:id])
           @video.views += 1
           @video.save
       end

       private

       def signed_in_user
           redirect_to root_path, notice: "Please Login." unless signed_in?
       end

       def admin_user
           redirect_to(root_path) unless current_user.admin?
       end

    end