Recherche avancée

Médias (91)

Autres articles (14)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

Sur d’autres sites (7895)

  • Stream webm to node.js from c# application in chunks

    29 mai 2018, par Dan-Levi Tømta

    I am in the process of learning about streaming between node.js with socket.io and c#.

    I have code that successfully records the screen with ffmpeg, redirects it StandardOutput.BaseStream and stores it into a Memorybuffer, when i click stop in my application it sends the memorystream as a byte array to the node.js server which are storing the file so the clients can play it. This are working just fine and here are my setup for that :

    C#

    bool ffWorkerIsWorking = false;
    private void btnFFMpeg_Click(object sender, RoutedEventArgs e)
    {
       BackgroundWorker ffWorker = new BackgroundWorker();
       ffWorker.WorkerSupportsCancellation = true;
       ffWorker.DoWork += ((ffWorkerObj,ffWorkerEventArgs) =>
       {
           ffWorkerIsWorking = true;
           using (var FFProcess = new Process())
           {
               var processStartInfo = new ProcessStartInfo
               {
                   FileName = "ffmpeg.exe",
                   RedirectStandardInput = true,
                   RedirectStandardOutput = true,
                   UseShellExecute = false,
                   CreateNoWindow = false,
                   Arguments = " -loglevel panic -hide_banner -y -f gdigrab -draw_mouse 1 -i desktop -threads 2 -deadline realtime  -f webm -"
               };
               FFProcess.StartInfo = processStartInfo;
               FFProcess.Start();

               byte[] buffer = new byte[32768];
               using (MemoryStream ms = new MemoryStream())
               {
                   while (!FFProcess.HasExited)
                   {
                       int read = FFProcess.StandardOutput.BaseStream.Read(buffer, 0, buffer.Length);
                       if (read <= 0)
                           break;
                       ms.Write(buffer, 0, read);
                       Console.WriteLine(ms.Length);
                       if (!ffWorkerIsWorking)
                       {                                
                           clientSocket.Emit("video", ms.ToArray());                                
                           ffWorker.CancelAsync();
                           break;
                       }
                   }
               }
           }
       });
       ffWorker.RunWorkerAsync();
    }

    JS (Server)

    socket.on('video', function(data) {
       fs.appendFile('public/fooTest.webm', data, function (err) {
         if (err) throw err;
         console.log('File uploaded');
       });
    });

    Now i need to change this code so it instead of sending the whole file it should sends chunks of byte arrays instead of the whole video, and node will then initially create a file and then append those chunks of byte arrays as they are received. Ok sound easy enough, but apparently not.

    I need to somehow instruct the code to use a offset and just the bytes after that offset and then update the offset.

    On the server side i think the best approach is to create a file and append the byte arrays to that file as they are received.

    On the server side i would do something like this :

    JS (Server)

    var buffer = new Buffer(32768);
    var isBuffering = false;
    socket.on('video', function(data) {
       //concatenate the buffer with the incoming data and broadcast.emit to clients

    });

    How am i able to setup the offset for the bytes to be sent and update that offset, and how would i approach the way of concatenating the data to the initialized buffer ?

    I have tried to write some code that only reads from the offset to the end and it seems like this is working although the video when added up in node is just black :

    C#

    while (!FFProcess.HasExited)
    {
       int read = FFProcess.StandardOutput.BaseStream.Read(buffer, 0, buffer.Length);
       if (read <= 0)
           break;
       int offset = (read - buffer.Length > 0 ? read - buffer.Length : 0);
       ms.Write(buffer, offset, read);
       clientSocket.Emit("videoChunk", buffer.ToArray());
       if (!ffWorkerIsWorking)
       {                                
           ffWorker.CancelAsync();
           break;
       }
    }

    Node console output

    Bytes read

    JS (Server)

    socket.on('videoChunk', function(data) {
       if (!isBufferingDone) {
           buffer = Buffer.concat([buffer, data]);
           console.log(data.length);
       }
    });

    socket.on('cancelVideo', function() {
       isBufferingDone = true;
       setTimeout(function() {
           fs.writeFile("public/test.webm", buffer, function(err) {
               if(err) {
                   return console.log(err);
               }
               console.log("The file was saved!");
               buffer = new Buffer(32768);
           });
       }, 1000);
    });

    JS (Client)

    socket.on('video', function(filePath) {
      console.log('path: ' + filePath);
      $('#videoSource').attr('src',filePath);
      $('#video').play();
    });

    Thanks !

  • Stream webm to node.js from c# application in chunks

    7 août 2015, par Dan-Levi Tømta

    I am in the process of learning about streaming between node.js with socket.io and c#.

    I have code that successfully records the screen with ffmpeg, redirects it StandardOutput.BaseStream and stores it into a Memorybuffer, when i click stop in my application it sends the memorystream as a byte array to the node.js server which are storing the file so the clients can play it. This are working just fine and here are my setup for that :

    C#

    bool ffWorkerIsWorking = false;
    private void btnFFMpeg_Click(object sender, RoutedEventArgs e)
    {
       BackgroundWorker ffWorker = new BackgroundWorker();
       ffWorker.WorkerSupportsCancellation = true;
       ffWorker.DoWork += ((ffWorkerObj,ffWorkerEventArgs) =>
       {
           ffWorkerIsWorking = true;
           using (var FFProcess = new Process())
           {
               var processStartInfo = new ProcessStartInfo
               {
                   FileName = "ffmpeg.exe",
                   RedirectStandardInput = true,
                   RedirectStandardOutput = true,
                   UseShellExecute = false,
                   CreateNoWindow = false,
                   Arguments = " -loglevel panic -hide_banner -y -f gdigrab -draw_mouse 1 -i desktop -threads 2 -deadline realtime  -f webm -"
               };
               FFProcess.StartInfo = processStartInfo;
               FFProcess.Start();

               byte[] buffer = new byte[32768];
               using (MemoryStream ms = new MemoryStream())
               {
                   while (!FFProcess.HasExited)
                   {
                       int read = FFProcess.StandardOutput.BaseStream.Read(buffer, 0, buffer.Length);
                       if (read <= 0)
                           break;
                       ms.Write(buffer, 0, read);
                       Console.WriteLine(ms.Length);
                       if (!ffWorkerIsWorking)
                       {                                
                           clientSocket.Emit("video", ms.ToArray());                                
                           ffWorker.CancelAsync();
                           break;
                       }
                   }
               }
           }
       });
       ffWorker.RunWorkerAsync();
    }

    JS (Server)

    socket.on('video', function(data) {
       fs.appendFile('public/fooTest.webm', data, function (err) {
         if (err) throw err;
         console.log('File uploaded');
       });
    });

    Now i need to change this code so it instead of sending the whole file it should sends chunks of byte arrays instead of the whole video, and node will then initially create a file and then append those chunks of byte arrays as they are received. Ok sound easy enough, but apparently not.

    I need to somehow instruct the code to use a offset and just the bytes after that offset and then update the offset.

    On the server side i think the best approach is to create a file and append the byte arrays to that file as they are received.

    On the server side i would do something like this :

    JS (Server)

    var buffer = new Buffer(32768);
    var isBuffering = false;
    socket.on('video', function(data) {
       //concatenate the buffer with the incoming data and broadcast.emit to clients

    });

    How am i able to setup the offset for the bytes to be sent and update that offset, and how would i approach the way of concatenating the data to the initialized buffer ?

    I have tried to write some code that only reads from the offset to the end and it seems like this is working although the video when added up in node is just black :

    C#

    while (!FFProcess.HasExited)
    {
       int read = FFProcess.StandardOutput.BaseStream.Read(buffer, 0, buffer.Length);
       if (read <= 0)
           break;
       int offset = (read - buffer.Length > 0 ? read - buffer.Length : 0);
       ms.Write(buffer, offset, read);
       clientSocket.Emit("videoChunk", buffer.ToArray());
       if (!ffWorkerIsWorking)
       {                                
           ffWorker.CancelAsync();
           break;
       }
    }

    Node console output

    Bytes read

    JS (Server)

    socket.on('videoChunk', function(data) {
       if (!isBufferingDone) {
           buffer = Buffer.concat([buffer, data]);
           console.log(data.length);
       }
    });

    socket.on('cancelVideo', function() {
       isBufferingDone = true;
       setTimeout(function() {
           fs.writeFile("public/test.webm", buffer, function(err) {
               if(err) {
                   return console.log(err);
               }
               console.log("The file was saved!");
               buffer = new Buffer(32768);
           });
       }, 1000);
    });

    JS (Client)

    socket.on('video', function(filePath) {
      console.log('path: ' + filePath);
      $('#videoSource').attr('src',filePath);
      $('#video').play();
    });

    Thanks !

  • Revision 29188 : 2 options de plus pour personnaliser la page d’activation de la mutu : * ...

    15 juin 2009, par real3t@… — Log

    2 options de plus pour personnaliser la page d’activation de la mutu :
    * ’branding’ : texte libre en HTML
    * ’branding_logo’ => logo (sous forme de HTML)