Recherche avancée

Médias (91)

Autres articles (58)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Soumettre bugs et patchs

    10 avril 2011

    Un logiciel n’est malheureusement jamais parfait...
    Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
    Si vous pensez avoir résolu vous même le bug (...)

Sur d’autres sites (9190)

  • how to change the frame rate and capturing image size from IP camera

    6 décembre 2015, par rockycai

    Now I have a IP camera and I want to capture image from it through RTSP.I use below code and it works well.But the camera’s frame rate is 25/s.So I got a lot of images per second.I don’t want it.And per image is 6.2MB.I also don’t want need to get high quality image.What can I do to slower the frame rate and smaller the size of image ?

    #ifndef INT64_C
    #define INT64_C(c) (c ## LL)
    #define UINT64_C(c) (c ## ULL)
    #endif

    #ifdef __cplusplus
    extern "C" {
    #endif
       /*Include ffmpeg header file*/
    #include <libavformat></libavformat>avformat.h>
    #include <libavcodec></libavcodec>avcodec.h>
    #include <libswscale></libswscale>swscale.h>
    #include
    #ifdef __cplusplus
    }
    #endif

    #include


    static void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame);

    int main (int argc, const char * argv[])
    {
       AVFormatContext *pFormatCtx;
       int             i, videoStream;
       AVCodecContext  *pCodecCtx;
       AVCodec         *pCodec;
       AVFrame         *pFrame;
       AVFrame         *pFrameRGB;
       AVPacket        packet;
       int             frameFinished;
       int             numBytes;
       uint8_t         *buffer;

       // Register all formats and codecs
       av_register_all();
    //  const char *filename="C:\libraries\gfjyp.avi";
       // Open video file
       //AVDictionary *options = NULL;
       //av_dict_set(&amp;options,"rtsp_transport","tcp",0);
       if(av_open_input_file(&amp;pFormatCtx, argv[1], NULL, 0, NULL)!=0)
           return -1; // Couldn't open file

       // Retrieve stream information
       if(av_find_stream_info(pFormatCtx)&lt;0)
           return -1; // Couldn't find stream information

       // Dump information about file onto standard error
       dump_format(pFormatCtx, 0, argv[1], false);

       // Find the first video stream
       videoStream=-1;
       for(i=0; inb_streams; i++)
           if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO)
           {
               videoStream=i;
               break;
           }
           if(videoStream==-1)
               return -1; // Didn't find a video stream

           // Get a pointer to the codec context for the video stream
           pCodecCtx=pFormatCtx->streams[videoStream]->codec;

           // Find the decoder for the video stream
           pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
           if(pCodec==NULL)
               return -1; // Codec not found

           // Open codec
           if(avcodec_open(pCodecCtx, pCodec)&lt;0)
               return -1; // Could not open codec

           // Hack to correct wrong frame rates that seem to be generated by some codecs

           if(pCodecCtx->time_base.num>1000 &amp;&amp; pCodecCtx->time_base.den==1)
               pCodecCtx->time_base.den=1000;

           //pCodecCtx->time_base.den=1;
           //pCodecCtx->time_base.num=1;
           // Allocate video frame
           pFrame=avcodec_alloc_frame();

           // Allocate an AVFrame structure
           pFrameRGB=avcodec_alloc_frame();
           if(pFrameRGB==NULL)
               return -1;

           // Determine required buffer size and allocate buffer
           numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,
               pCodecCtx->height);

           //buffer=malloc(numBytes);
           buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));

           // Assign appropriate parts of buffer to image planes in pFrameRGB
           avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
               pCodecCtx->width, pCodecCtx->height);

           // Read frames and save first five frames to disk
           i=0;
           while(av_read_frame(pFormatCtx, &amp;packet)>=0)
           {
               // Is this a packet from the video stream?
               if(packet.stream_index==videoStream)
               {
                   // Decode video frame
                   avcodec_decode_video2(pCodecCtx, pFrame, &amp;frameFinished,
                       &amp;packet);

                   // Did we get a video frame?
                   if(frameFinished)
                   {

                       static struct SwsContext *img_convert_ctx;

    #if 0
                       // Older removed code
                       // Convert the image from its native format to RGB swscale
                       img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24,
                           (AVPicture*)pFrame, pCodecCtx->pix_fmt, pCodecCtx->width,
                           pCodecCtx->height);

                       // function template, for reference
                       int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
                           int srcSliceH, uint8_t* dst[], int dstStride[]);
    #endif
                       // Convert the image into YUV format that SDL uses
                       if(img_convert_ctx == NULL) {
                           int w = pCodecCtx->width;
                           int h = pCodecCtx->height;

                           img_convert_ctx = sws_getContext(w, h,
                               pCodecCtx->pix_fmt,
                               w, h, PIX_FMT_RGB24, SWS_BICUBIC,
                               NULL, NULL, NULL);
                           if(img_convert_ctx == NULL) {
                               fprintf(stderr, "Cannot initialize the conversion context!\n");
                               exit(1);
                           }
                       }
                       int ret = sws_scale(img_convert_ctx, pFrame->data, pFrame->linesize, 0,
                           pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize);
    #if 0
                       // this use to be true, as of 1/2009, but apparently it is no longer true in 3/2009
                       if(ret) {
                           fprintf(stderr, "SWS_Scale failed [%d]!\n", ret);
                           exit(-1);
                       }
    #endif

                       // Save the frame to disk
                       if(i++&lt;=1000)
                           SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, i);
                   }
               }

               // Free the packet that was allocated by av_read_frame
               av_free_packet(&amp;packet);
               //sleep(1);
           }

           // Free the RGB image
           //free(buffer);
           av_free(buffer);
           av_free(pFrameRGB);

           // Free the YUV frame
           av_free(pFrame);

           // Close the codec
           avcodec_close(pCodecCtx);

           // Close the video file
           av_close_input_file(pFormatCtx);

           return 0;
    }

    static void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame)
    {
       FILE *pFile;
       char szFilename[32];
       int  y;

       // Open file
       sprintf(szFilename, "frame%d.ppm", iFrame);
       pFile=fopen(szFilename, "wb");
       if(pFile==NULL)
           return;

       // Write header
       fprintf(pFile, "P6\n%d %d\n255\n", width, height);

       // Write pixel data
       for(y=0; ydata[0]+y*pFrame->linesize[0], 1, width*3, pFile);

       // Close file
       fclose(pFile);
    }
  • using ffmpeg to create a wavefile image from opus

    29 décembre 2015, par edwardsmarkf

    I have been trying to use ffmpeg to create a wavefile image from an opus file. so far i have found three different methods but cannot seem to determine which one is the best.

    The end result is hopefully to have a sound-wave that is only approx. 55px in height. The image will become part of a css background-image.

    Adapted from Generating a waveform using ffmpeg :

    ffmpeg -i file.opus -filter_complex
    "showwavespic,colorbalance=bs=0.5:gm=0.3:bh=-0.5,drawbox=x=(iw-w)/2:y=(ih-h)/2:w=iw:h=1:color=black@0.5"
    file.png

    which produces this image :
    enter image description here

    Next, I found this one (and my favorite because of the simplicity) :

    ffmpeg -i test.opus -lavfi showwavespic=split_channels=1:s=1024x800 test.png

    And here is what that one looks like :

    enter image description here

    Finally, this one from FFmpeg Wiki : Waveform, but it seems less efficient using a second utility (gnuplot) rather than just ffmpeg :

    ffmpeg -i file.opus -ac 1 -filter:a
    aresample=4000 -map 0:a -c:a pcm_s16le -f data - | \
    gnuplot -e "set
    terminal png size 525,050 ;set output
    ’file.png’ ;unset key ;unset tics ;unset border ; set
    lmargin 0 ;set rmargin 0 ;set tmargin 0 ;set bmargin 0 ; plot ’

    enter image description here

    Option two is my favorite, but i dont like the margins on the top and bottom of the waveforms.

    Option three (using gnuplot) makes the best ’shaped’ image for our needs, since the initial spike in sound seems to make the rest almost too small to use (lines tend to almost disappear) when the image is sized at only 50 pixels high.

    Any suggestions how might best approach this ? I really understand very little about any of the options I see, except of course for the size. Note too i have 10’s of thousands to process, so naturally i want to make a wise choice at the very beginning.

  • Embedding many small movies in page (gif vs mp4 vs webm vs ?)

    25 mars 2017, par genekogan

    I am making a webpage which will contain around 20-25 small-resolution ( 56x56) and short-length ( 3 sec) movies which will be set to autoplay and loop, so they will be looping on the page at all times. They are mostly dispersed throughout the page, so cannot easily be merged into bigger movies.

    I’m trying to decide on the right format to use, balancing filesize, quality, and processor overhead.

    mp4 seems the best option in terms of quality and filesize, however embedding many small mp4s on the page felt to me slow and made my computer get hot. Despite the fact that if they were one mp4, it would be only around 300x240 — it seems there is a lot of CPU overhead if they are divided.

    gif is lower quality and bigger filesize, but the CPU performance felt smoother. I can’t prove it though because I didn’t measure it — are gif’s known to be better performance than mp4 ?

    I have not tried other formats (webm, avi, ogg, etc) but I am unsure of how supported all of these formats are by most browsers and I want the webpage to be viewable from multiple browsers/countries.

    How can I determine the best format to use for these videos ? Is there a tool which can measure the CPU performance of my webpage so I can quantify the performance issues ?