Recherche avancée

Médias (91)

Autres articles (111)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

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

Sur d’autres sites (8722)

  • How to set the destination folder of a Node.js fluent-ffmpeg screenshot to your AWS S3 bucket using getSignedUrl() ?

    10 juillet 2017, par Madhavi Mohoni

    I’m writing a program to generate .png thumbnails (with the same name, in the same folder) for a set of .mp4 videos in my Amazon S3 bucket. For this example, I’m going to create a /folder/file.png for a /folder/file.mp4 in the bucket. I’ve managed to set the source URL using the s3 object and getSignedUrl as follows :

    var srcurl = s3.getSignedUrl('getObject', {
           Bucket: 'bucket-name',
           Key: '/folder/file.mp4'
         });

    and

    new ffmpeg({ source: srcurl })
        .screenshots({
           count: 1,
           filename: '%f'.substr(0, '%f'.indexOf('.')) + '.png',
           /* To shorten the long string that's returned */
           folder: desturl,
           size: MAX_WIDTH + 'x' + MAX_HEIGHT
         });

    The destination URL has to be the same folder as the source. So I set it as follows :

    var desturl = s3.getSignedUrl('putObject', {
           Bucket: 'bucket-name',
           Key: '/folder/file' + '.png'
         });

    This combination doesn’t work - is there a way to do this correctly ?

  • Slicing an AVI file

    7 novembre 2014, par Peter Lur

    I am trying to upload only a certain part of an AVI file on the server without having to upload the whole file first.

    If I set the slice to the beginning (byte : 0), I can read the resulting file no problem even if I slice it in any size. However if the slice start anywhere but not at byte 0, the file become unreadable. I guess this has something to do with the avi header/index being messed up. I was wondering maybe I could use ffmpeg to move the header or something ?

    HTML Source

       
           
           <code class="echappe-js">&lt;script type=&quot;text/javascript&quot;&gt;<br />
    <br />
               window.BlobBuilder = window.MozBlobBuilder || window.WebKitBlobBuilder || window.BlobBuilder;<br />
    <br />
               function sendRequest() {<br />
                   var blob = document.getElementById('fileToUpload').files[0];<br />
    <br />
    <br />
                   //Slicing parameters<br />
    <br />
    <br />
                   //#1: Starting at byte:0 = WORKING WELL<br />
                   var start = 0;<br />
                   var end = 1048576;  // 1MB chunk sizes.<br />
    <br />
    <br />
                   //#2: Slicing the video file somewhere else (FAIL)<br />
    <br />
                   /*<br />
                   var start = 1048576*3;<br />
                   var end = 1048576*4;<br />
                   */<br />
    <br />
    <br />
                   var chunk = blob.slice(start, end, 'video/avi');<br />
                   uploadFile(chunk);<br />
    <br />
               }<br />
    <br />
               function fileSelected() {<br />
                   var file = document.getElementById('fileToUpload').files[0];<br />
                   if (file) {<br />
                       var fileSize = 0;<br />
                       if (file.size &gt; 1024 * 1024)<br />
                           fileSize = (Math.round(file.size * 100 / (1024 * 1024)) / 100).toString() + 'MB';<br />
                       else<br />
                           fileSize = (Math.round(file.size * 100 / 1024) / 100).toString() + 'KB';<br />
    <br />
                       document.getElementById('fileName').innerHTML = 'Name: ' + file.name;<br />
                       document.getElementById('fileSize').innerHTML = 'Size: ' + fileSize;<br />
                       document.getElementById('fileType').innerHTML = 'Type: ' + file.type;<br />
                   }<br />
               }<br />
    <br />
               function uploadFile(blobFile) {<br />
                   //var file = document.getElementById('fileToUpload').files[0];  <br />
                   var fd = new FormData();<br />
                   fd.append(&quot;fileToUpload&quot;, blobFile);<br />
    <br />
                   var xhr = new XMLHttpRequest();<br />
                   xhr.upload.addEventListener(&quot;progress&quot;, uploadProgress, false);<br />
                   xhr.addEventListener(&quot;load&quot;, uploadComplete, false);<br />
                   xhr.addEventListener(&quot;error&quot;, uploadFailed, false);<br />
                   xhr.addEventListener(&quot;abort&quot;, uploadCanceled, false);<br />
                   xhr.open(&quot;POST&quot;, &quot;upload.php&quot;);<br />
                   xhr.onload = function(e) {<br />
                     //alert(&quot;loaded!&quot;);<br />
                     };<br />
    <br />
                   xhr.send(fd);<br />
                   //alert(&quot;oen over&quot;);<br />
               }<br />
    <br />
               function uploadProgress(evt) {<br />
                   if (evt.lengthComputable) {<br />
                       var percentComplete = Math.round(evt.loaded * 100 / evt.total);<br />
                       document.getElementById('progressNumber').innerHTML = percentComplete.toString() + '%';<br />
                   }<br />
                   else {<br />
                       document.getElementById('progressNumber').innerHTML = 'unable to compute';<br />
                   }<br />
               }<br />
    <br />
               function uploadComplete(evt) {<br />
                   /* This event is raised when the server send back a response */<br />
                   //alert(evt.target.responseText);<br />
               }<br />
    <br />
               function uploadFailed(evt) {<br />
                   alert(&quot;There was an error attempting to upload the file.&quot;);<br />
               }<br />
    <br />
               function uploadCanceled(evt) {<br />
                   xhr.abort();<br />
                   xhr = null;<br />
                   //alert(&quot;The upload has been canceled by the user or the browser dropped the connection.&quot;);<br />
               }<br />
           &lt;/script&gt;

    PHP Source (upload.php)

    &lt;?php

    $tmp_name = $_FILES['fileToUpload']['tmp_name'];
    $size = $_FILES['fileToUpload']['size'];
    $name = $_FILES['fileToUpload']['name'];

    $target_file = basename($name);

    $complete = "complete.avi";
    $com = fopen($complete, "ab");

    // Open temp file
    $out = fopen($target_file, "wb");

    if ( $out ) {
       // Read binary input stream and append it to temp file
       $in = fopen($tmp_name, "rb");
       if ( $in ) {
           while ( $buff = fread( $in, 1048576 ) ) {
               fwrite($out, $buff);
               fwrite($com, $buff);
           }  
       }
       fclose($in);
       fclose($out);
    }
    fclose($com);

    ?>
  • Save frame as image during video stream using ffmpeg, in C

    30 avril 2017, par George T.

    I’m using the Parrot SDK3 to retrieve the video stream from a Bebop2 drone. From it I need to "extract" a frame and save it as an image.

    The whole code can be found here, but I shall try to include the (what I understand as) important parts here.

    Where the video is sent to mplayer. I assume from this that the video format is h624.

    if (videoOut != NULL)
    {
       if (codec.type == ARCONTROLLER_STREAM_CODEC_TYPE_H264)
       {
           if (DISPLAY_WITH_MPLAYER)
           {
               fwrite(codec.parameters.h264parameters.spsBuffer, codec.parameters.h264parameters.spsSize, 1, videoOut);
               fwrite(codec.parameters.h264parameters.ppsBuffer, codec.parameters.h264parameters.ppsSize, 1, videoOut);

               fflush (videoOut);
           }
       }
    }

    Where the frame is received and written to videoOut, to be displayed

    eARCONTROLLER_ERROR didReceiveFrameCallback (ARCONTROLLER_Frame_t *frame, void *customData)
    {
       if (videoOut != NULL)
       {
           if (frame != NULL)
           {
               if (DISPLAY_WITH_MPLAYER)
               {
                   fwrite(frame->data, frame->used, 1, videoOut);

                   fflush (videoOut);
               }
           }
       }
       return ARCONTROLLER_OK;
    }

    The idea I had in mind is to fwrite(frame->data, frame->used, 1, videoOut); to a different file but that just creates a corrupted file, probably because of encoding. In what way can I get this frame and store it to a separate image ? The preferable image filetype .png, .jpg or .gif

    Any help will be greatly appreciated ! Thanks in advance !