Recherche avancée

Médias (0)

Mot : - Tags -/interaction

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (82)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (8512)

  • Exit Status with ffmpeg Command in Rails

    25 novembre 2012, par DragonFire353

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

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

    I was using purely paperclip before and making the user wait and it worked great, now I am having problems with the return of the error status for the command, I have tried editing to possible fix the command wondering if it was failing in the first place but I keep getting :

    undefined method `exitstatus' for nil:NilClass

    no matter what. I've tried looking this up and it's supposedly valid syntax that should work... Also I've commented out the actual spawn do part because I get another error if I leave that in :

    wrong number of arguments

    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
     include AASM

     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"
     #, :styles => {
        # :video => { geometry: "800x480>", format: 'webm' },
        # :thumb => { geometry: "200x200>", format: 'png', time: 3 },
      # }, processors: [:ffmpeg], 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

     #acts as state machine plugin
     aasm state: :pending do
      state :pending, initial: true
      state :converting
      state :converted
      #, enter: :set_new_filename
      state :error

       event :convert do
        transitions from: :pending, to: :converting
      end

       event :converted do
        transitions from: :converting, to: :converted
      end

       event :failure do
         transitions from: :converting, to: :error
       end
     end

      # This method is called from the controller and takes care of the converting
     def convert
       self.convert!

       #spawn a new thread to handle conversion
       #spawn do
         success = delay.system(convert_command)
         logger.debug 'Converting File: ' + success.to_s
         if success && $?.exitstatus.to_i == 0
           self.converted!
         else
           self.failure!
         end
       #end
     end

     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
       def convert_command
         #construct new file extension
         webm =  "." + id.to_s + ".webm"

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

         end_command

         logger.debug "Converting video...command: " + command
         command
       end

       handle_asynchronously :convert_command

       # 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.convert
           flash[:success] = "Uploaded Succefully!"
           redirect_to @video.user
       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
  • Oddly-named file "not found" when trying to move/copy via MacOS Terminal [closed]

    15 juin 2024, par Ben C

    This is a head scratcher.

    


    I need to move these three oddly-named files from an external 2.5" SSD to my desktop. The file names were intended to have variables replaced by date info, however, clearly it didn't work. So I'm left with these filenames that MacOS seems to want to interpret rather than treat as a string. I wish it was as easy as tossing in single quotes or escaping chars, but so far, that hasn't worked.

    


    Files: Test01-$(internal:date_y)-$(internal:date_m)-$(internal:date_d)-.mp4 Test01-$(internal:date_y)-$(internal:date_m)-$(internal:date_d)-0001.mp4 Test01-$(internal:date_y)-$(internal:date_m)-$(internal:date_d)-0002.mp4

    


    I'm on MacOS. In the Finder, the files are not visible. But they are not hidden files.

    


    In Terminal, however, when I navigate to "/Volumes/TestDrive", then run a quick "ls", I can see all three files no problem. Including permissions, size, owners, full filename, etc.

    


    However, when I attempt to move the files to my desktop, and rename in the process (even if I don't rename), Terminal tells me that "No such file or folder can be found" or something very close to that.

    


    I've tried using mv and cp commands to put the filename in single quotes so the filename is read literally. Yet, I'm still given feedback that the file cannot be transferred because it cannot be found or doesn't exist.

    


    mv 'Test01-$(internal:date_y)-$(internal:date_m)-$(internal:date_d)-.mp4' ~/Desktop/Test01-01.mp4' 'cp 'Test01-$(internal:date_y)-$(internal:date_m)-$(internal:date_d)-.mp4' ~/Desktop/Test01-01.mp4

    


    When I try to escape special characters instead of quotes, I am also told the file doesn't exist. But clearly it does when I list out the contents of the drive. And there's only 3x .mp4 files, two hiddne files .fseventsd and some spotlight file.

    


    mv Test01-\$\(internal\:date_y\)-\$\(internal\:date_m\)-\$\(internal\:date_d\)-.mp4 ~/Desktop/Test01-01.mp4

    


    I've tried copying by inode. No luck. I've tried pulling the videos into ffmpeg (CLI based media mgmt tool) to see if I can get some info on the files, and same thing, ffmpeg (or ffprobe) both will tell me the file doesn't exist...even though I can list the files and see that it does.

    


    I hope I'm missing something obvious, but but it seems all the obvious approaches are not yet working for me.

    


    So my question is, what do I need to do to make these files "exist" so that I can rename them and back them up ? Happy to go down any rabbit hole.

    


    Thanks in advance !

    


  • FFMPEG Command working ok from terminal but not when launched as a process

    16 juin 2023, par Pit Digger

    I am launching an FFMPEG process from C++ , the command is workign fine from command line, but gives error when laucnhed from code. What could cause this ?

    


    [AVFilterGraph @ 0x3cfadc0] Error parsing filterchain '"[0:v]split=3[v1][v2][v3] ;[v1]copy[v1out] ;[v2]scale=w=1280:h=720[v2out] ;[v3]scale=w=640:h=360[v3out]"'

    


    AVFilterGraph @ 0x3cfadc0] Trailing garbage after a filter : split=3[v1][v2][v3] ;[v1]copy[v1out] ;[v2]scale=w=1280:h=720[v2out] ;[v3]scale=w=640:h=360[v3out]"

    


    Command :

    


    ffmpeg -re -i input.mp4 -c copy -filter_complex "[0:v]split=3[v1][v2][v3] ;[v1]copy[v1out] ;[v2]scale=w=1280:h=720[v2out] ;[v3]scale=w=640:h=360[v3out]" -map [v1out] -c:v:0 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:0 1M -maxrate:v:0 2M -minrate:v:0 2M -bufsize:v:0 2M -preset fast -g 48 -sc_threshold 0 -keyint_min 48 -map [v2out] -c:v:1 libx264 -x264-params 'nal-hrd=cbr:force-cfr=1' -b:v:1 1M -maxrate:v:1 1M -minrate:v:1 1M -bufsize:v:1 1M -preset fast -g 48 -sc_threshold 0 -keyint_min 48 -map [v3out] -c:v:2 libx264 -x264-params 'nal-hrd=cbr:force-cfr=1' -b:v:2 500K -maxrate:v:2 500K -minrate:v:2 500K -bufsize:v:2 500K -preset fast -g 48 -sc_threshold 0 -keyint_min 48 -map a:0 -c:a:0 aac -b:a:0 96k -ac 2 -map a:0 -c:a:1 aac -b:a:1 96k -ac 2 -map a:0 -c:a:2 aac -b:a:2 48k -ac 2 -avoid_negative_ts 1 -f hls -hls_time 6 -hls_list_size 15 -hls_flags independent_segments -hls_segment_type mpegts -hls_segment_filename /output/stream_%v_data%02d.ts -master_pl_name index.m3u8 -var_stream_map 'v:0,a:0 v:1,a:1 v:2,a:2' /output/stream_%v.m3u8