Recherche avancée

Médias (1)

Mot : - Tags -/publicité

Autres articles (74)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (5978)

  • How to transfer FFmpeg's AVPacket to CUVID's CUVIDSOURCEDATAPACKET ? or how to use FFmpeg's CUVID,any demo ?

    17 mars 2017, par San

    As the title said,I was trapped to How to transfer FFmpeg’s AVPacket to CUVID’s CUVIDSOURCEDATAPACKET,and my main code about this question is below :`

    AVPacket* avpkt;
    avpkt = (AVPacket*)av_malloc(sizeof(AVPacket));
    CUVIDSOURCEDATAPACKET cupkt;
    int iPkt = 0;
    while (av_read_frame(pFormatCtx, avpkt) >= 0) {
       if (avpkt->stream_index == videoindex) {

           cuCtxPushCurrent(g_oContext);

           if (avpkt && avpkt->size) {
               cupkt.payload_size = (unsigned long)avpkt->size;
               cupkt.payload = (const unsigned char*)avpkt->data;

               if (avpkt->pts != AV_NOPTS_VALUE) {
                   cupkt.flags = CUVID_PKT_TIMESTAMP;
                   if (pCodecCtx->pkt_timebase.num && pCodecCtx->pkt_timebase.den) {
                       AVRational tb;
                       tb.num = 1;
                       tb.den = AV_TIME_BASE;
                       cupkt.timestamp = av_rescale_q(avpkt->pts, pCodecCtx->pkt_timebase, tb);
                   }
                   else
                       cupkt.timestamp = avpkt->pts;
               }
           }
           else {
               cupkt.flags = CUVID_PKT_ENDOFSTREAM;
           }

           oResult = cuvidParseVideoData(hParser_, &cupkt);
           if ((cupkt.flags & CUVID_PKT_ENDOFSTREAM) || (oResult != CUDA_SUCCESS)) {
               break;
           }
           iPkt++;
           printf("Succeed to read avpkt %d !\n", iPkt);
           checkCudaErrors(cuCtxPopCurrent(NULL));
       }
       av_free_packet(avpkt);
    }

    and as you see,the code

    cupkt.payload_size = (unsigned long)avpkt->size;
    cupkt.payload = (const unsigned char*)avpkt->data;

    needs to be corrected。
    I’m poor at english,I hope I have expressed my self clearly。

  • fail continuous transfer video file into buffer

    9 décembre 2016, par chintitomasud

    here I want to process a video file transcoding on demand by using ffmpeg but I failed. without ffmpeg all code runs properly. but using ffmpeg I face some problem. it shows this message :

    Spawning new process /samiul113039/1080.mp4:GET
    piping ffmpeg output to client, pid 10016
    HTTP connection disrupted, killing ffmpeg : 10016
    Spawning new process /samiul113039/1080.mp4:GET
    piping ffmpeg output to client, pid 4796
    HTTP connection disrupted, killing ffmpeg : 4796
    ffmpeg didn’t quit on q, sending signals
    ffmpeg has exited : 10016, code null
    ffmpeg didn’t quit on q, sending signals
    ffmpeg has exited : 4796, code nul
    
    var fs=require('fs');

    var url=require("url");
    var urlvalue="http://csestudents.uiu.ac.bd/samiul113039/1080.mp4";


    var parseurl=url.parse(urlvalue);

    var HDHomeRunIP = parseurl.hostname;
    var HDHomeRunPort = parseurl.port;
    var childKillTimeoutMs = 1000;

    var parseArgs = require('minimist')(process.argv.slice(2));

    // define startsWith for string
    if (typeof String.prototype.startsWith != 'function') {
     // see below for better implementation!
     String.prototype.startsWith = function (str){
       return this.indexOf(str) == 0;
     };
    }
    // Called when the response object fires the 'close' handler, kills ffmpeg
    function responseCloseHandler(command) {
     if (command.exited != true) {
       console.log('HTTP connection disrupted, killing ffmpeg: ' + command.pid);
       // Send a 'q' which signals ffmpeg to quit.
       // Then wait half a second, send a nice signal, wait another half second
       // and send SIGKILL
       command.stdin.write('q\n');
       command.stdin.destroy();
       // install timeout and wait
       setTimeout(function() {
         if (command.exited != true) {
           console.log('ffmpeg didn\'t quit on q, sending signals');
           // still connected, do safe sig kills
           command.kill();
           try {
             command.kill('SIGQUIT');
           } catch (err) {}
           try {
             command.kill('SIGINT');
           } catch (err) {}
           // wait some more!
           setTimeout(function() {
             if (command.exited != true) {
               console.log('ffmpeg didn\'t quit on signals, sending SIGKILL');
               // at this point, just give up and whack it
               try {
                 command.kill('SIGKILL');
               } catch (err) {}
             }
           }, childKillTimeoutMs);
         }    
       }, childKillTimeoutMs);
     }
    }

    // Performs a proxy. Copies data from proxy_request into response
    function doProxy(request,response,http,options) {
     var proxy_request = http.request(options, function (proxy_response) {
       proxy_response.on('data', function(chunk) {
         response.write(chunk, 'binary');
       });
       proxy_response.on('end', function() {
         response.end();
       });
       response.writeHead(proxy_response.statusCode, proxy_response.headers);
     });
     request.on('data', function(chunk) {
       proxy_request.write(chunk, 'binary');
     });
     // error handler
     proxy_request.on('error', function(e) {
       console.log('problem with request: ' + e.message);
       response.writeHeader(500);
       response.end();
     });

     proxy_request.end();
    }

    var child_process = require('child_process');
    var auth = require('./auth');
    // Performs the transcoding after the URL is validated
    function doTranscode(request,response) {
     //res.setHeader("Accept-Ranges", "bytes");
     response.setHeader("Accept-Ranges", "bytes");
     response.setHeader("Content-Type", "video/mp4");        
     response.setHeader("Connection","close");
     response.setHeader("Cache-Control","no-cache");
     response.setHeader("Pragma","no-cache");

     // always write the header
     response.writeHeader(200);

     // if get, spawn command stream it
     if (request.method == 'GET') {
       console.log('Spawning new process ' + request.url + ":" + request.method);

    var command = child_process.spawn('ffmpeg',
                                         ['-i','http://csestudents.uiu.ac.bd/samiul113039/1080.mp4','-f','mpegts','-'],
                                         { stdio: ['pipe','pipe','ignore'] });

        command.exited = false;
       // handler for when ffmpeg dies unexpectedly
       command.on('exit',function(code,signal) {
         console.log('ffmpeg has exited: ' + command.pid + ", code " + code);
         // set flag saying we've quit
         command.exited = true;
         response.end();
       });
       command.on('error',function(error) {
         console.log('ffmpeg error handler - unable to kill: ' + command.pid);
         // on well, might as well give up
         command.exited = true;
         try {
           command.stdin.close();
         } catch (err) {}
         try {
           command.stdout.close();
         } catch (err) {}
         try {
           command.stderr.close();
         } catch (err) {}
         response.end();
       });
       // handler for when client closes the URL connection - stop ffmpeg
       response.on('end',function() {
        responseCloseHandler(command);
       });
       // handler for when client closes the URL connection - stop ffmpeg
       response.on('close',function() {
         responseCloseHandler(command);
       });

       // now stream
       console.log('piping ffmpeg output to client, pid ' + command.pid);
       command.stdout.pipe(response);
       command.stdin.on('error',function(err) {
         console.log("Weird error in stdin pipe ", err);
         response.end();
       });
       command.stdout.on('error',function(err) {
         console.log("Weird error in stdout pipe ",err);
         response.end();
       });
     }
     else {
       // not GET, so close response
       response.end();
     }
    }

    // Load the http module to create an http server.
    var http = require('http');

    // Configure our HTTP server to respond with Hello World to all requests.
    var server = http.createServer(function (request, response) {
     //console.log("New connection from " + request.socket.remoteAddress + ":" + request.url);

     if (auth.validate(request,response)) {
       // first send a HEAD request to our HD Home Run with the same url to see if the address is valid.
       // This prevents an ffmpeg instance to spawn when clients request invalid things - like robots.txt/etc
       var options = {method: 'HEAD', hostname: HDHomeRunIP, port: HDHomeRunPort, path: request.url};
       var req = http.request(options, function(res) {
         // if they do a get, and it returns good status
         if (request.method == "GET" &&
             res.statusCode == 200 &&
             res.headers["content-type"] != null &&
             res.headers["content-type"].startsWith("video")) {
           // transcode is possible, start it now!
           doTranscode(request,response);
         }
         else {
           // no video or error, cannot transcode, just forward the response from the HD Home run to the client
           if (request.method == "HEAD") {
             response.writeHead(res.statusCode,res.headers);
             response.end();
           }
           else {
             // do a 301 redirect and have the device response directly  

             // just proxy it, that way browser doesn't redirect to HDHomeRun IP but keeps the node.js server IP
             options = {method: request.method, hostname: HDHomeRunIP, /* port: HDHomeRunPort, */path: request.url};
             doProxy(request,response,http,options);
           }
         }
       });
       req.on('error', function(e) {
         console.log('problem with request: ' + e.message);
         response.writeHeader(500);
         response.end();
       });
       // finish the client request, rest of processing done in the async callbacks
       req.end();
     }
    });

    // turn on no delay for tcp
    server.on('connection', function (socket) {
     socket.setNoDelay(true);
    });
    server.listen(7000);
  • Added option to group files in one XHR request based on their file size and the upload file size limit

    15 novembre 2013, par ottens
    Added option to group files in one XHR request based on their file size and the upload file size limit
    

    If your upload limit is say 1MB and you have 100 files of 20Kb you could set the limitMultiFileUploads to 50 to minimize requests. However is there is one 30kb file the batch containing that group will fail. So I coded an uploadSizeLimitMultiFileUploads option that will calculate the max number of files that fit in one request based on a set upload size. I added a 512 bytes overhead for each file for the calculations to be on the safe side. Hope you find these useful, it is very useful if you want to upload 1000s of small files. Thanks

    Signed-off-by : Maarten Ottens <m@maartenottens.com>