Recherche avancée

Médias (1)

Mot : - Tags -/ogg

Autres articles (100)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (12873)

  • Calculate in Node audio bitrate given bytes and duration and viceversa

    6 mai 2016, par loretoparisi

    Supposed to not have access to ffmpeg I need a simple way to calculate the bitrate of an audio (or video) file given media length (bytes) and duration (seconds), i.e. the function

    bitrate = MediaInfo.bitrate(bytes, duration);

    Also I need to do the opposite, so that given approximate media bitrate and length I need calculate the duration :

    duration = MediaInfo.duration(bytes, bitrate);

    So, this is my attempt, inspired by bitrate node module :

    var console = {
       log: function(s) {
         document.getElementById("console").innerHTML += s + "<br />"
       }
    }

    /**
    * Get media file info
    * @see https://www.npmjs.com/package/bitrate
    * * @author Loreto Parisi (loretoparisi at gmail dot com)
    */
    var MediaInfo = {

       /** unit divisors */
       DIVISORS : {
         bps: 0.125,
         kbps: 125,
         mbps: 125000,
         Bps: 1,
         KBps: 1000,
         MBps: 1000000
       },

       /**
        * Calcuate approximate bitrate
        * @param bytes integer media length in bytes
        * @param seconds float media duration
        * @param format string: bps|kbps|Bps|KBps|MBps
        * @param pos integer decimal approximation
       */
       bitrate : function(bytes, seconds, format, pos) {
               if (typeof format !== 'string') throw new TypeError('Expected \'format\' to be a string')
               format = format.replace('/', 'p')

         var divisor = this.DIVISORS[format];
               if (!divisor) throw new Error('\'format\' is an invalid string')
         var bitrate = bytes / seconds / divisor;
         pos=pos||4;

         return (Math.round(bitrate * Math.pow(10,pos)) / Math.pow(10,pos) );

       },

       /**
        * Calcuate approximate duration
        * @param bytes integer media length in bytes
        * @param bitrate float media bitrate per seconds
        * @param format string: bps|kbps|Bps|KBps|MBps
        * @param pos integer decimal approximation
       */
       duration : function(bytes, bitrate, format, pos) {
         if (typeof format !== 'string') throw new TypeError('Expected \'format\' to be a string')
               format = format.replace('/', 'p')

         var divisor = this.DIVISORS[format];
         if (!divisor) throw new Error('\'format\' is an invalid string')
         var seconds = bytes / bitrate / divisor;
         pos=pos||4;

         return (Math.round(seconds * Math.pow(10,pos)) / Math.pow(10,pos) );
       }
     } //MediaInfo

    // example of usage
     var bytes = 57511; // media file size in bytes
     var seconds = 20.35 // media file duration in seconds

     // calculate media bitrate given media length and duration
     var kilobitsPerSecond = MediaInfo.bitrate(bytes, seconds, 'kbps', 3) // => 326.3
     var bitsPerSecond = MediaInfo.bitrate(bytes, seconds, 'bps', 3) // => 326279
     var BytesPerSecond = MediaInfo.bitrate(bytes, seconds, 'Bps', 3) // => 40785

     // inverse: calculate media duration given media length and bitrate
     var duration = MediaInfo.duration(bytes, kilobitsPerSecond, 'kbps', 3);

     var data = {
         bytes : bytes,
         seconds : seconds,
         kilobitsPerSecond : kilobitsPerSecond + " kb/s",
         bitsPerSecond : bitsPerSecond + " b/s",
         BytesPerSecond : BytesPerSecond + " B/s",
         duration : duration
     }

     console.log( JSON.stringify(data, null, 2) );
    <div></div>

    The result media info are

    {
       "bytes": 57511,
       "seconds": 20.35,
       "kilobitsPerSecond": "22.609 kb/s",
       "bitsPerSecond": "22608.747 b/s",
       "BytesPerSecond": "2826.093 B/s",
       "duration": 20.35
    }

    while ffmpeg gives

    Duration: 00:00:20.35, start: 0.000000, bitrate: 22 kb/s
       Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 16 kb/s (default)

    Of course, the problem here is the assumption that I have a fixed bitrate when calculating the duration. But, is there any other way without having ffprobe or lame in node ?

  • Revision 90090 : retour sur r89703 : rétablir l’exclusion automatique des pages dans ...

    10 juin 2015, par brunobergot@… — Log

    retour sur r89703 : rétablir l’exclusion automatique des pages dans les boucles articles
    on veut bien tester que le critère tout *n’est pas* présent (et non l’inverse)

  • How to estimate in Node audio bitrate, bytes, duration without ffmpeg

    6 mai 2016, par loretoparisi

    Supposed to not have access to ffmpeg I need a simple way to calculate the bitrate of an audio (or video) file given media length (bytes) and duration (seconds), i.e. the function

    bitrate = MediaInfo.bitrate(bytes, duration);

    Also I need to do the opposite, so that given approximate media bitrate and length I need calculate the duration :

    duration = MediaInfo.duration(bytes, bitrate);

    So, this is my attempt, inspired by bitrate node module :

    var console = {
       log: function(s) {
         document.getElementById("console").innerHTML += s + "<br />"
       }
    }

    /**
    * Get media file info
    * @see https://www.npmjs.com/package/bitrate
    * * @author Loreto Parisi (loretoparisi at gmail dot com)
    */
    var MediaInfo = {

       /** unit divisors */
       DIVISORS : {
         bps: 0.125,
         kbps: 125,
         mbps: 125000,
         Bps: 1,
         KBps: 1000,
         MBps: 1000000
       },

       /**
        * Calcuate approximate bitrate
        * @param bytes integer media length in bytes
        * @param seconds float media duration
        * @param format string: bps|kbps|Bps|KBps|MBps
        * @param pos integer decimal approximation
       */
       bitrate : function(bytes, seconds, format, pos) {
               if (typeof format !== 'string') throw new TypeError('Expected \'format\' to be a string')
               format = format.replace('/', 'p')

         var divisor = this.DIVISORS[format];
               if (!divisor) throw new Error('\'format\' is an invalid string')
         var bitrate = bytes / seconds / divisor;
         pos=pos||4;

         return (Math.round(bitrate * Math.pow(10,pos)) / Math.pow(10,pos) );

       },

       /**
        * Calcuate media bytes
        * @param bitrate float media bitrate per seconds
        * @param seconds float media duration
        * @param format string: bps|kbps|Bps|KBps|MBps
        * @param pos integer decimal approximation
       */
       bytes : function(bitrate, seconds, format) {
          if (typeof format !== 'string') throw new TypeError('Expected \'format\' to be a string')
          format = format.replace('/', 'p')

          var divisor = this.DIVISORS[format];
          if (!divisor) throw new Error('\'format\' is an invalid string')
          var bytes = bitrate * seconds * divisor;

          return ( Math.round(bytes) );

        }, //bytes

       /**
        * Calcuate approximate duration
        * @param bytes integer media length in bytes
        * @param bitrate float media bitrate per seconds
        * @param format string: bps|kbps|Bps|KBps|MBps
        * @param pos integer decimal approximation
       */
       duration : function(bytes, bitrate, format, pos) {
         if (typeof format !== 'string') throw new TypeError('Expected \'format\' to be a string')
               format = format.replace('/', 'p')

         var divisor = this.DIVISORS[format];
         if (!divisor) throw new Error('\'format\' is an invalid string')
         var seconds = bytes / bitrate / divisor;
         pos=pos||4;

         return (Math.round(seconds * Math.pow(10,pos)) / Math.pow(10,pos) );
       }
     } //MediaInfo

    // example of usage
     var bytes = 57511; // media file size in bytes
     var seconds = 20.35 // media file duration in seconds

     // calculate media bitrate given media length and duration
     var kilobitsPerSecond = MediaInfo.bitrate(bytes, seconds, 'kbps', 3) // => 326.3
     var bitsPerSecond = MediaInfo.bitrate(bytes, seconds, 'bps', 3) // => 326279
     var BytesPerSecond = MediaInfo.bitrate(bytes, seconds, 'Bps', 3) // => 40785

     // inverse: calculate media duration given media length and bitrate
     var duration = MediaInfo.duration(bytes, kilobitsPerSecond, 'kbps', 3);
     
     // estimated bytes length given bitrate and duration
     var estimatedBytes = MediaInfo.bytes(kilobitsPerSecond, duration, 'kbps', 3);

     var data = {
         bytes : bytes,
         seconds : seconds,
         kilobitsPerSecond : kilobitsPerSecond + " kb/s",
         bitsPerSecond : bitsPerSecond + " b/s",
         BytesPerSecond : BytesPerSecond + " B/s",
         duration : duration,
        estimatedBytes : estimatedBytes
     }

     console.log( JSON.stringify(data, null, 2) );
    <div></div>

    The result media info are

    {
     "bytes": 57511,
     "seconds": 20.35,
     "kilobitsPerSecond": "22.609 kb/s",
     "bitsPerSecond": "22608.747 b/s",
     "BytesPerSecond": "2826.093 B/s",
     "duration": 20.35,
     "estimatedBytes": 57512
    }

    while ffmpeg gives

    Duration: 00:00:20.35, start: 0.000000, bitrate: 22 kb/s
       Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 16 kb/s (default)

    Of course, the problem here is the assumption that I have a fixed bitrate when calculating the duration. But, is there any other way without having ffprobe or lame in node ?

    Note. A good options, where the media file has ID3 tagging, is to use the JSMediaTags node module that supports ID3 and MP4 tagging for media files and works both in the browser that in node :

    var jsmediatags = require("jsmediatags");
    jsmediatags.read("./music-file.mp3", {
     onSuccess: function(tag) {
       console.log(tag);
     },
     onError: function(error) {
       console.log(':(', error.type, error.info);
     }
    });

    This will not work for streaming media files or for files coming from direct audio sources of course.