Recherche avancée

Médias (91)

Autres articles (42)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (6351)

  • Detect if FFmpeg is running or has stopped running

    21 février 2013, par asprin

    I'm using C to scan a directory which contains frames extracted by ffmpeg. Now in the event that the last file is reached during the scan, I need to check for two conditions :

    1. It's the last file as the video duration is over.
    2. It's the last file as ffmpeg terminated abruptly and is no longer able to populate the directory

    My C program workflow is like :

    while(<there exists="exists" files="files" in="in" the="the" directory="directory">)
    {
      // iterate over them and do something with each frame
    }

    // coming out of the loop means no more files available...so I need a if condition
    if(<check if="if" ffmpeg="ffmpeg" is="is" stopped="stopped">) // &lt;-- need to know what to put inside the condition
    {
      // start it again
    }
    else
    {
     // video is over, nothing more left to do
    }
    </check></there>

    I'm thinking I can do this using Process ID of ffmpeg, but how would I get that info ? Any other alternative way of checking if ffpmeg has stopped ?

    Some metadata

    OS : Windows 7
    IDE : Dev C++
    Language Used : C

  • RecordRTC only recording stop after 1min

    2 novembre 2015, par Mick Jack

    I am using RecordRTC to record a webcam stream and using ffmpeg to convert the output into .mp4 recording of 1min video is fine and the browser merge both the audio and video into a single .mp4 however recording that is longer than 1min will encounter this error.

    error

    My Sample Code

    function setupNewBroadcastButtonClickHandler() {
               document.getElementById('broadcast-name').disabled = true;
               document.getElementById('setup-new-broadcast').disabled = true;
               //document.getElementById('save-video').disabled = true;
               captureUserMedia(function() {
                   var shared = 'video';
                   broadcastUI.createRoom({
                       roomName: (document.getElementById('broadcast-name') || {}).value || 'Anonymous',
                       isAudio: shared === 'audio'
                   });
               });
               hideUnnecessaryStuff();
           }

           var audioRecorder, videoRecorder, videoURL, connectionStream;
           function initRecorders(stream) {
               //document.getElementById('start-recording').disabled = false;
               document.getElementById('stop-recording').disabled = false;
               //document.getElementById('save-video').disabled = false;
               //document.getElementById('start-recording').onclick = function() {
                   this.disabled = true;
                   audioRecorder = RecordRTC(stream, {
                       recorderType: StereoAudioRecorder,
                       bufferSize: 16384,  // mandatory: if 720p output is forced. otherwise: optional
                       width: 1280, // optional---- to get 720p output
                       height: 720
                   });

                   videoRecorder = RecordRTC(stream, {
                       type: 'video',
                       frameInterval: 90
                   });

                   videoRecorder.initRecorder(function() {
                       audioRecorder.initRecorder(function() {
                           audioRecorder.startRecording();
                           videoRecorder.startRecording();
                       });
                   });
               //};

               document.getElementById('stop-recording').onclick = function() {
                   this.disabled = true;
                   //document.getElementById('start-recording').disabled = false;
                   //document.getElementById('save-video').disabled = false;
                   videoRecorder.stopRecording(function() {
                       audioRecorder.stopRecording(function() {
                           var audioBlob = audioRecorder.blob;
                           var videoBlob = videoRecorder.blob;

                           convertStreams(videoBlob, audioBlob);

                           // Generate video URL
                           //var video = document.createElement('video');
                           //video.src = URL.createObjectURL(videoBlob);
                           //videoURL = video.src;
                       });
                   });
                   stream.stop();
               };

               /*document.getElementById('save-video').onclick = function() {
                   this.disabled = true;          
                   downloadURI(videoURL, 'video.webm');    
               };*/
           }

           function captureUserMedia(callback) {
               var htmlElement = document.createElement('video');
               htmlElement.setAttribute('autoplay', true);
               htmlElement.setAttribute('controls', true);
               videosContainer.insertBefore(htmlElement, videosContainer.firstChild);

               var mediaConfig = {
                   video: htmlElement,
                   onsuccess: function(stream) {
                       config.attachStream = stream;
                       callback &amp;&amp; callback();
                       //htmlElement.setAttribute('muted', true);
                       scaleVideos();
                       initRecorders(stream);
                   },
                   onerror: function() {
                       alert('unable to get access to your webcam');
                   }
               };
               getUserMedia(mediaConfig);
           }

           var broadcastUI = broadcast(config);

           /* UI specific */
           var videosContainer = document.getElementById('videos-container') || document.body;
           var setupNewBroadcast = document.getElementById('setup-new-broadcast');
           var roomsList = document.getElementById('rooms-list');

           var broadcastingOption = document.getElementById('broadcasting-option');

           if (setupNewBroadcast)
               setupNewBroadcast.onclick = setupNewBroadcastButtonClickHandler;

           function hideUnnecessaryStuff() {
               var visibleElements = document.getElementsByClassName('visible'),
                   length = visibleElements.length;
               for (var i = 0; i &lt; length; i++) {
                   visibleElements[i].style.display = 'none';
               }
           }

           var workerPath = 'https://4dbefa02675a4cdb7fc25d009516b060a84a3b4b.googledrive.com/host/0B6GWd_dUUTT8WjhzNlloZmZtdzA/ffmpeg_asm.js';

           // HTML5 create a new thread to run merging and conversion at background
                   function processInWebWorker() {

                       var blob = URL.createObjectURL(new Blob(['importScripts("' + workerPath + '");var now = Date.now;function print(text) {postMessage({"type" : "stdout","data" : text});};onmessage = function(event) {var message = event.data;if (message.type === "command") {var Module = {print: print,printErr: print,files: message.files || [],arguments: message.arguments || [],TOTAL_MEMORY: message.TOTAL_MEMORY || false};postMessage({"type" : "start","data" : Module.arguments.join(" ")});postMessage({"type" : "stdout","data" : "Received command: " +Module.arguments.join(" ") +((Module.TOTAL_MEMORY) ? ".  Processing with " + Module.TOTAL_MEMORY + " bits." : "")});var time = now();var result = ffmpeg_run(Module);var totalTime = now() - time;postMessage({"type" : "stdout","data" : "Finished processing (took " + totalTime + "ms)"});postMessage({"type" : "done","data" : result,"time" : totalTime});}};postMessage({"type" : "ready"});'], {
                                   type: 'application/javascript'
                           }));
                            var worker = new Worker(blob);
                            URL.revokeObjectURL(blob);
                            return worker;
                     }
                   var worker;

                   function convertStreams(videoBlob, audioBlob) {
                       var vab;
                       var aab;
                       var buffersReady;
                       var workerReady;
                       var posted = false;
                       var fileReader1 = new FileReader();
                       fileReader1.onload = function() {
                           vab = this.result;
                           if (aab)
                               buffersReady = true;
                           if (buffersReady &amp;&amp; workerReady &amp;&amp; !posted)
                               postMessage();
                       };
                       var fileReader2 = new FileReader();
                       fileReader2.onload = function() {
                           aab = this.result;
                           if (vab)
                               buffersReady = true;
                           if (buffersReady &amp;&amp; workerReady &amp;&amp; !posted)
                               postMessage();
                       };
                       fileReader1.readAsArrayBuffer(videoBlob);
                       fileReader2.readAsArrayBuffer(audioBlob);
                       if (!worker) {
                           worker = processInWebWorker();
                       }
                       worker.onmessage = function(event) {
                           var message = event.data;
                           var message = event.data;
                           if (message.type == "ready") {
                               log('Start converting video and audio to mp4, please wait...');
                               workerReady = true;
                               if (buffersReady)
                                   postMessage();
                           } else if (message.type == "done") {

                               var result = message.data[0];
                               var blob = new Blob([result.data], {
                                   type: 'video/mp4'
                               });
                               log("Done converting. File will be downloaded");
                               document.getElementById('setup-new-broadcast').disabled = false;
                               var source = document.createElement('source');
                               source.src = URL.createObjectURL(blob);
                               source.type = 'video/mp4; codecs=mpeg4';
                               downloadURI(source.src, 'video.mp4');
                           }
                       };
                       var postMessage = function() {
                           posted = true;
                           worker.postMessage({
                               type: 'command',
                               arguments: [
                                   '-i', 'video.webm',
                                   '-i', 'audio.wav',
                                   '-c:v', 'mpeg4',
                                   '-c:a', 'vorbis',
                                   '-b:v', '6400k',
                                   '-b:a', '4800k',
                                   '-strict', 'experimental', 'output.mp4'
                               ],
                               files: [
                                   {
                                       data: new Uint8Array(vab),
                                       name: "video.webm"
                                   },
                                   {
                                       data: new Uint8Array(aab),
                                       name: "audio.wav"
                                   }
                               ]
                           });
                       };
                   }
  • A blocked external process in a swing GUI

    27 décembre 2012, par user1932255

    I am developing an encoder with java swing and ffmpeg. I created a GUI interface in which I specify my inputs (devices, frame rate, bitrate..). Then I call ffmpeg to encode and stream.

    My problem is that the encoding class is well executed from a main class but it is blocked when called from the swing interface (specifically jButtonactionperformed()).

    Can anyone help me ?

    here is my button action

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
       Encode s = new Encode();
       s.Encode(cmdLine);
    }

    and here is my encoding method

    public void Encode(String cmdLine) {
       try {
           Process p2 = Runtime.getRuntime().exec(cmdLine);
           //logProcessOutputAndErrors(p2);
       }
       catch(Exception ex) {
           ex.printStackTrace();
       }
    }

    Ps : Cmdline is the command i collect from inputs