Recherche avancée

Médias (2)

Mot : - Tags -/rotation

Autres articles (65)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (11877)

  • Download a stream via ffmpeg in Node.js

    16 juillet 2018, par loretoparisi

    I’m using ffmpeg to download an audio stream in Node.js. I use child_process for that :

    var downloadStream = function(uri,opath) {
       var self=this;

       // defaults
       var loglevel= self.logger.isDebug() ? 'debug' : 'warning';
       return new Promise((resolve, reject) => {
         const args = [
           '-y',
           '-loglevel', loglevel,
           '-v', 'quiet',
           '-i', uri,
           opath
         ];
         const opts = {
           cwd: self._options.tempDir
         };
         cp.spawn('ffmpeg', args, opts)
           .on('message', msg => self.logger.info(msg))
           .on('error', reject)
           .on('close', resolve)
           .on('exit', function (code, signal) {
             console.log('child process exited with ' +
                         `code ${code} and signal ${signal}`);
                         resolve(code);
           });
       });
     }//downloadStream

    What happens is that the close event is called before the file has been written to the disk. I have also registered the exit that is called with the close. While executing the command in bash I get the stream saved in the opath as expected. Which event listener shall I register for that ?

  • Return of FFMPEG in Background

    7 septembre 2018, par Bruno Andrade

    I am making a code that downloads a list of m3u8 links by FFMPEG

    I had this code :

    function FFMPEG($videocode, $dirvideo) {

       $ffmpeg = '"D:\FFMPEG\bin\ffmpeg.exe"' . " -hide_banner -loglevel verbose -n -i https://linkplaylist/{$videocode}.m3u8 -map 0:1 -map 0:2 -acodec copy -bsf:a aac_adtstoasc -vcodec copy {$dirvideo} 1> log.txt  2>&1";

       exec($ffmpeg, $output, $var);

       return $var;
    }

    $code = FFMPEG('football', 'football.mp4');

    if($code){
       {ERROR CODE};
       }else{

       {SUCCESS CODE}
    }  

    Initial problem

    And that worked well. I could download the video and know if it was downloaded completely or had some error.

    The problem is that this code "hangs" the script in exec () the page is loading until finalize exec () and that of timeout error (shared server) besides being visually strange to the visitor the page loading.

    Resolution of the initial problem

    After research I think the solution is to put the code execution in the background so I found this code :

    $descriptorspec = array(
      0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
      1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
      2 => array("file", "error-output.txt", "a") // stderr is a file to write to
    );

    function FFMPEG($videocode, $dirvideo) {
    $cmd = 'start /B D:\FFMPEG\bin\ffmpeg.exe  -y -i "https://linkplaylist/{$videocode}.m3u8" -map p:0 -acodec copy -bsf:a aac_adtstoasc -vcodec copy {$dirvideo}';
    proc_close(proc_open ($cmd
    ,$descriptorspec, $foo));
    }

    And finally my current problem

    And this works fine for the loading and timeout issue, but I can not get a return from when the download was successfully completed.

    1 ° proc_open Is this the best solution for my initial problem ?

    2 ° How can I get a return from when ffmpeg finishes running successfully and the script continues to flow.

    Extra Info

    I’m trying to build a solution that works on windows (xampp) but my final server is linux.

  • FFMPEG with node , using child_process , suppressing un-necessary stderr

    16 mai 2018, par drexdelta

    I am trying to resize the video using (FFMPEG + node + child_process). and my code looks something like this , You can read comments and understand it. it’s self-explanatory for people who are familiar with node and ffmpeg. when I run this code, I keep getting error in
    newThread.stderr.on() function
    . which is not expected behaviour. After running this process I am getting expected video translation, which is expected behaviour.

    const spawn = require('child_process').spawn;

    // resize and compress video promise  = prom2
    const resizeVideoWith_FFMPEG_Promise = (sourceFile , sinkFile)=>{
       return new Promise ( (resolve , reject)=>{

           // actual command for ffmpeg is something like this , "ffmpeg -i oldVideo -vf scale=-2:480 newVideo"
           // New thread
           const newThread = spawn('ffmpeg' , ['-i','vid1.mp4','-vf','scale=-2:480','vid2.mp4']);

           // on close signal
           newThread.on('close',(data)=>{
               console.log(' thread closed for video ' , sourceFile);
               return resolve();
           });
           // on stderr signals
           newThread.stderr.on('data',(data)=>{
               console.log(' got error in the thread of video ' , sourceFile);
               fullError = data.toString();
               console.log(fullError);
               // return resolve();
               // return reject();
           });
           newThread.stdout.on('data',(data)=>{
               // just ignore all stadanrd outputs
           });
       });
    }

    resizeVideoWith_FFMPEG_Promise('vid1.mp4' , 'vid2.mp4' ).then((res)=>{
       console.log(res);
    });

    For the sake of simplicity I am resolving the promise everytime, even if I get stderr. And at end of running this code I get output something like this ,

    got error in the thread of video  vid1.mp4
    frame= 3277 fps=116 q=28.0 size=   12288kB time=00:02:16.64 bitrate= 736.7kbits/s speed=4.82x    
    got error in the thread of video  vid1.mp4
    frame= 3313 fps=115 q=28.0 size=   12544kB time=00:02:18.15 bitrate= 743.8kbits/s speed=4.79x    
    got error in the thread of video  vid1.mp4
    frame= 3362 fps=115 q=28.0 size=   12800kB time=00:02:20.17 bitrate= 748.0kbits/s speed=4.78x    
    got error in the thread of video  vid1.mp4
    frame= 3408 fps=114 q=28.0 size=   12800kB time=00:02:22.12 bitrate= 737.8kbits/s speed=4.77x    
    got error in the thread of video  vid1.mp4
    frame= 3465 fps=114 q=28.0 size=   13056kB time=00:02:24.49 bitrate= 740.2kbits/s speed=4.76x    
    got error in the thread of video  vid1.mp4
    frame= 3522 fps=114 q=28.0 size=   13312kB time=00:02:26.86 bitrate= 742.5kbits/s speed=4.76x    
    got error in the thread of video  vid1.mp4
    frame= 3580 fps=114 q=28.0 size=   13568kB time=00:02:29.28 bitrate= 744.6kbits/s speed=4.76x

    Now, my problem is if I always keep resolving errors, then I will never be able to catch when the video ACTUALLY FAILED TO RESCALE. so, how can I ignore these type of un-necessary stderr and catch only useful errors ?

    Pls someone help.

    I have been through lot of related links like this, but none of these actually solve my problem(even if they did, I couldn’t figure out)

    Error while using h264_cuvid decoder with ffmpeg

    Using module "child_process" without Webpack

    Suppressing STDOUT with node child_process

    Small hint will be very helpful. Thank you .

    BTW , SO moderators , My actual title was like

    stderr problem while using FFMPEG with node via child_process module

    But it didn’t allow me to use such title. so, I am using some dummy title.