Recherche avancée

Médias (0)

Mot : - Tags -/tags

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

Autres articles (76)

  • 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 (...)

  • Les notifications de la ferme

    1er décembre 2010, par

    Afin d’assurer une gestion correcte de la ferme, il est nécessaire de notifier plusieurs choses lors d’actions spécifiques à la fois à l’utilisateur mais également à l’ensemble des administrateurs de la ferme.
    Les notifications de changement de statut
    Lors d’un changement de statut d’une instance, l’ensemble des administrateurs de la ferme doivent être notifiés de cette modification ainsi que l’utilisateur administrateur de l’instance.
    À la demande d’un canal
    Passage au statut "publie"
    Passage au (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

Sur d’autres sites (7862)

  • On-the-fly transcoding using derolf/transcoder

    8 septembre 2015, par user1811678

    https://github.com/derolf/transcoder

    I need to transcode locally and playback locally in my project, no other external connection to the server.
    It is a good source of doing on the fly transcoding by ffmpeg.

    In my case i have to transcode it to mp4 as it could perform faster.
    However i run into following problem, and i need some help in here to fix it.

    ----------------------------------------
    Exception happened during processing of request from ('127.0.0.1', 34089)
    Traceback (most recent call last):
     File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread
       self.finish_request(request, client_address)
     File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
       self.RequestHandlerClass(request, client_address, self)
     File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
       self.finish()
     File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
       self.wfile.close()
     File "/usr/lib/python2.7/socket.py", line 279, in close
       self.flush()
     File "/usr/lib/python2.7/socket.py", line 303, in flush
       self._sock.sendall(view[write_offset:write_offset+buffer_size])
    error: [Errno 32] Broken pipe

    Here is my code :
    server.py

       from flask import Flask, request, Response, abort, send_file, jsonify
    import os, subprocess, re
    import config

    app = Flask(__name__)

    @app.route('/media/.js')
    def media_content_js(path):
       d= os.path.abspath( os.path.join( config.media_folder, path ) )
       print d
       if not os.path.isfile( d ): abort(404)
       cmdline= list()
       cmdline.append( config.ffmpeg )
       cmdline.append( "-i" )
       cmdline.append( d );
       print cmdline
       duration= -1
       FNULL = open(os.devnull, 'w')
       proc= subprocess.Popen( cmdline, stderr=subprocess.PIPE, stdout=FNULL )
       try:
           for line in iter(proc.stderr.readline,''):
               line= line.rstrip()
               #Duration: 00:00:45.13, start: 0.000000, bitrate: 302 kb/s
               m = re.search('Duration: (..):(..):(..)\...', line)
               if m is not None: duration= int(m.group(1)) * 3600 + int(m.group(2)) * 60 + int(m.group(3)) + 1
       finally:
           proc.kill()

       return jsonify(duration=duration)

    @app.route('/media/.mp4')
    def media_content_ogv(path):
       d= os.path.abspath( os.path.join( config.media_folder, path ) )
       print d
       if not os.path.isfile( d ): abort(404)
       start= request.args.get("start") or 0
       print start
       def generate():
           cmdline= list()
           cmdline.append( config.ffmpeg )
           cmdline.append( "-i" )
           cmdline.append( d );
           cmdline.append( "-ss" )
           cmdline.append( str(start) );
           cmdline.extend( config.ffmpeg_args )
           print cmdline
           FNULL = open(os.devnull, 'w')
           proc= subprocess.Popen( cmdline, stdout=subprocess.PIPE, stderr=FNULL )
           try:
               f= proc.stdout
               byte = f.read(512)
               while byte:
                   yield byte
                   byte = f.read(512)
           finally:
               proc.kill()

       return Response(response=generate(),status=200,mimetype='video/mp4',headers={'Access-Control-Allow-Origin': '*', "Content-Type":"video/mp4","Content-Disposition":"inline","Content-Transfer-Enconding":"binary"})

    @app.route('/', defaults={"path":"index.html"})
    @app.route('/')
    def static_content(path):
       d= os.path.abspath( os.path.join( config.static_folder, path ) )
       if not os.path.isfile( d ): abort(404)
       return send_file( d )

    app.run( host="0.0.0.0",port=config.port, threaded=True, debug=True )

    config.py

    media_folder=   "media"
    static_folder=  "static"
    port=       8123
    ffmpeg=     "/usr/bin/ffmpeg"

    ffmpeg_args=    [ "-f", "avi" ,"-acodec", "libfdk_aac", "-b:a", "128k", "-vcodec", "libx264", "-b:v", "1200k" , "-flags" , "+aic+mv4", "pipe:1"]

    index.html

       
       <code class="echappe-js">&lt;script src=&quot;http://vjs.zencdn.net/4.5/video.js&quot;&gt;&lt;/script&gt;

    &lt;script src=&quot;http://code.jquery.com/jquery-1.9.1.min.js&quot;&gt;&lt;/script&gt;

    &lt;script&gt;<br />
           var video= videojs('video');<br />
           video.src(&quot;media/testavi.avi.mp4&quot;);<br />
    <br />
           // hack duration<br />
           video.duration= function() { return video.theDuration; };<br />
           video.start= 0;<br />
           video.oldCurrentTime= video.currentTime;<br />
           video.currentTime= function(time) <br />
           { <br />
               if( time == undefined )<br />
               {<br />
                   return video.oldCurrentTime() + video.start;<br />
               }<br />
               console.log(time)<br />
               video.start= time;<br />
               video.oldCurrentTime(0);<br />
               video.src(&quot;media/testavi.avi.mp4?start=&quot; + time);<br />
               video.play();<br />
               return this;<br />
           };<br />
    <br />
           $.getJSON( &quot;media/testavi.avi.js&quot;, function( data ) <br />
           {<br />
               video.theDuration= data.duration;<br />
           });<br />
       &lt;/script&gt;
  • FFmpeg live streaming webm video to multiple http clients over Nodejs

    11 octobre 2017, par Léo Martin

    I am trying to share a live stream of my screen over an ExpressJS server.
    I cannot save ffmpeg output to a file or start more than one ffmpeg instance for performance reason.
    My current solution is to pipe ffmpeg’s stdout and stream it to each connected client.

    index.js

    const express = require('express');
    const app = express();
    const request = require('request');
    const FFmpeg = require('./FFmpeg');

    const APP_PORT = 3500;

    app.get('/stream', function (req, res) {
     const recorder = FFmpeg.getInstance();

     res.writeHead(200, {
       "content-type": "video/webm",
     });
     recorder.stdout.on('data', res.write);
     req.on('close', FFmpeg.killInstance);
    });

    app.listen(APP_PORT, function () {
     console.log(`App is listening on port ${APP_PORT}!`)
    });

    FFmpeg.js

    const spawn = require('child_process').spawn;
    const ffmpegPath = 'ffmpeg';
    const ffmpegOptions = [
     '-loglevel', 'panic',
     '-y',
     '-f',
     'alsa',
     '-ac',
     '2',
     '-i',
     'pulse',
     '-f',
     'x11grab',
     '-r',
     '25',
     '-i',
     ':0.0+0,0',
     '-acodec',
     'libvorbis',
     '-preset',
     'ultrafast',
     '-vf',
     'scale=320:-1',
     "-vcodec", "libvpx-vp9",
     '-f', 'webm',
     'pipe:1',
    ];

    module.exports = {
     start,
     getInstance,
     killInstance,
    };

    let instance = null;
    let connections = 0;

    function killInstance() {
     connections -= 1;
     if (connections &lt; 1) {
       instance.kill();
       instance = null;
     }
    };

    function getInstance() {
     connections += 1;
     if (!instance) instance = start();
     return instance;
    };

    function start() {
     return spawn(ffmpegPath, ffmpegOptions);
    };

    It is working well for one client, but I cannot manage to stream to several clients at the same time (might be related to missing keyframes).

  • How to use trap to terminate while loop containing ffmpeg fed by redirect from /dev/null ?

    15 février 2017, par Lorccan

    I discovered here Loop calls process that takes a long time to complete. How do I break out of it ? that piping from find to a while loop that calls an ffmpeg cli [HandBrakeCLI] will not process more than one input file because ffmpeg has a quirk that it ’eats’ all the input list in one go and ’starves’ the loop.

    The solution was to redirect from /dev/null per http://mywiki.wooledge.org/BashFAQ/089 and that works fine. However, it brings me back to the original problem and the question I set out to solve :

    Because /dev/null now has a complete list of all the files feeding HandBrakeCLI, ctrl-c on its own is not enough to quit the loop.

    I have tried various permutations of trap, but I can’t get it to do anything other than stop HandBrakeCLI processing the current input before it moves on to the next one. Instead of terminating the loop immediately, it also processes the mv right after the HandBrakeCLI line.

    So, there are two things I am not getting here : 1. How do I terminate everything with a ctrl-c or kill command ? 2. If not dealt with by (1.), how do I prevent the mv inside the loop from being executed ?

    For the sake of addressing the question, this is the simplified version of the code :

    #!/bin/bash

    source_dir="/Volumes/Volumename"
    dest_dir="/Volumes/Volumename/Converted/"
    finished_dir="Volumes/Volumename/Processed/"


    find "$source_dir" -type d -name "VIDEO_TS" | while read -r dir; do
     name=${dir%/VIDEO_TS}
     mov_dir=${dir%/*}
     name=${name##*/}
     ./HandBrakeCLI -i "$dir" -o "$dest_dir/$name.m4v" null
     mv "$mov_dir" "finished_dir"
    done