Recherche avancée

Médias (39)

Mot : - Tags -/audio

Autres articles (14)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

Sur d’autres sites (3475)

  • AsyncTask publishProgress() does not update progress ffmpeg android

    7 février 2014, par jay

    I am using ffmpeg commands for processing media files.In doInBackground() method i have started the process and every time i get the duration , time values and grabbing progress using time and duration and send progress to publishProgress(progress).When i tested on google nexus(android 4.4 kitkat) it is updating progress dialog correctly but this won't happen in below android 4.4 devices.It is updating with an eye blink of time after completion of the process.
    Here is my code :

    protected String doInBackground(String... params)  {
               // TODO Auto-generated method stub  
               try {
                   proc = mProcess.start();
               } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
               }
               processDuration(proc.getErrorStream());

               // Wait for process to exit
               int exitCode = 1; // Assume error
               try {
                   exitCode = proc.waitFor();
               } catch (InterruptedException e) {
                   Log.e(TAG, "Process interrupted!", e);
               }
               onExit(exitCode);          
               return null;            
           }

           private void onExit(int exitCode) {
               // TODO Auto-generated method stub
               Log.i("exit code >>>>>>>>..", ""+exitCode);
           }

           private void processDuration(InputStream errorStream) {
               // TODO Auto-generated method stub
               Scanner sc = new Scanner(errorStream);          
               // Find duration
               Pattern durPattern = Pattern.compile("(?<=Duration: )[^,]*");
               String dur = sc.findWithinHorizon(durPattern, 0);
               if (dur==null) throw new RuntimeException("Could not parse    duration.");          
               String[] hms = dur.split(":");
               try{
                   totalSecs= Integer.parseInt(hms[0]) * 3600 + Integer.parseInt(hms[1]) *  60 + Double.parseDouble(hms[2]);
                   Log.i(" progress>>>>>>>>>>>>>",""+totalSecs);
               }catch(NumberFormatException e){

               }
               Pattern timePattern = Pattern.compile("(?<=time=)[\\d:.]*");
               String match= sc.findWithinHorizon(timePattern, 0);            
               while (null != (match = sc.findWithinHorizon(timePattern, 0))) {
                   hms = match.split(":");
                   try{
                       processedSecs= Integer.parseInt(hms[0]) * 3600 + Integer.parseInt(hms[1]) *  60 + Double.parseDouble(hms[2]);
                   }catch(NumberFormatException e){

                   }
                   progress = processedSecs / totalSecs;  
                   final int finalProgress=(int)(progress*100);
                   try {

                       publishProgress(""+finalProgress);

                       Thread.sleep(1000);
                   } catch (InterruptedException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
                   }

               }
               publishProgress(""+100);
           }

           protected void onPostExecute(String  result) {
               super.onPostExecute(result);                
               mProgressDialog.dismiss();

           }

           protected void onPreExecute() {
               super.onPreExecute();
               showDialog(DIALOG_DOWNLOAD_PROGRESS);              
           }

           protected void onProgressUpdate(String... progress) {
               mProgressDialog.setProgress(Integer.parseInt(progress[0]));
               super.onProgressUpdate(progress);
           }

           public Dialog showDialog(int id) {
           // TODO Auto-generated method stub
           switch (id) {
           case DIALOG_DOWNLOAD_PROGRESS:
               mProgressDialog = new ProgressDialog(context);
               mProgressDialog.setMessage(loading process..");
               mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
               mProgressDialog.setCancelable(false);
               mProgressDialog.setMax(100);
               mProgressDialog.setCanceledOnTouchOutside(false);
               mProgressDialog.show();
               return mProgressDialog;
           default:
               return null;
           }
       }
       }

    Thanks for Your Help..
    Please help me out this problem..........

  • fluent-ffmpeg mergeToFile always 128kb audio bit-rate no matter what

    12 septembre 2020, par Martin

    I am trying to use fluent-ffmpeg with my electron app to concatenate multiple audio files together with an image in a video. So if i have three files :

    


    song1.mp3 1:00
song2.mp3 0:30
song3.mp3 2:00
front.jpg

    


    I could create output.mp4 which would be 3:30 seconds long, and play each file one after the other in order. With front.jpg set as the background image.

    


    I am trying to create the concatenated audio file first for this video, then I can just render a vid with two inputs ; image and the 3:30second long concatenated audio file. But I'm having difficulty getting my electron app to wait for the ffmpeg job to run and complete.

    


    I know how to do all of these ffmpeg jobs on the command-line, but I've been following this guide for how to package ffmpeg into an electron app that can run on mac/win10/linux environments. I'm developing it on win10 right now.
