Recherche avancée

Médias (91)

Autres articles (104)

  • Soumettre améliorations et plugins supplémentaires

    10 avril 2011

    Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
    Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)

Sur d’autres sites (10455)

  • 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
  • FFmpeg - Extracting video and audio from transport stream file (.ts)

    25 juillet 2015, par Passepartout

    I wish to extract the audio and video of a certain program in a transport stream file (.ts) by specifying its PID without losing quality and using the same codec in the resulting file (the output file is a MPEG).

    Is that even possible with FFmpeg ? If so, how can I do it ?

    So far, I’ve come to this command :

    ffmpeg -i tsfile.ts -vcodec copy -acodec copy -q:v 1 output.mpg

    Edit : Note that the file output.mpg is created. The file contains the video but the audio isn’t attached (no sound). Also, I am unable to specify the program PID to extract.

    Edit 2 : Here’s the output of ffmpeg -i tsfile.ts

    ffmpeg version N-47062-g26c531c Copyright (c) 2000-2012 the FFmpeg developers
    built on Nov 25 2012 12:21:26 with gcc 4.7.2 (GCC)
       libavutil      52.  9.100 / 52.  9.100
       libavcodec     54. 77.100 / 54. 77.100
       libavformat    54. 37.100 / 54. 37.100
       libavdevice    54.  3.100 / 54.  3.100
       libavfilter     3. 23.102 /  3. 23.102
       libswscale      2.  1.102 /  2.  1.102
       libswresample   0. 17.101 /  0. 17.101
       libpostproc    52.  2.100 / 52.  2.100
    [mpeg2video @ 0201c7a0] mpeg_decode_postinit() failure
    Last message repeated 10 times
    [mpegts @ 0037b800] PES packet size mismatch
    Input #0, mpegts, from 'tsfile.ts':
    Duration: 00:01:30.58, start: 56297.848344, bitrate: 18045 kb/s
    Program 1
       Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 1920x1080  [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
       Stream #0:1[0x34]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), s16, 384      kb/s

    Here’s a tsinfo.exe on the .ts file :

    Reading from C:\tsfile.ts
    Scanning 10000 TS packets

    Packet 1 is PAT
    Program list:
       Program 1 -> PID 0020 (32)

    Packet 2 is PMT with PID 0020 (32)
     Program 1, version 1, PCR PID 0031 (49)
        Program info (38 bytes): 0e 03 c0 b9 16 10 06 c0 02 71 c0 04 00 0b 02 42 3f 05 04
                                 47 41 39 34 86 0d e2 65 6e 67 7e 3f ff 65 6e 67 c1 3f ff
    maximum bitrate (3 bytes): c0 b9 16
    smoothing buffer (6 bytes): c0 02 71 c0 04 00
    system clock (2 bytes): 42 3f
    Registration GA94
    Descriptor tag 86 (134) (13 bytes): e2 65 6e 67 7e 3f ff 65 6e 67 c1 3f ff
     Program streams:
    PID 0031 (  49) -> Stream type 02 (  2) H.262/13818-2 video (MPEG-2) or 11172-2 constrained video
    PID 0034 (  52) -> Stream type 81 (129) User private
       ES info (6 bytes): 6a 04 41 43 2d 33
       DVB AC-3 (4 bytes): 41 43 2d 33

    Found 14 PAT packets and 7 PMT packets in 10000 TS packets
  • ffmpeg transcode video with dts-ma to ac3

    12 juin 2015, par John Galt

    I’m trying to take a video that has an h264 video track and a dts-ma audio track and and get out an .m4v file with :

    h264 video track
    DTS-ma audio track
    AC-3 5.1 Audio track

    I’m attempting to just copy the video and the dts-ma audio track and then have it convert the AC-3 audio track

    I’m getting an error Unable to find a suitable output format for 'ac3' from this command :

    ffmpeg -i "input.mkv" -map 0:0 -map 0:1 -map 0:1 -map 0:1 -c:v copy -c:a:0 copy -c:a:1 -acodec ac3 -ac 6 -ab 448k -c:a:2 -acodec ac3 -ac 6 -ab 256 -ar 48000 "output.m4v"

    (this is generated by my C# app)

    this for a different file that has h264 and ac3 already in it works fine :

    ffmpeg -i "input.mkv" -map 0:0 -map 0:1 -c:v copy -c:a:0 copy "output.m4v"

    Obviously it’s not doing a conversion.

    Here’s the full results of the first command :

    ffmpeg version N-46936-g8b6aeb1 Copyright (c) 2000-2012 the FFmpeg developers
     built on Nov 20 2012 19:34:37 with gcc 4.7.2 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass -
    -enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-libo
    pus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
    bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
     libavutil      52.  8.100 / 52.  8.100
     libavcodec     54. 74.100 / 54. 74.100
     libavformat    54. 37.100 / 54. 37.100
     libavdevice    54.  3.100 / 54.  3.100
     libavfilter     3. 23.101 /  3. 23.101
     libswscale      2.  1.102 /  2.  1.102
     libswresample   0. 17.101 /  0. 17.101
     libpostproc    52.  2.100 / 52.  2.100
    Input #0, matroska,webm, from 'input.mkv':
     Metadata:
       creation_time   : 2012-12-07 22:11:56
     Duration: 01:41:23.38, start: 0.000000, bitrate: 33582 kb/s
       Chapter #0.0: start 0.000000, end 186.250000
       Metadata:
         title           : 00:00:00.000
       Chapter #0.1: start 186.250000, end 512.708000
       Metadata:
         title           : 00:03:06.250
       Chapter #0.2: start 512.708000, end 883.292000
       Metadata:
         title           : 00:08:32.708
       Chapter #0.3: start 883.292000, end 1354.000000
       Metadata:
         title           : 00:14:43.292
       Chapter #0.4: start 1354.000000, end 1865.458000
       Metadata:
         title           : 00:22:34.000
       Chapter #0.5: start 1865.458000, end 2122.500000
       Metadata:
         title           : 00:31:05.458
       Chapter #0.6: start 2122.500000, end 2386.125000
       Metadata:
         title           : 00:35:22.500
       Chapter #0.7: start 2386.125000, end 2801.167000
       Metadata:
         title           : 00:39:46.125
       Chapter #0.8: start 2801.167000, end 2923.000000
       Metadata:
         title           : 00:46:41.167
       Chapter #0.9: start 2923.000000, end 3388.500000
       Metadata:
         title           : 00:48:43.000
       Chapter #0.10: start 3388.500000, end 3808.167000
       Metadata:
         title           : 00:56:28.500
       Chapter #0.11: start 3808.167000, end 4071.375000
       Metadata:
         title           : 01:03:28.167
       Chapter #0.12: start 4071.375000, end 4378.750000
       Metadata:
         title           : 01:07:51.375
       Chapter #0.13: start 4378.750000, end 4681.583000
       Metadata:
         title           : 01:12:58.750
       Chapter #0.14: start 4681.583000, end 4989.792000
       Metadata:
         title           : 01:18:01.583
       Chapter #0.15: start 4989.792000, end 5311.667000
       Metadata:
         title           : 01:23:09.792
       Chapter #0.16: start 5311.667000, end 5629.083000
       Metadata:
         title           : 01:28:31.667
       Chapter #0.17: start 5629.083000, end 6083.382000
       Metadata:
         title           : 01:33:49.083
       Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 1k tbn, 48 tbc (default)
       Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
    [NULL @ 03f4b020] Unable to find a suitable output format for 'ac3'
    ac3: Invalid argument