Recherche avancée

Médias (91)

Autres articles (97)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Possibilité de déploiement en ferme

    12 avril 2011, par

    MediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
    Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)

Sur d’autres sites (10650)

  • movenc : Allow to request not to use edit lists

    4 novembre 2014, par Martin Storsjö
    movenc : Allow to request not to use edit lists
    

    In this case, shift tracks to start from zero instead (potentially
    stretching the first sample in tracks that start later than the
    first one).

    Some software does not support edit lists at all, the adobe flash
    player seems to be one of these. This results in AV sync errors when
    edit lists are used to adjust AV sync.

    Some players, such as QuickTime, don’t respect the duration for
    audio packets, so if an audio track starts later than the video
    track and the first audio sample gets a duration longer than the
    actual amount of data in it, the result will be out of sync.

    Based on patches by Michael Niedermayer.

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DBH] libavformat/movenc.c
    • [DBH] libavformat/movenc.h
  • NodeJS/ffmpeg : Can't create screenshot of stream file

    11 septembre 2017, par user3142695

    I need to create a screenshot via ffmpeg (node-fluent-ffmpeg : https://github.com/fluent-ffmpeg/node-fluent-ffmpeg) of a stream, as my data is stored in a gridFS.

    This is how I’m doing that with a local file - and it works so far

    ffmpeg('/Users/Anybody/Downloads/1test.mp4')
     .on('error', (error) => {
       console.error(error)
     })
     .on('end', () => {
       console.log('Screenshots taken')
     })
     .screenshots({
       folder: '/Users/Anybody/Downloads/',
       timestamps: ['00:01.000']
     })

    But if I change the code to use a stream (gridfs-stream), no file is created, although the output gives me a successful message :

    import Grid from 'gridfs-stream'

    const gfs = Grid(
     MongoInternals.defaultRemoteCollectionDriver().mongo.db,
     MongoInternals.NpmModule
    )

    ffmpeg(gfs.createReadStream({ _id: sourceId }))
     .on('filenames', (filenames) => {
       console.log('Will generate ' + filenames.join(', '))
     })
     .on('codecData', (data) => {
       console.log('Input is ' + data.audio + ' audio ' + 'with ' + data.video + ' video')
     })
     .on('error', (error) => {
       console.error(error)
     })
     .on('end', () => {
       console.log('Screenshots taken')
     })
     .screenshots({
       folder: '/Users/Anybody/Downloads/',
       timestamps: ['00:01.000']
     })

    Output

    Will generate tn.png
    Input is aac (mp4a / 0x6134706D) audio with h264 (avc1 / 0x31637661) video
    Screenshots taken
  • Encoding a screenshot into a video using FFMPEG

    2 juillet 2013, par mohM

    I'm trying to get the pixels from the screen, and encode the screenshot into a video using ffmpeg. I've seen a couple of examples but they either assume you already have the pixel data, or use image file input. It seems like whether I use sws_scale() or not (which is included in the examples I've seen), or whether I'm typecasting a HBITMAP or RGBQUAD* it's telling me that the image src data is bad and is encoding a blank image rather than the screenshot. Is there something I'm missing here ?

    AVCodec* codec;
    AVCodecContext* c = NULL;
    AVFrame* inpic;
    uint8_t* outbuf, *picture_buf;
    int i, out_size, size, outbuf_size;
    HBITMAP hBmp;
    //int x,y;

    avcodec_register_all();

    printf("Video encoding\n");

    // Find the mpeg1 video encoder
    codec = avcodec_find_encoder(CODEC_ID_H264);
    if (!codec) {
       fprintf(stderr, "Codec not found\n");
       exit(1);
    }
    else printf("H264 codec found\n");

    c = avcodec_alloc_context3(codec);
    inpic = avcodec_alloc_frame();

    c->bit_rate = 400000;
    c->width = screenWidth;                                     // resolution must be a multiple of two
    c->height = screenHeight;
    c->time_base.num = 1;
    c->time_base.den = 25;
    c->gop_size = 10;                                           // emit one intra frame every ten frames
    c->max_b_frames=1;
    c->pix_fmt = PIX_FMT_YUV420P;
    c->codec_id = CODEC_ID_H264;
    //c->codec_type = AVMEDIA_TYPE_VIDEO;

    //av_opt_set(c->priv_data, "preset", "slow", 0);
    //printf("Setting presets to slow for performance\n");

    // Open the encoder
    if (avcodec_open2(c, codec,NULL) &lt; 0) {
       fprintf(stderr, "Could not open codec\n");
       exit(1);
    }
    else printf("H264 codec opened\n");

    outbuf_size = 100000 + 12*c->width*c->height;           // alloc image and output buffer
    //outbuf_size = 100000;
    outbuf = static_cast(malloc(outbuf_size));
    size = c->width * c->height;
    picture_buf = static_cast(malloc((size*3)/2));
    printf("Setting buffer size to: %d\n",outbuf_size);

    FILE* f = fopen("example.mpg","wb");
    if(!f) printf("x  -  Cannot open video file for writing\n");
    else printf("Opened video file for writing\n");

    /*inpic->data[0] = picture_buf;
    inpic->data[1] = inpic->data[0] + size;
    inpic->data[2] = inpic->data[1] + size / 4;
    inpic->linesize[0] = c->width;
    inpic->linesize[1] = c->width / 2;
    inpic->linesize[2] = c->width / 2;*/


    //int x,y;
    // encode 1 second of video
    for(i=0;itime_base.den;i++) {
       fflush(stdout);


       HWND hDesktopWnd = GetDesktopWindow();
       HDC hDesktopDC = GetDC(hDesktopWnd);
       HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);
       hBmp = CreateCompatibleBitmap(GetDC(0), screenWidth, screenHeight);
       SelectObject(hCaptureDC, hBmp);
       BitBlt(hCaptureDC, 0, 0, screenWidth, screenHeight, hDesktopDC, 0, 0, SRCCOPY|CAPTUREBLT);
       BITMAPINFO bmi = {0};
       bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
       bmi.bmiHeader.biWidth = screenWidth;
       bmi.bmiHeader.biHeight = screenHeight;
       bmi.bmiHeader.biPlanes = 1;
       bmi.bmiHeader.biBitCount = 32;
       bmi.bmiHeader.biCompression = BI_RGB;
       RGBQUAD *pPixels = new RGBQUAD[screenWidth*screenHeight];
       GetDIBits(hCaptureDC,hBmp,0,screenHeight,pPixels,&amp;bmi,DIB_RGB_COLORS);

    inpic->pts = (float) i * (1000.0/(float)(c->time_base.den))*90;
       avpicture_fill((AVPicture*)inpic, (uint8_t*)pPixels, PIX_FMT_BGR32, c->width, c->height);                   // Fill picture with image
       av_image_alloc(inpic->data, inpic->linesize, c->width, c->height, c->pix_fmt, 1);
       //printf("Allocated frame\n");
       //SaveBMPFile(L"screenshot.bmp",hBmp,hDc,screenWidth,screenHeight);
       ReleaseDC(hDesktopWnd,hDesktopDC);
       DeleteDC(hCaptureDC);
       DeleteObject(hBmp);

       // encode the image
       out_size = avcodec_encode_video(c, outbuf, outbuf_size, inpic);
       printf("Encoding frame %3d (size=%5d)\n", i, out_size);
       fwrite(outbuf, 1, out_size, f);
    }

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

       out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
       printf("Writing frame %3d (size=%5d)\n", i, out_size);
       fwrite(outbuf, 1, out_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(c);
    av_free(c);
    av_free(inpic);
    printf("Closed codec and Freed\n");