gur.com/LtykP.png

    


    I have a button :&#xA;<button>FULLALBUM</button>

    &#xA;

    that when I click runs the fullAlbum() function that calls combineMp3FilesOrig to run the actual ffmpeg job :

    &#xA;

    async function fullAlbum(uploadName) {&#xA;    //document.getElementById("buttonId").disabled = true;&#xA;&#xA;    //get table&#xA;    var table = $(`#upload_${uploadNumber}_table`).DataTable()&#xA;    //get all selected rows&#xA;    var selectedRows = table.rows( &#x27;.selected&#x27; ).data()&#xA;    //get outputFile location&#xA;    var path = require(&#x27;path&#x27;);&#xA;    var outputDir = path.dirname(selectedRows[0].audioFilepath)&#xA;    //create outputfile&#xA;    var timestamp = new Date().getUTCMilliseconds();&#xA;    let outputFilepath = `${outputDir}/output-${timestamp}.mp3` &#xA;&#xA;    &#xA;    console.log(&#x27;fullAlbum() button pressed: &#x27;, timestamp)&#xA;&#xA;    await combineMp3FilesOrig(selectedRows, outputFilepath, &#x27;320k&#x27;, timestamp);&#xA;    //document.getElementById("buttonId").disabled = false;&#xA;&#xA;    console.log(`fullAlbum() /output-${timestamp}.mp3 should be created now`)&#xA;}&#xA;&#xA;function combineMp3FilesOrig(selectedRows, outputFilepath, bitrate, timestamp) {&#xA;    console.log(`combineMp3FilesOrig(): ${outputFilepath}`)&#xA;    &#xA;    //begin get ffmpeg info&#xA;    const ffmpeg = require(&#x27;fluent-ffmpeg&#x27;);&#xA;    //Get the paths to the packaged versions of the binaries we want to use&#xA;    const ffmpegPath = require(&#x27;ffmpeg-static&#x27;).replace(&#x27;app.asar&#x27;,&#x27;app.asar.unpacked&#x27;);&#xA;    const ffprobePath = require(&#x27;ffprobe-static&#x27;).path.replace(&#x27;app.asar&#x27;,&#x27;app.asar.unpacked&#x27;);&#xA;    //tell the ffmpeg package where it can find the needed binaries.&#xA;    ffmpeg.setFfmpegPath(ffmpegPath);&#xA;    ffmpeg.setFfprobePath(ffprobePath);&#xA;    //end set ffmpeg info&#xA;&#xA;    //create ffmpeg command&#xA;    console.log(`combineMp3FilesOrig(): create command`)&#xA;    const command = ffmpeg();&#xA;    //set command inputs&#xA;    command.input(&#x27;C:\\Users\\marti\\Documents\\martinradio\\uploads\\CharlyBoyUTurn\\5. Akula (Club Mix).flac&#x27;)&#xA;    command.input(&#x27;C:\\Users\\marti\\Documents\\martinradio\\uploads\\CharlyBoyUTurn\\4. Civilian Barracks.flac&#x27;)&#xA;&#xA;    return new Promise((resolve, reject) => {&#xA;        console.log(`combineMp3FilesOrig(): command status logging`)&#xA;        command.on(&#x27;progress&#x27;, function(progress) {&#xA;            console.info(`Processing : ${progress.percent} % done`);&#xA;        })&#xA;        .on(&#x27;codecData&#x27;, function(data) {&#xA;            console.log(&#x27;codecData=&#x27;,data);&#xA;        })&#xA;        .on(&#x27;end&#x27;, function() {&#xA;            console.log(&#x27;file has been converted succesfully; resolve() promise&#x27;);&#xA;            resolve();&#xA;        })&#xA;        .on(&#x27;error&#x27;, function(err) {&#xA;            console.log(&#x27;an error happened: &#x27; &#x2B; err.message, &#x27;, reject()&#x27;);&#xA;            reject(err);&#xA;        })&#xA;        console.log(`combineMp3FilesOrig(): add audio bitrate to command`)&#xA;        command.audioBitrate(bitrate)&#xA;        console.log(`combineMp3FilesOrig(): tell command to merge inputs to single file`)&#xA;        command.mergeToFile(outputFilepath);&#xA;        console.log(`combineMp3FilesOrig(): end of promise`)&#xA;    });&#xA;    console.log(`combineMp3FilesOrig(): end of function`)&#xA;}&#xA;

    &#xA;

    When I click my button once, my console.logs show the promise is entered, the command is created, but the function just ends without waiting for a resolve() ;&#xA;Waiting a couple minutes doesnt change anything.

    &#xA;

    enter image description here

    &#xA;

    If I press the button again :

    &#xA;

    enter image description here

    &#xA;

    A new command gets created, reaches the end of the promise, but this time actually starts, and triggers the previous command to start. Both jobs then run and their files are rendered at the correct length (12:08) and the correct quality (320k)

    &#xA;

    Is there something with my promise I need to fix involving async functions and promises in an electron app ? I tried editing my ffmpeg command to include

    &#xA;

    command.run()

    &#xA;

    At the end of my promise to ensure it gets triggered ; but that leads to an err in console saying Uncaught (in promise) Error: No output specified because apparently in fluent-ffmpeg command.mergeToFile(outputFilepath); isnt good enough and I need to include .output(outputFilepath) as well. If I change command.run() to command.output(outputFilepath).run(), when i click my button, the ffmpeg job gets triggered and rendered perfectly fine. EXCEPT THAT THE FILE IS ALWAYS 128kbps

    &#xA;

    So I'm trying to figure out why my included code block, my ffmpeg command doesn't run the first time when its created.

    &#xA;

  • avconv/ffmpeg command to encode nice full hd webm for chrome

    18 mars 2016, par xavier.seignard

    People from the artistic direction gave me big .mov and .mp4 that I need to put on a web app, but so far they are so huge that decoding/rendering is kinda bad on chrome (this is a chrome only experience since it will run on electron at the end).

    I’d like to re-encode them in .webm since it seems to have the best support in chrome.

    But I’m kinda lost on how to re-encode them without significative visual quality lost.

    For now I use (taken from https://trac.ffmpeg.org/wiki/Encode/VP8)

    ffmpeg -i myVid.mp4 -c:v libvpx -crf 8 -b:v 2M -c:a libvorbis myVid.webm

    So, does anyone have a nice avconv/ffmpeg command that will produce nice and easy to render .webm ?

    Regards.