Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (21)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

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

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 is the first MediaSPIP stable release.
    Its official release date is June 21, 2013 and is announced here.
    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 (...)

Sur d’autres sites (5625)

  • 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 ?

  • How to install this nodejs Application

    15 février 2016, par metalbug

    https://github.com/hexator/live4chan

    i have VMware run ubuntu-14.10-server and 15.10-server

    sudo apt-get install -y
        git mongodb imagemagick libcairo2-dev libjpeg8-dev
        libpango1.0-dev libgif-dev build-essential g++ ffmpeg curl

    install success

    git clone https://github.com/hexator/live4chan.git;
    cd live4chan;
    npm install

    but have errors

    test@ubuntu:~/live4chan$ npm start

       LiveChan@0.0.1 start /home/test/live4chan
       node lib/index.js

    Missing certificate or private key
    Running with insecure server
    info - socket.io started
    connect.limit() will be removed in connect 3.0
    connect.multipart() will be removed in connect 3.0
    visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
    connect.limit() will be removed in connect 3.0

    module.js:340
    throw err;
    ^
    Error: Cannot find module 'carrier'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object. (/home/test/ircd.js/lib/server.js:24:15)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

    npm ERR! Linux 4.2.0-16-generic
    npm ERR! argv "node" "/usr/local/bin/npm" "start"
    npm ERR! node v0.10.42
    npm ERR! npm v3.7.2
    npm ERR! code ELIFECYCLE
    npm ERR! LiveChan@0.0.1 start: node lib/index.js
    npm ERR! Exit status 8
    npm ERR!
    npm ERR! Failed at the LiveChan@0.0.1 start script 'node lib/index.js'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the LiveChan package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR! node lib/index.js
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR! npm bugs LiveChan
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR! npm owner ls LiveChan
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR! /home/test/live4chan/npm-debug.log

    ==========================================================
    /home/test/live4chan/npm-debug.log

    0 info it worked if it ends with ok
    1 verbose cli [ 'node', '/usr/local/bin/npm', 'start' ]
    2 info using npm@3.7.2
    3 info using node@v0.10.42
    4 verbose run-script [ 'prestart', 'start', 'poststart' ]
    5 info lifecycle LiveChan@0.0.1~prestart: LiveChan@0.0.1
    6 silly lifecycle LiveChan@0.0.1~prestart: no script for prestart, continuing
    7 info lifecycle LiveChan@0.0.1~start: LiveChan@0.0.1
    8 verbose lifecycle LiveChan@0.0.1~start: unsafe-perm in lifecycle true
    9 verbose lifecycle LiveChan@0.0.1~start: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/test/live4chan/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
    10 verbose lifecycle LiveChan@0.0.1~start: CWD: /home/test/live4chan
    11 silly lifecycle LiveChan@0.0.1~start: Args: [ '-c', 'node lib/index.js' ]
    12 silly lifecycle LiveChan@0.0.1~start: Returned: code: 8 signal: null
    13 info lifecycle LiveChan@0.0.1~start: Failed to exec start script
    14 verbose stack Error: LiveChan@0.0.1 start: node lib/index.js
    14 verbose stack Exit status 8
    14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
    14 verbose stack at EventEmitter.emit (events.js:98:17)
    14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
    14 verbose stack at ChildProcess.emit (events.js:98:17)
    14 verbose stack at maybeClose (child_process.js:766:16)
    14 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:833:5)
    15 verbose pkgid LiveChan@0.0.1
    16 verbose cwd /home/test/live4chan
    17 error Linux 4.2.0-16-generic
    18 error argv "node" "/usr/local/bin/npm" "start"
    19 error node v0.10.42
    20 error npm v3.7.2
    21 error code ELIFECYCLE
    22 error LiveChan@0.0.1 start: node lib/index.js
    22 error Exit status 8
    23 error Failed at the LiveChan@0.0.1 start script 'node lib/index.js'.
    23 error Make sure you have the latest version of node.js and npm installed.
    23 error If you do, this is most likely a problem with the LiveChan package,
    23 error not with npm itself.
    23 error Tell the author that this fails on your system:
    23 error node lib/index.js
    23 error You can get information on how to open an issue for this project with:
    23 error npm bugs LiveChan
    23 error Or if that isn't available, you can get their info via:
    23 error npm owner ls LiveChan
    23 error There is likely additional logging output above.
    24 verbose exit [ 1, true ]

    I tried this :
    npm install carrier

    Or an error.

    and install Other versions of nodejs

    wget http://nodejs.org/dist/latest-v0.10.x/node-v0.10.42.tar.gz
    wget http://nodejs.org/dist/latest-v0.12.x/node-v0.12.10.tar.gz
    wget http://nodejs.org/dist/latest-v4.x/node-v4.3.0.tar.gz
    wget http://nodejs.org/dist/latest-v5.x/node-v5.6.0.tar.gz
    tar zxvf node-v4.3.0.tar.gz
    cd node-v4.3.0
    ./configure
    make
    sudo make install

    Nothing happened

    please help me
    Or you can tell me how to install, detailed, thank you very much !

  • ValueError When Reading Video Frame

    27 juin 2016, par Bassie

    I am following this article, from where I got this code :

    FFMPEG_BIN ="Z:\ffmpeg\bin\ffmpeg.exe"

    import subprocess as sp
    command = [ FFMPEG_BIN,
               '-i', 'video.mp4',
               '-f', 'image2pipe',
               '-pix_fmt', 'rgb24',
               '-vcodec', 'rawvideo', '-']
    pipe = sp.Popen(command, stdout = sp.PIPE, bufsize=10**8, shell=True)

    import numpy
    # read 420*360*3 bytes (= 1 frame)
    raw_image = pipe.stdout.read(420*360*3)
    # transform the byte read into a numpy array
    image =  numpy.fromstring(raw_image, dtype='uint8')
    image = image.reshape((360,420,3))
    # throw away the data in the pipe's buffer.
    pipe.stdout.flush()

    When I run it I see this error :

    Traceback (most recent call last):
     File "Z:\py\ffmtest\test.py", line 16, in <module>
       image = image.reshape((360,420,3))
    ValueError: total size of new array must be unchanged
    </module>

    Where line 16 is image = image.reshape((360,420,3)). I think this error is produced by numpy, but probably because I am calculating the values for my video incorrectly.

    Output :

    raw_image : b’ ’

    len(raw_image) : 0

    image : [ ]

    len(image) : 0

    I am not sure whether I am passing in the correct values for read or reshape functions - any help at all is much appreciated !