Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (41)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

Sur d’autres sites (10194)

  • Fail to set profile to high when using ffmpeg with libx264

    10 mars 2012, par user1258095

    Here is my command :

    ffmpeg -i input.avi -vcodec libx264 -vpre fast -vpre high -acodec copy output.avi

    The output :

    Input #0, avi, from 'short.avi':
     Metadata:
       encoder         : Lavf53.3.0
     Duration: 00:00:25.04, start: 0.000000, bitrate: 12705 kb/s
       Stream #0.0: Video: msmpeg4v2, yuv420p, 1920x1080, 24 tbr, 24 tbn, 24 tbc
       Stream #0.1: Audio: aac, 48000 Hz, 5.1, s16, 316 kb/s
       Metadata:
         title           : ED-CM-5.1-DVD-Final2
    File for preset 'high' not found

    However, I am able to successfully transcode files when setting the profile to baseline or main, from the man page of x264 it is clear that "high" should also be a valid argument. I also want to know where these preset files are located in the file system(I am running ubuntu 11.10) so that I can make sure what arguments I can actually use for presets and profiles at the moment. I am very frustrated by this issue and would really appreciate any input from you guys. Thanks in advance.

  • php stream any mp4

    3 avril 2012, par GRaecuS

    I'm developing a web app that converts videos and allows to play them through Flowplayer.

    On the current status, I use ffmpeg to convert the videos to mp4 and qtfaststart to fix their metadata for streaming. Everything is working smoothly as I can download any converted mp4 and view it correctly.

    For serving the videos to Flowplayer, I use a php file which contains the following (summarized) code :

    header("Content-Type: {$mediatype}");

    if ( empty($_SERVER['HTTP_RANGE']) )
    {
       if ( $filetype == 'flv' && $seekPos != 0 )
       {
           header("Content-Length: " . ($filesize + 13));
           print('FLV');
           print(pack('C', 1));
           print(pack('C', 1));
           print(pack('N', 9));
           print(pack('N', 9));
       }
       else
       {          
           header("Content-Length: {$filesize}");
       }

       $fh = fopen($filepath, "rb") or die("Could not open file: {$filepath}");

       # seek to requested file position
       fseek($fh, $seekPos);

       # output file
       while(!feof($fh))
       {
           # output file without bandwidth limiting
           echo fread($fh, $filesize);
       }
       fclose($fh);
    }
    else //violes rfc2616, which requires ignoring  the header if it's invalid
    {  
       $fp = @fopen($file, 'rb');

       $size   = filesize($file); // File size
       $length = $size;           // Content length
       $start  = 0;               // Start byte
       $end    = $size - 1;       // End byte
       // Now that we've gotten so far without errors we send the accept range header
       /* At the moment we only support single ranges.
        * Multiple ranges requires some more work to ensure it works correctly
        * and comply with the spesifications: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2
        *
        * Multirange support annouces itself with:
        * header('Accept-Ranges: bytes');
        *
        * Multirange content must be sent with multipart/byteranges mediatype,
        * (mediatype = mimetype)
        * as well as a boundry header to indicate the various chunks of data.
        */
       header("Accept-Ranges: 0-$length");
       // header('Accept-Ranges: bytes');
       // multipart/byteranges
       // http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2
       if (isset($_SERVER['HTTP_RANGE']))
       {
           $c_start = $start;
           $c_end   = $end;
           // Extract the range string
           list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
           // Make sure the client hasn't sent us a multibyte range
           if (strpos($range, ',') !== false)
           {
               // (?) Shoud this be issued here, or should the first
               // range be used? Or should the header be ignored and
               // we output the whole content?
               header('HTTP/1.1 416 Requested Range Not Satisfiable');
               header("Content-Range: bytes $start-$end/$size");
               // (?) Echo some info to the client?
               exit;
           }
           // If the range starts with an '-' we start from the beginning
           // If not, we forward the file pointer
           // And make sure to get the end byte if spesified
           if ($range0 == '-')
           {

               // The n-number of the last bytes is requested
               $c_start = $size - substr($range, 1);
           }
           else
           {
               $range  = explode('-', $range);
               $c_start = $range[0];
               $c_end   = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size;
           }
           /* Check the range and make sure it's treated according to the specs.
            * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
            */
           // End bytes can not be larger than $end.
           $c_end = ($c_end > $end) ? $end : $c_end;
           // Validate the requested range and return an error if it's not correct.
           if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size)
           {
               header('HTTP/1.1 416 Requested Range Not Satisfiable');
               header("Content-Range: bytes $start-$end/$size");
               // (?) Echo some info to the client?
               exit;
           }
           $start  = $c_start;
           $end    = $c_end;
           $length = $end - $start + 1; // Calculate new content length
           fseek($fp, $start);
           header('HTTP/1.1 206 Partial Content');
       }

       // Notify the client the byte range we'll be outputting
       header("Content-Range: bytes $start-$end/$size");
       header("Content-Length: $length");

       // Start buffered download
       $buffer = 1024 * 8;
       while(!feof($fp) && ($p = ftell($fp)) <= $end)
       {
           if ($p + $buffer > $end)
           {
               // In case we're only outputtin a chunk, make sure we don't
               // read past the length
               $buffer = $end - $p + 1;
           }
           set_time_limit(0); // Reset time limit for big files
           echo fread($fp, $buffer);
           flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit.
       }

       fclose($fp);
    }

    Unfortunately, it is working only for the majority of the videos. For some of them, Flowplayer keeps returning Error 200, even though they were encoded correctly.

    How can I fix this ? Is it a coding problem or those videos are faulty ?

  • c++, FFMPEG, H264, creating zero-delay stream

    5 février 2015, par Mat

    I’m trying to encode video (using h264 codec at the moment, but other codecs would be fine too if better suited for my needs) such that the data needed for decoding is available directly after a frame (including the first frame) was encoded (so, i want only I and P frames, no B frames).

    How do I need to setup the AVCodecContext to get such a stream ? So far my testing arround with the values still always resulted in avcodec_encode_video() returning 0 on the first frame.

    //edit : this is currently my setup code of the AVCodecContext :

    static AVStream* add_video_stream(AVFormatContext *oc, enum CodecID codec_id, int w, int h, int fps)
    {
       AVCodecContext *c;
       AVStream *st;
       AVCodec *codec;

       /* find the video encoder */
       codec = avcodec_find_encoder(codec_id);
       if (!codec) {
           fprintf(stderr, "codec not found\n");
           exit(1);
       }

       st = avformat_new_stream(oc, codec);
       if (!st) {
           fprintf(stderr, "Could not alloc stream\n");
           exit(1);
       }

       c = st->codec;

       /* Put sample parameters. */
       c->bit_rate = 400000;
       /* Resolution must be a multiple of two. */
       c->width    = w;
       c->height   = h;
       /* timebase: This is the fundamental unit of time (in seconds) in terms
        * of which frame timestamps are represented. For fixed-fps content,
        * timebase should be 1/framerate and timestamp increments should be
        * identical to 1. */
       c->time_base.den = fps;
       c->time_base.num = 1;
       c->gop_size      = 12; /* emit one intra frame every twelve frames at most */

       c->codec = codec;
       c->codec_type = AVMEDIA_TYPE_VIDEO;
       c->coder_type = FF_CODER_TYPE_VLC;
       c->me_method = 7; //motion estimation algorithm
       c->me_subpel_quality = 4;
       c->delay = 0;
       c->max_b_frames = 0;
       c->thread_count = 1; // more than one threads seem to increase delay
       c->refs = 3;

       c->pix_fmt       = PIX_FMT_YUV420P;

       /* Some formats want stream headers to be separate. */
       if (oc->oformat->flags & AVFMT_GLOBALHEADER)
           c->flags |= CODEC_FLAG_GLOBAL_HEADER;

       return st;
    }

    but with this avcodec_encode_video() will buffer 13 frames before returning any bytes (after that, it will return bytes on every frame). if I set gop_size to 0, then avcodec_encode_video() will return bytes only after the second frame was passed to it. I need a zero delay though.

    This guy apparently was successful (even with larger gop) : http://mailman.videolan.org/pipermail/x264-devel/2009-May/005880.html but I don’t see what he is doing differently