Recherche avancée

Médias (91)

Autres articles (42)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (7589)

  • H264 Encoding - Could not play video using VLC Player

    31 mars 2016, par bot1131357

    I am have trouble encoding an H264 video correctly using FFmpeg libav. I could not play the encoded video in VLC media player, and although I could play the video on MPC-HC the time shows 00:00/00:00. Clearly I’m missing something.

    The Media info from MPC-HC shows this :

    General
    Format : AVC
    Format/Info : Advanced Video Codec
    File size : 110 KiB
    Duration : 2s 400ms
    Overall bit rate : 375 Kbps
    Writing library : x264 core 148 r2665 a01e339
    Encoding settings : cabac=0 / ref=3 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=7 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=12 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=12 / rc=abr / mbtree=1 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

    Video
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : Baseline@L2.1
    Format settings, CABAC : No
    Format settings, ReFrames : 3 frames
    Format settings, GOP : M=1, N=12
    Duration : 2s 400ms
    Bit rate : 2 000 Kbps
    Width : 320 pixels
    Height : 240 pixels
    Display aspect ratio : 4:3
    Frame rate mode : Variable
    Frame rate : 20.833 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 1.250
    Stream size : 586 KiB
    Writing library : x264 core 148 r2665 a01e339
    Encoding settings : cabac=0 / ref=3 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=7 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=12 / keyint_min=1 / scenecut=40 / intra_refresh=0 / rc_lookahead=12 / rc=abr / mbtree=1 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

    I noticed something odd in the above info :
    - The frame rate is 20.833 fps, instead of the specified 10 fps.
    - Duration of 2s 400ms did not seem right either, since the video played for more than 4s.

    Also, (AVFrame* picture)->pict_type is always set to AV_PICTURE_TYPE_NONE. I don’t think this is normal.

    The library that I’m using is ffmpeg-20160219-git-98a0053-win32-dev. I would really really appreciate if you could help me out of this confusion.

    /*
    * Video encoding example
    */
    char filename[] = "test.mp4";
    int main(int argc, char** argv)
    {
       AVCodec *codec = NULL;
       AVCodecContext *codecCtx= NULL;
       AVFormatContext *pFormatCtx = NULL;
       AVStream * pVideoStream = NULL;
       AVFrame *picture = NULL;

       int i, x, y,            //
           ret,                // Return value
           got_packet_ptr;     // Data encoded into packet

       printf("Video encoding\n");

       // Register all formats and codecs
       av_register_all();

       // allocate context
       pFormatCtx = avformat_alloc_context();
       memcpy(pFormatCtx->filename,filename,
           min(strlen(filename), sizeof(pFormatCtx->filename)));

       // guess format
       pFormatCtx->oformat = av_guess_format("h264", NULL, NULL);
       if (NULL==pFormatCtx->oformat)
       {
           cerr << "Could not guess output format" << endl;
           return -1;
       }  

       // Find the codec.
       codec = avcodec_find_encoder(pFormatCtx->oformat->video_codec);
       if (codec == NULL) {
           fprintf(stderr, "Codec not found\n");
           return -1;
       }

       // Set context
       int framerate = 10;
       codecCtx = avcodec_alloc_context3(codec);
       avcodec_get_context_defaults3(codecCtx, codec);
       codecCtx->pix_fmt = AV_PIX_FMT_YUV420P;
       codecCtx->profile = FF_PROFILE_H264_BASELINE;
       // Resolution must be a multiple of two.
       codecCtx->width  = 320;
       codecCtx->height = 240;

       codecCtx->bit_rate = 2000000;
       codecCtx->time_base.den = framerate;
       codecCtx->time_base.num = 1;
       codecCtx->gop_size = 12; // emit one intra frame every twelve frames at most

       // Open the codec.  
       if (avcodec_open2(codecCtx, codec, NULL) < 0)
       {
           printf("Cannot open video codec\n");
           return -1;
       }

       // Add stream to pFormatCtx
       pVideoStream = avformat_new_stream(pFormatCtx, codec);
       if (!pVideoStream)
       {
           printf("Cannot add new video stream\n");
           return -1;
       }
       pVideoStream->codec = codecCtx;
       pVideoStream->time_base.den = framerate;
       pVideoStream->time_base.num = 1;

       if (avio_open2(&pFormatCtx->pb, filename, AVIO_FLAG_WRITE, NULL, NULL) < 0)
       {
           printf("Cannot open file\n");
           return -1;
       }

       // Write file header.
       avformat_write_header(pFormatCtx, NULL);

       // Create frame
       picture= av_frame_alloc();
       picture->format = codecCtx->pix_fmt;
       picture->width  = codecCtx->width;
       picture->height = codecCtx->height;

       int bufferImgSize = av_image_get_buffer_size(codecCtx->pix_fmt, codecCtx->width,
                       codecCtx->height,1);    
       av_image_alloc(picture->data, picture->linesize, codecCtx->width, codecCtx->height,                 codecCtx->pix_fmt, 32);

       AVPacket avpkt;

       /* encode 1 second of video */
       for(i=0;i<50;i++)
       {
           /* prepare a dummy image */
           /* Y */
           for(y=0;yheight;y++)
           {
               for(x=0;xwidth;x++)
               {
                   picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
               }
           }
           /* Cb and Cr */
           for(y=0;yheight/2;y++)
           {
               for(x=0;xwidth/2;x++)
               {
                   picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
                   picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
               }
           }

           // Get timestamp
           picture->pts = (float) i * (1000.0/(float)(codecCtx->time_base.den)) * 90;

           // Encode frame to packet
           av_init_packet(&avpkt);
           got_packet_ptr = 0;
           int error = avcodec_encode_video2(codecCtx, &avpkt, picture, &got_packet_ptr);
           if (!error && got_packet_ptr > 0)
           {
               // Write packet with frame.
               ret = (av_interleaved_write_frame(pFormatCtx, &avpkt) == 0);        
           }  
           av_packet_unref(&avpkt);
       }

       // Flush remaining encoded data
       while(1)
       {
           av_init_packet(&avpkt);
           got_packet_ptr = 0;
           // Encode frame to packet.
           int error = avcodec_encode_video2(codecCtx, &avpkt, NULL, &got_packet_ptr);
           if (!error && got_packet_ptr > 0)
           {
               // Write packet with frame.
               ret = (av_interleaved_write_frame(pFormatCtx, &avpkt) == 0);        
           }
           else
           {
               break;
           }
           av_packet_unref(&avpkt);
       }
       av_write_trailer(pFormatCtx);

       av_packet_unref(&avpkt);
       av_frame_free(&picture);

       avcodec_close(codecCtx);
       av_free(codecCtx);

       cin.get();
    }
  • Fix min/max validation. Closes gh-666. Fixes #648

    20 mars 2013, par ekonijn
    Fix min/max validation. Closes gh-666. Fixes #648
    

    In 1.10.0, min/max validation was supported for input type="text",
    where min/max were interpreted as numbers. This means min/max
    for date would not work : min="2012-02-13" was interpreted as min="Not a Number".

    In 1.11.0, min/max were no longer converted to numbers. This means
    min/max for dates worked, but min/max for numbers failed :
    "50" < "150" < "1000" does not hold.

    For an example, see http://jsbin.com/awokex/3

    This commit makes the behaviour of min/max dependent on input type :

    * input type=text (or not type attribute) has numeric min/max, as in 1.10.0
    * input type=date has working min/max for type date ;
    on mobile browsers you also get a date picker,
    plus the browser may reject invalid dates before
    javascript gets a chance to complain.
    * input type=number or range get numeric min/max,
    plus numeric keypad or slider on mobile browsers,
    plus browser may reject invalid input before javascript
    gets a chance to complain

    Allowing use of min/max with type=number/range/date is important
    for mobile browsers, where the numeric keypad or date picker
    make the input much easier to use than a generic text input field.
    In this situation jquery-validate remains necessary to support
    older browsers that do not do input validation based on type
    and min/max.

    For situations where numeric input should be validated by jquery
    without giving the browser a chance to validate the input format,
    input type=text in combination with min/max can be used, as in 1.10.0.

  • Writing an MP4 file on the Mac with OpenCV ffmpeg

    13 janvier 2015, par Sameer Parekh

    I am using OpenCV with ffmpeg on a mac to write video. I’ve been able to successfully write .avi files using the codec/fourcc code, FMP4. I would like to write .mp4 files, however. When I try to write an .mp4 file using fourcc FMP4 I get this error :

    [mp4 @ 0x100b4ec00] Tag FMP4/0x34504d46 incompatible with output codec id '13' ( [0][0][0])

    When I use AVC1 I get the following error :

    [libx264 @ 0x104003000] broken ffmpeg default settings detected
    [libx264 @ 0x104003000] use an encoding preset (e.g. -vpre medium)
    [libx264 @ 0x104003000] preset usage: -vpre <speed> -vpre <profile>
    [libx264 @ 0x104003000] speed presets are listed in x264 --help
    [libx264 @ 0x104003000] profile is optional; x264 defaults to high
    Could not open codec 'libx264': Unspecified error
    </profile></speed>

    Does anyone here know the right codec to use with OpenCV and ffmpeg to write to an MP4 container on the Mac ?

    If AVC1 is the right codec, how do I install ffmpeg + OpenCV correctly ? I did

    brew install gpac
    brew install ffmpeg
    brew install opencv

    The call I am using to open the videowriter :

    fourcc = cv2.cv.CV_FOURCC('A', 'V', 'C', '1')  
    video_out = cv2.VideoWriter(
       filename=output_filename,
       fourcc=fourcc,
       fps=video_fps,
       frameSize=(video_width,video_height),
       isColor=1)

    When I run x264 --help I get

    % x264 --help
    x264 core:125
    Syntax: x264 [options] -o outfile infile

    Infile can be raw (in which case resolution is required),
     or YUV4MPEG (*.y4m),
     or Avisynth if compiled with support (no).
     or libav* formats if compiled with lavf support (no) or ffms support (no).
    Outfile type is selected by filename:
    .264 -> Raw bytestream
    .mkv -> Matroska
    .flv -> Flash Video
    .mp4 -> MP4 if compiled with GPAC support (no)
    Output bit depth: 8 (configured at compile time)

    Options:

     -h, --help                  List basic options
         --longhelp              List more options
         --fullhelp              List all options

    Example usage:

         Constant quality mode:
               x264 --crf 24 -o <output> <input />

         Two-pass with a bitrate of 1000kbps:
               x264 --pass 1 --bitrate 1000 -o <output> <input />
               x264 --pass 2 --bitrate 1000 -o <output> <input />

         Lossless:
               x264 --qp 0 -o <output> <input />

         Maximum PSNR at the cost of speed and visual quality:
               x264 --preset placebo --tune psnr -o <output> <input />

         Constant bitrate at 1000kbps with a 2 second-buffer:
               x264 --vbv-bufsize 2000 --bitrate 1000 -o <output> <input />

    Presets:

         --profile <string>      Force the limits of an H.264 profile
                                     Overrides all settings.
                                     - baseline,main,high,high10,high422,high444
         --preset <string>       Use a preset to select encoding settings [medium]
                                     Overridden by user settings.
                                     - ultrafast,superfast,veryfast,faster,fast
                                     - medium,slow,slower,veryslow,placebo
         --tune <string>         Tune the settings for a particular type of source
                                 or situation
                                     Overridden by user settings.
                                     Multiple tunings are separated by commas.
                                     Only one psy tuning can be used at a time.
                                     - psy tunings: film,animation,grain,
                                                    stillimage,psnr,ssim
                                     - other tunings: fastdecode,zerolatency

    Frame-type options:

     -I, --keyint <integer or="or"> Maximum GOP size [250]
         --tff                   Enable interlaced mode (top field first)
         --bff                   Enable interlaced mode (bottom field first)
         --pulldown <string>     Use soft pulldown to change frame rate
                                     - none, 22, 32, 64, double, triple, euro (requires cfr input)

    Ratecontrol:

     -B, --bitrate <integer>     Set bitrate (kbit/s)
         --crf <float>           Quality-based VBR (0-51) [23.0]
         --vbv-maxrate <integer> Max local bitrate (kbit/s) [0]
         --vbv-bufsize <integer> Set size of the VBV buffer (kbit) [0]
     -p, --pass <integer>        Enable multipass ratecontrol
                                     - 1: First pass, creates stats file
                                     - 2: Last pass, does not overwrite stats file

    Input/Output:

     -o, --output <string>       Specify output file
         --sar width:height      Specify Sample Aspect Ratio
         --fps   Specify framerate
         --seek <integer>        First frame to encode
         --frames <integer>      Maximum number of frames to encode
         --level <string>        Specify level (as defined by Annex A)
         --quiet                 Quiet Mode

    Filtering:

         --vf, --video-filter <filter0>/<filter1>/... Apply video filtering to the input file

         Filter options may be specified in <filter>:<option>=<value> format.

         Available filters:
         crop:left,top,right,bottom
         select_every:step,offset1[,...]
    </value></option></filter></filter1></filter0></string></integer></integer></string></integer></integer></integer></float></integer></string></integer></string></string></string></output></output></output></output></output></output>

    Thanks,
    - s