Recherche avancée

Médias (91)

Autres articles (102)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (9239)

  • 400 Bad Request Error uploading paperclip videos

    5 mars 2017, par jalen201

    Im trying to upload videos with paperclip. When i hit the submit button i receive.

    RSolr::Error::Http - 400 Bad Request Error:

    this is the migration

    class AddAttachmentVideoToPins < ActiveRecord::Migration
     def self.up
       change_table :pins do |t|
         t.attachment :video
       end
     end

     def self.down
       remove_attachment :pins, :video
     end
    end

    Heres the model

    class Pin < ApplicationRecord
     acts_as_votable
     belongs_to :user
     has_many :comments

     searchable do
       text :title, :boost => 5
       text :description
     end

     has_attached_file :image, styles: {medium: "300x300>" }
     validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/

     has_attached_file :video, styles: {
       :medium => {
         :geometry => "640x480",
         :format => 'mp4'
       },
       :thumb => {
         :geometry => "160x120", :format => 'jpeg', :time => 10
       }
     },
     :processors => [:transcoder]

     validates_attachment_content_type :video, content_type:  /\Avideo\/.*\Z/

    also i added these 4 gems, and installed ffmpeg with homebrew

       gem 'paperclip', '~> 5.1'

       gem 'aws-sdk', '~> 2.8'

       gem 'paperclip-av-transcoder', '~> 0.6.4'

       gem 'paperclip-ffmpeg', '~> 1.2'

    lastly this is my controller, i added :video as a strong parameter.

    class PinsController < ApplicationController

     before_action :find_pin, only: [:show,:edit,:update,:destroy, :upvote]
     before_action :authenticate_user!, except: [:index,:show]

     def index
       @search = Pin.search do
         fulltext params[:search]
       end
       @pins = @search.results
     end

     def new
       @pin = current_user.pins.build
     end

     def show
       @comments = Comment.where(pin_id: @pin).order('created_at DESC')
     end

     def edit
       @lookup = User.all
     end

     def profile
       @users = User.all
       if User.find_by_username(params[:id])
         @username = params[:id]
         @user = User.find_by_username(params[:id])
       else
         redirect_to root_path
       end
       @user_pin = Pin.all.where('user_id = ?',       User.find_by_username(params[:id]).id)
     end

     def update
       if @pin.update(pin_params)
         redirect_to @pin, notice: "Pin was succesfully updated"
       else
         render 'edit'
       end
     end

     def destroy
       @pin.destroy
       redirect_to root_path      
     end

     def upvote
       @pin.upvote_by current_user
       redirect_to :back
     end

     def create
       @pin = current_user.pins.build (pin_params)

       if @pin.save
         redirect_to @pin , notice: "Succesfully created new pin"
       else
         render 'new'
       end
     end

     private

     def pin_params
       params.require(:pin).permit(:title, :description, :image, :video)
     end

     def find_pin
       @pin = Pin.find(params[:id])
     end
    end

    i added this in the view

    <%= video_tag @pin.video.url(:medium), controls: true, style: "max-width: 100%;" %>

    If anyone could help that would be greatly appreciated

  • saving ffmpeg output in a file field in django using tempfiles

    27 janvier 2017, par StarLord

    I am trying to extract audio from video when uploaded, and store it in a different model.

    this is the task code :

    def set_metadata(input_file, video_id):
       """
       Takes the file path and video id, sets the metadata and audio
       :param input_file: file url or file path
       :param video_id: video id of the file
       :return: True
       """
       # extract metadata
       command = [FFPROBE_BIN,
                  '-v', 'quiet',
                  '-print_format', 'json',
                  '-show_format',
                  '-show_streams',
                  '-select_streams', 'v:0',
                  input_file]
       output = sp.check_output(command)
       output = output.decode('utf-8')
       metadata_output = json.loads(output)
       video_instance = Video.objects.get(pk=video_id)
       stream = metadata_output['streams'][0]
       tot_frames_junk = int(stream['avg_frame_rate'].split("/")[0])
       tot_time_junk = int(stream['avg_frame_rate'].split("/")[1])
       # update the video model with newly acquired metadata
       video_instance.width = stream['width']
       video_instance.height = stream['height']
       video_instance.frame_rate = tot_frames_junk/tot_time_junk
       video_instance.duration = stream['duration']
       video_instance.total_frames = stream['nb_frames']
       video_instance.video_codec = stream['codec_name']
       video_instance.save()

       # extract audio
       tmpfile = temp.NamedTemporaryFile(suffix='.mp2')
       command = ['ffmpeg',
                  '-y',
                  '-i', input_file,
                  '-loglevel', 'quiet',
                  '-acodec', 'copy',
                  tmpfile.name]
       sp.check_output(command)
       audio_obj = Audio.objects.create(title='awesome', audio=tmpfile)
       audio_obj.save()

    I am passing video object id and the file path to the method. The file path is a url from azure storage.

    The part where I am processing for metadata, it works and the video object gets updated. But the audio model is not created.

    It throws this error :

    AttributeError("'_io.BufferedRandom' object has no attribute '_committed'",)

    at command :

    audio_obj = Audio.objects.create(title='awesome', audio=tmpfile)

    What am I doing wrong with the temp file.

  • FPS drop in FFMPEG streaming processes to FB from production server

    30 janvier 2017, par Aakash Gupta

    I have made a rails app that can stream live videos to facebook rtmp server and deployed it on AWS. I have used nginx as web server. The major problem that I am encountering after viewing log files of FFMpeg processes is that sometimes the FPS of FFmpeg process starts to drop. In some cases, it remains stable at 25 FPS but in some cases, it remains at 25 only for sometime, and after that it starts to drop and sometimes it falls to even 3-4 FPS which is unacceptable during live streaming. As FFMpeg process is quite heavy, I would also like to share my CPU info as well.

    CPU information is :

    cat /proc/cpuinfo
    processor   : 0
    vendor_id   : GenuineIntel
    cpu family  : 6
    model       : 63
    model name  : Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
    stepping    : 2
    microcode   : 0x25
    cpu MHz     : 2400.070
    cache size  : 30720 KB
    physical id : 0
    siblings    : 1
    core id     : 0
    cpu cores   : 1
    apicid      : 0
    initial apicid  : 0
    fpu     : yes
    fpu_exception   : yes
    cpuid level : 13
    wp      : yes
    flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips    : 4800.14
    clflush size    : 64
    cache_alignment : 64
    address sizes   : 46 bits physical, 48 bits virtual
    power management:

    FFMPEG log file with unstable fps : https://drive.google.com/open?id=0B1gtp1iXJppkUndFamk4M0lRYzA

    FFMPEG log file with stable fps : https://drive.google.com/open?id=0B1gtp1iXJppkMkVCZEJjYWJrVTA

    When FPS was stable, I also tried to run another parallel FFMpeg process from the same server which resulted in FPS dropping of both the processes to 13-14 FPS.

    I am currently using this FFMPEG command :

    ffmpeg -loop 1 -re -y -f image2 -i "image_path" -i "audio_path.aac" -acodec copy -bsf:a aac_adtstoasc -pix_fmt yuv420p -profile:v high -s 1280x720 -vb 400k -maxrate 400k -minrate 400k -bufsize 600k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -t 14400 -strict -2 -f flv "rtmp_server_link"

    I never face this problem when I try to stream to FB using app on my localhost.

    So, my questions are :

    1. What can be the reason for this FPS drop ?
    2. Can upscaling production server help me fix this issue ?
    3. Can I run multiple FFMpeg processes for streaming from same server without performance drop ?

    Thanks in advance :)