Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (52)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (9229)

  • ffmpeg + socket.io -> MediaSource video stops after few seconds

    25 avril 2015, par Dmitry S.

    I am trying to transcode a video using ffmpeg and pipe the output through socket.io to client page which appends the data to MediaSource buffer to play. Video starts playing but suddenly stops after a few seconds.
    I assume that ffmpeg throughput is less than real-time which cause the issue. What might be a better way of handling slow streams to play the video ? Some pre-loading could happen, but is it possible to use along with MediaSource ?

    var app = require('http').createServer(handler)
    var io = require('socket.io')(app);
    var fs = require('fs');
    var child = require('child_process');
    var util = require('util');

    var args = ['-i', 'pipe:0', '-c:v', 'libvpx', '-b:v', '300k', '-quality', 'good', '-vf', 'scale=640:-2',
     '-c:a', 'libvorbis', '-b:a', '128000', '-threads', '0', '-r', '25', '-rc_lookahead', '25', '-f', 'webm',
     '-me_method', 'zero', '-flags2', 'fast', '-preset', 'ultrafast', '-analyzeduration', '1000', 'pipe:1'
    ];

    app.listen(8080);

    function handler(req, res) {
     fs.readFile(__dirname + '/video.html',
       function(err, data) {
         if (err) {
           res.writeHead(500);
           return res.end('Error loading video.html');
         }

         res.writeHead(200);
         res.end(data);
         console.log('html sent');
       });
    }

    io.on('connection', function(socket) {

     console.log('Connected...');

     var in_file = fs.createReadStream("oceans.mp4");
     var trans_proc = child.spawn('ffmpeg', args, null);
     in_file.pipe(trans_proc.stdin);

     trans_proc.stderr.on('data', function(data) {
       console.log(data.toString());
     });

     socket.on('VIDEO_STREAM_REQ', function(req) {
       console.log(req);

       trans_proc.stdout.addListener('data', function(data) {
         console.log(data.length);
         socket.emit('VS', data);
       });

     });
    });
     <video autoplay="autoplay"></video>

     <code class="echappe-js">&lt;script src=&quot;https://cdn.socket.io/socket.io-1.3.5.js&quot;&gt;&lt;/script&gt;
    &lt;script&gt;<br />
       window.URL = window.URL || window.webkitURL;<br />
    <br />
       window.MediaSource = window.MediaSource || window.WebKitMediaSource;<br />
       if (!!!window.MediaSource) {<br />
         alert('MediaSource API is not available');<br />
       }<br />
       console.log('MediaSource API' + window.MediaSource);<br />
    <br />
       var mediaSource = new MediaSource();<br />
       var video = document.getElementById('v');<br />
       var i = 0;<br />
    <br />
       video.src = window.URL.createObjectURL(mediaSource);<br />
    <br />
       mediaSource.addEventListener('webkitsourceopen', function(e) {<br />
         console.log('mediaSource readyState: ' + this.readyState);<br />
       }, false);<br />
    <br />
       mediaSource.addEventListener('webkitsourceended', function(e) {<br />
         console.log('mediaSource readyState: ' + this.readyState);<br />
       }, false);<br />
    <br />
       var queue = [];<br />
    <br />
       mediaSource.addEventListener('sourceopen', function(e) {<br />
         console.log('mediaSource readyState: ' + this.readyState);<br />
    <br />
         console.log('listener fired');<br />
         var sourceBuffer = mediaSource.addSourceBuffer('video/webm; codecs=&quot;vorbis,vp8&quot;');<br />
    <br />
         var socket = io.connect('http://localhost:8080');<br />
    <br />
         socket.emit('VIDEO_STREAM_REQ', 'REQUEST');<br />
    <br />
         socket.on('VS', function(data) {<br />
           queue.push(new Uint8Array(data));<br />
    <br />
           if (queue.length &gt; 3 &amp;amp;&amp;amp; !sourceBuffer.updating)<br />
             sourceBuffer.appendBuffer(queue.shift());<br />
    <br />
    <br />
           i = i + 1;<br />
           console.log(queue.length);<br />
         });<br />
    <br />
         sourceBuffer.addEventListener('updateend', function() {<br />
           console.log(queue.length);<br />
           if (queue.length) {<br />
             sourceBuffer.appendBuffer(queue.shift());<br />
           }<br />
         }, false);<br />
    <br />
       });<br />
     &lt;/script&gt;
  • How to achive better quality with libav on android surface ?

    16 novembre 2018, par iLobanov

    Playing video from RTSP stream on Android surface using solution from this repo
    https://github.com/alexandruc/android-ffmpeg-player/blob/master/android-ffmpeg-player/jni/ffmpeg-player.c

    Video is playng but have a lot of glitches especially when something moving.
    Have not enought expirience using libav.
    Will be happy if someone can help or give links on some tutorials or community.

    Here is the function to display video on surface.

    void* decodeAndRender(void *voidArgs) {
    auto *args = (decode_args*)voidArgs;
    CamCon* cc = getCamCon(args->name);

    ANativeWindow_Buffer    windowBuffer;
    AVPacket                packet;
    int                     i=0;
    int                     frameFinished;
    int                     lineCnt;

    int counter = 0;
    while(av_read_frame(cc->formatCtx, &amp;packet)>=0 &amp;&amp; cc->isConnect) {
       counter = 1;
       // Is this a packet from the video stream?
       if(packet.stream_index==cc->videoStreamIdx) {
           // Decode video frame
           avcodec_decode_video2(cc->codecCtx, cc->decodedFrame, &amp;frameFinished, &amp;packet);
           // Did we get a video frame?
           if(frameFinished) {
               // RECORD video
               if(cc->isRecord)
                   recordMP4(packet, cc);

               // DISPLAY video
               // Convert the image from its native format to RGBA
               sws_scale (
                       cc->sws_ctx,
                       (uint8_t const * const *)cc->decodedFrame->data,
                       cc->decodedFrame->linesize,
                       0,
                       cc->codecCtx->height,
                       cc->frameRGBA->data,
                       cc->frameRGBA->linesize
               );
               // lock the window buffer
               if (ANativeWindow_lock(cc->window, &amp;windowBuffer, NULL) &lt; 0) {
                   LOGE("cannot lock window");
               } else {
                   // draw the frame on buffer
                   LOGI("copy buffer %d:%d:%d", cc->displayWidth, cc->displayHeight, cc->displayWidth * cc->displayHeight*4);
                   LOGI("window buffer: %d:%d:%d", windowBuffer.width,
                        windowBuffer.height, windowBuffer.stride);
                   memcpy(windowBuffer.bits, cc->buffer,  cc->displayWidth * cc->displayHeight * 4);
                   // unlock the window buffer and post it to display
                   ANativeWindow_unlockAndPost(cc->window);
                   // count number of frames
                   ++i;
               }
           }
       }
       // Free the packet that was allocated by av_read_frame
       av_free_packet(&amp;packet);
    }
    LOGI("total No. of frames decoded and rendered %d", i);
    finish(args->env, args->name);

    }

  • Optimize ffmpeg for text with mpeg1

    20 septembre 2022, par lmalves

    I'm kind of new to video enconding and decoding but I'm currently working with NodeJS and I need to stream the content of a window (using electron) to an angular app.

    &#xA;

    In my current implementation I'm "grabbing" the app window content :

    &#xA;

    ffmpeg -f gdigrab -i title="Windows App" -vcodec mpeg1video -r 30 -b:v 10  -bufsize:v 327680 -f rtp rtp://127.0.0.1:1234

    &#xA;

    Then I'm conveting to http:

    &#xA;

    ffmpeg -i rtp://127.0.0.1:1234 -protocol_whitelist file,crypto,udp,rtp,http,tcp -f mpegts -codec:v mpeg1video -s 500x515 -b:v 10 -bf 0 http://localhost:59655/

    &#xA;

    And on the client app using MpegJS to display it with almost the default configuration.

    &#xA;

    It works relativelly well except for some parts of text where if the font is smaller it's almost impossible to read it.

    &#xA;

    Like I said I'm new on this and I'm not sure how to optimize it to text.&#xA;Any suggestions ?

    &#xA;