Recherche avancée

Médias (0)

Mot : - Tags -/interaction

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (39)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (6657)

  • Nodejs - Using ffmpeg with video thumbnails

    8 mars 2016, par RunningFromShia

    I am pretty much lost within the concept of ffmpeg and nodejs. ffmpeg is supposed to do important conversion work, that I get, but every time I try to implement a nodejs package with ffmpeg it just fails. I will give an example :

    using this for example in my app :
    https://www.npmjs.com/package/video-thumb

    my app.js :

    var express = require('express');
    var app = express();    

    var thumbler = require('video-thumb');

    thumbler.extract('http://www.w3schools.com/html/mov_bbb.mp4', 'snapshot.png', '00:00:1', '200x125', function(){

       console.log('snapshot saved to snapshot.png (200x125) with a frame at 00:00:1');

    });

    var port = process.env.PORT || 1337;

    app.listen(port);  

    Basically, I’ve tried a couple of nodejs packages that turn a snapshot out of a given video, and then save it to my server. each attempt failed. they all use ffmpeg. the above is just one of them.

    Now, I put a ffmpeg.exe in my root folder, I am just not sure where it’s supposed to be or how to use it with node. Needless to say, the above example doesn’t do anything. Tutorials online only show how to convert a certain video to a certain format in windows using ffmpeg, there is nothing about nodejs.
    I’d like some guidance here, thank you for your time.

  • Access Violation at avcodec_encode_video2()

    23 mars 2016, par bot1131357

    I am trying to understand the FFmpeg API by following online examples available but it seems that the FFmpeg API has changed over time, making most of the examples obsolete ; I hope some of you can help me make more sense of the FFmpeg API examples.

    I am currently trying to understand the encoding-example from FFmpeg, but I am getting an Access Violation error at this line :

    out_size = avcodec_encode_video2(codecCtx, &avpkt, picture, &got_packet);

    where I get "Unhandled exception at 0x77c29e42 in test01_encode.exe : 0xC0000005 : Access violation reading location 0xccccccc8." from Visual Studio.

    I understand that avcodec_encode_video() is deprecated in favour of avcodec_encode_video2(), which uses AVPacket. I’ve allocated a buffer to data member of AVPacket and set its size, but still the same. What did I miss ?

    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.

    (Side : What does it mean by "get delayed frames" and why are we encoding by specifying AVFrame* parameter as NULL ?)

    /*
    * Video encoding example
    */
    char filename[] = "test.mpg";
    int main(int argc, char** argv)
    {
       AVCodec *codec;
       AVCodecContext *codecCtx= NULL;
       int i, out_size, size, x, y, outbuf_size;
       FILE *f;
       AVFrame *picture;
       uint8_t *outbuf, *picture_buf;

       printf("Video encoding\n");

       // Register all formats and codecs
       av_register_all();

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

       codecCtx= avcodec_alloc_context3(codec);
       picture= av_frame_alloc();

       /* put sample parameters */
       codecCtx->bit_rate = 400000;
       /* resolution must be a multiple of two */
       codecCtx->width = 352;
       codecCtx->height = 288;
       /* frames per second */
       //codecCtx->time_base= (AVRational){1,25};
       codecCtx->time_base.num = 1;
       codecCtx->time_base.den = 25;

       codecCtx->gop_size = 10; /* emit one intra frame every ten frames */
       codecCtx->max_b_frames=1;
       codecCtx->pix_fmt = AV_PIX_FMT_YUV420P;

       /* open it */
       if (avcodec_open2(codecCtx, codec, NULL) < 0) {
           fprintf(stderr, "could not open codec\n");
           exit(1);
       }

       fopen_s(&f,filename, "wb");
       if (!f) {
           fprintf(stderr, "could not open %s\n", filename);
           exit(1);
       }

       /* alloc image and output buffer */
       outbuf_size = 100000;
       outbuf = (uint8_t*) malloc(outbuf_size);
       size = codecCtx->width * codecCtx->height;
       picture_buf = (uint8_t*) malloc((size * 3) / 2); /* size for YUV 420 */

       picture->data[0] = picture_buf;
       picture->data[1] = picture->data[0] + size;
       picture->data[2] = picture->data[1] + size / 4;
       picture->linesize[0] = codecCtx->width;
       picture->linesize[1] = codecCtx->width / 2;
       picture->linesize[2] = codecCtx->width / 2;

       picture->width = codecCtx->width;
       picture->height = codecCtx->height;
       picture->format = codecCtx->pix_fmt;

       AVPacket avpkt;
       int got_packet;

       avpkt.size=av_image_get_buffer_size(codecCtx->pix_fmt, codecCtx->width,
                       codecCtx->height,1);    
       avpkt.data = (uint8_t *)av_malloc(avpkt.size*sizeof(uint8_t));

       /* encode 1 second of video */
       for(i=0;i<25;i++) {
           fflush(stdout);
           /* 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;
               }
           }

           /* encode the image */
           //out_size = avcodec_encode_video(codecCtx, outbuf, outbuf_size, picture);
           // <access violation="violation">
           out_size = avcodec_encode_video2(codecCtx, &amp;avpkt, picture, &amp;got_packet);
           printf("encoding frame %3d (size=%5d)\n", i, out_size);
           //fwrite(outbuf, 1, out_size, f);
           fwrite(avpkt.data, 1, avpkt.size, f);
       }

       /* get the delayed frames */
       for(; out_size; i++) {
           fflush(stdout);

           //out_size = avcodec_encode_video(codecCtx, outbuf, outbuf_size, NULL);
           out_size = avcodec_encode_video2(codecCtx, &amp;avpkt, NULL, &amp;got_packet);
           printf("write frame %3d (size=%5d)\n", i, out_size);
           //fwrite(outbuf, 1, out_size, f);
           fwrite(avpkt.data, 1, avpkt.size, f);
       }

       /* add sequence end code to have a real mpeg file */
       outbuf[0] = 0x00;
       outbuf[1] = 0x00;
       outbuf[2] = 0x01;
       outbuf[3] = 0xb7;
       fwrite(outbuf, 1, 4, f);
       fclose(f);
       free(picture_buf);
       free(outbuf);

       avcodec_close(codecCtx);
       av_free(codecCtx);
       av_free(picture);
       printf("\n");
    }
    </access>
  • java bufferedimage array data immediately changes

    26 mars 2016, par ken
       import javax.imageio.ImageIO;

       import org.bytedeco.javacv.FFmpegFrameGrabber;

       public class FrameData
       {  
    int count = 0;
    int picWidth;
    int picHeight;

    BufferedImage img = null;

    //GET FRAME COUNT
    public int gf_count(int numofFrames, BufferedImage[] frameArray, String fileLocationsent, String videoNamesent) throws IOException
    {        
       String fileLocation = fileLocationsent;
       String videoName = videoNamesent;

       int frameNums = numofFrames;
       int totFrames = 0;

               FFmpegFrameGrabber grab = new FFmpegFrameGrabber(fileLocation + videoName);

           try {   grab.start(); }
           catch (Exception e) {   System.out.println("Unable to grab frames");  }

                       for(int i = 0 ; i &lt; frameNums  ; i++)
           {
               try
               {                  
                   frameArray[i]= grab.grab().getBufferedImage();
                   totFrames = i;  
                   File outputfile = new File(fileLocation + "GrayScaledImage" + i + ".jpg");
                   ImageIO.write(frameArray[i], "jpg", outputfile);
               }
               catch (Exception e) {   /*e.printStackTrace();*/    }
           }//END for

                   return totFrames;

       }//END METHOD long getFrameCount()

    Hope someone can explain this to me...
    I am just learning java so here goes...
    I wrote this code to count the number of frames in a .mov file and to test my buffered image array I generated files of the images. As the code is, it works as planned... The problem is immediately after the capturing, if I send the bufferedimages out as files, they all seem to be just the first image. see example below...

       for(int i = 0 ; i &lt; frameNums  ; i++)
           {
               try
               {                  
                   frameArray[i]= grab.grab().getBufferedImage();
                   totFrames = i;  
                   File outputfile = new File(fileLocation + "GrayScaledImage" + i + ".jpg");
                   ImageIO.write(frameArray[i], "jpg", outputfile);
               }
               catch (Exception e) {   /*e.printStackTrace();*/    }
           }//END for

    And now if I change that to...

       for(int i = 0 ; i &lt; frameNums  ; i++)
           {
               try
               {                  
                   frameArray[i]= grab.grab().getBufferedImage();
                   totFrames = i;  catch (Exception e) {   /*e.printStackTrace();*/    }}
       for(int j = 0; j &lt; frameNums; j++)
       {
       File outputfile = new File(fileLocation + "GrayScaledImage" + j + ".jpg");
                   ImageIO.write(frameArray[j], "jpg", outputfile);
       }

    I don’t understand why I am getting the same image repeatedly.
    If further information Is required, just lemme know, this is my first programming question online... Usually find what I am looking for that others have asked. Couldn’t find this one.
    Thanks for your time
    Ken