Recherche avancée

Médias (0)

Mot : - Tags -/tags

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

Autres articles (34)

  • 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 (5628)

  • ffmpeg record change color

    17 mars 2016, par Антон Михайлов

    Im try record video from screen, for write to video file im use ffmpeg(libavcodec). But on result i see other colors, my example :

    AVCodec *codec;
    AVCodecContext *c= NULL;
    AVStream *video_stream;
    AVOutputFormat *out;
    AVFormatContext *out_context;
    int i, ret, x, y, got_output;

    AVFrame *frame;
    AVPacket pkt;
    uint8_t endcode[] = { 0, 0, 1, 0xb7 };

    printf("Encode video file %s\n", filename);

    out = av_guess_format(NULL, filename, NULL);
    if (!out) {
       std::cout << "Could not deduce output format from file extension: using MPEG.\n" << filename << std::endl;
       out = av_guess_format("mpeg", filename, NULL);
    }

    if (!out) {
       std::cout << "Could not find suitable output format\n" << std::endl;
       return;
    }

    out->video_codec = (AVCodecID)codec_id;

    out_context = avformat_alloc_context();
    if (!out_context) {
       std::cout << "Memory error\n";
       return;
    }

    out_context->oformat = out;

    codec = avcodec_find_encoder((AVCodecID)codec_id);
    if (!codec) {
       fprintf(stderr, "Codec not found\n");
       exit(1);
    }

    video_stream = avformat_new_stream(out_context, codec);
    if (!video_stream) {
       std::cout << "Could not alloc stream\n";
       return;
    }

    c = video_stream->codec;
    if (!c) {
       fprintf(stderr, "Could not allocate video codec context\n");
       exit(1);
    }

    c->bit_rate = 20000000;

    c->width = rect_width;
    c->height = rect_height;

    c->time_base = (AVRational){1,25};
    c->gop_size = 10;
    c->max_b_frames = 1;
    c->pix_fmt = AV_PIX_FMT_YUV420P;

    if (codec_id == AV_CODEC_ID_H264)
       av_opt_set(c->priv_data, "preset", "slow", 0);

    if (avcodec_open2(c, codec, NULL) < 0) {
       fprintf(stderr, "Could not open codec\n");
       exit(1);
    }

    avio_open2(&out_context->pb, filename, AVIO_FLAG_WRITE, NULL, NULL );

    avformat_write_header(out_context, 0);

    frame = av_frame_alloc();
    if (!frame) {
       fprintf(stderr, "Could not allocate video frame\n");
       exit(1);
    }
    frame->format = c->pix_fmt;
    frame->width  = c->width;
    frame->height = c->height;

    ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height,
                        c->pix_fmt, 32);
    if (ret < 0) {
       fprintf(stderr, "Could not allocate raw picture buffer\n");
       exit(1);
    }

    fprintf(stderr, "*0\n");

    SwsContext *m_imageConvertContext = 0;

    fprintf(stderr, "*0.1\n");

    printf("size %3d %5d\n", rect_width, rect_height);

    if ((rect_width % 4 != 0 && rect_width % 8 != 0 && rect_width % 16 != 0)
           || (rect_height % 4 != 0 && rect_height % 8 != 0 && rect_height % 16 != 0)) {
       fprintf(stderr, "Video size dimensions must be multiple of 4,8 or 16.");
       return;
    }

    m_imageConvertContext = sws_getCachedContext(m_imageConvertContext, frame->width, frame->height,AV_PIX_FMT_0RGB32, frame->width, frame->height, c->pix_fmt, SWS_BILINEAR, NULL, NULL, NULL);

    fprintf(stderr, "*0.2\n");

    int pts = 0;

    for (i = 0; i < 25 * 20; i++) {

       QImage image = QGuiApplication::primaryScreen()->grabWindow(0, rect_x, rect_y, rect_width, rect_height).toImage().convertToFormat(QImage::Format_RGB32);


       pts ++;

       av_init_packet(&pkt);
       pkt.data = NULL;    // packet data will be allocated by the encoder
       pkt.size = 0;
       fflush(stdout);

       uint8_t *srcplanes[AV_NUM_DATA_POINTERS];
       srcplanes[0]=(uint8_t*)image.bits();
       srcplanes[1]=0;
       srcplanes[2]=0;
       srcplanes[3]=0;
       srcplanes[4]=0;
       srcplanes[5]=0;
       srcplanes[6]=0;
       srcplanes[7]=0;

       int srcstride[AV_NUM_DATA_POINTERS];
       srcstride[0]=image.bytesPerLine();
       srcstride[1]=0;
       srcstride[2]=0;
       srcstride[3]=0;
       srcstride[4]=0;
       srcstride[5]=0;
       srcstride[6]=0;
       srcstride[7]=0;

       int res = sws_scale(m_imageConvertContext, srcplanes, srcstride, 0,frame->height, frame->data, frame->linesize);

       frame->pts = pts;
       ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
       if (ret < 0) {
           fprintf(stderr, "Error encoding frame\n");
           exit(1);
       }
       if (got_output) {
           printf("Write frame %3d (size=%5d)\n", i, pkt.size);
           av_write_frame(out_context,&pkt);
           av_free_packet(&pkt);
       }
    }

    for (got_output = 1; got_output; i++) {
       fflush(stdout);
       ret = avcodec_encode_video2(c, &pkt, NULL, &got_output);
       if (ret < 0) {
           fprintf(stderr, "Error encoding frame\n");
           exit(1);
       }
       if (got_output) {
           printf("Write frame %3d (size=%5d)\n", i, pkt.size);
           av_interleaved_write_frame(out_context, &pkt);
           av_free_packet(&pkt);
       }
    }

    av_write_trailer(out_context);
    avio_close(out_context->pb);
    avcodec_close(c);

    av_free(c);
    av_freep(&frame->data[0]);
    av_frame_free(&frame);

    resolution 1920x1080. On original display look this http://joxi.ru/p27bbn6u093elm

    on save video colors is a dimmer http://joxi.ru/YmE99W1fZvbdWm

    It seems, white background color changes to gray. Or may be it is brightness. What im do is wrong ? How i can save to color ?

    UDP

    im try use

    int *inv_table, srcRange, *table, dstRange , brightness, contrast, saturation;

    int ret = sws_getColorspaceDetails(m_imageConvertContext, &inv_table, &srcRange, &table, &dstRange, &brightness, &contrast, &saturation);

    sws_setColorspaceDetails(m_imageConvertContext, sws_getCoefficients(SWS_CS_DEFAULT), srcRange, sws_getCoefficients(SWS_CS_ITU709), dstRange, brightness, contrast, saturation);

    but this is never change

  • lavfi/vf_ssim : add warning when color ranges differ

    1er avril 2023, par Chema Gonzalez
    lavfi/vf_ssim : add warning when color ranges differ
    

    The SSIM filter uses the pixel values without considering
    the color ranges. This is incorrect. Patch adds a warning
    so at least the user knows it.

    Let's see an example.

    (1) Let's get FR and LR versions of the same image.

    ```
    $ ffmpeg -y -i /tmp/lena.490x490.ppm -vf scale="out_range=full" -pix_fmt yuv420p /tmp/lena.full.y4m
    $ xxd /tmp/lena.full.y4m |head
    00000000 : 5955 5634 4d50 4547 3220 5734 3930 2048 YUV4MPEG2 W490 H
    00000010 : 3439 3020 4632 353a 3120 4970 2041 303a 490 F25:1 Ip A0 :
    00000020 : 3020 4334 3230 6a70 6567 2058 5953 4353 0 C420jpeg XYSCS
    00000030 : 533d 3432 304a 5045 4720 5843 4f4c 4f52 S=420JPEG XCOLOR
    00000040 : 5241 4e47 453d 4655 4c4c 0a46 5241 4d45 RANGE=FULL.FRAME
    00000050 : 0a72 7271 7070 706f 6f6e 6d6d 6c6d 6d6d .rrqpppoonmmlmmm
    00000060 : 6c6e 6e6d 6d6e 6e6e 6d6c 6d6d 6d6d 6d6d lnnmmnnnmlmmmmmm
    00000070 : 6d6e 6d6b 6c6d 6e6e 6d6c 6d6d 6e6e 6f6f mnmklmnnmlmmnnoo
    00000080 : 6f6f 6e6e 6e6e 6f70 7172 7375 7676 7370 oonnnnopqrsuvvsp
    00000090 : 6d69 6662 5e59 534d 4845 3d35 302e 2d2c mifb^YSMHE=50.-,
    ```

    ```
    $ ffmpeg -y -i /tmp/lena.490x490.ppm -vf scale="out_range=limited" -pix_fmt yuv420p /tmp/lena.limited.y4m
    $ xxd /tmp/lena.limited.y4m | head
    00000000 : 5955 5634 4d50 4547 3220 5734 3930 2048 YUV4MPEG2 W490 H
    00000010 : 3439 3020 4632 353a 3120 4970 2041 303a 490 F25:1 Ip A0 :
    00000020 : 3020 4334 3230 6a70 6567 2058 5953 4353 0 C420jpeg XYSCS
    00000030 : 533d 3432 304a 5045 4720 5843 4f4c 4f52 S=420JPEG XCOLOR
    00000040 : 5241 4e47 453d 4c49 4d49 5445 440a 4652 RANGE=LIMITED.FR
    00000050 : 414d 450a 7272 7170 7070 6f6f 6e6e 6e6d AME.rrqpppoonnnm
    00000060 : 6e6e 6e6d 6f6e 6e6e 6e6e 6e6e 6d6e 6e6e nnnmonnnnnnnmnnn
    00000070 : 6e6e 6e6e 6f6e 6c6d 6e6f 6e6e 6d6e 6e6f nnnnonlmnonnmnno
    00000080 : 6f6f 6f6f 6f6f 6f6f 6f6f 7071 7273 7576 oooooooooopqrsuv
    00000090 : 7673 706e 6a68 6461 5c57 524e 4b44 3d39 vspnjhda\WRNKD=9
    ```

    Note that the 2x images are the same. Only difference is the range,
    and the precision issues related to range conversion.

    (2) Let's calculate the SSIM score :
    ```
    $ ./ffmpeg -filter_threads 1 -filter_complex_threads 1 -i /tmp/lena.full.y4m -i /tmp/lena.limited.y4m -lavfi "ssim" -f null -
    ...
    [Parsed_ssim_0 @ 0x360ab00] SSIM Y:0.942347 (12.391801) U:0.995808 (23.776062) V:0.996104 (24.093747) All:0.960217 (14.003012)
    ```

    As we are comparing an image with itself, we expect "Y : 1" as the
    luma SSIM. Issue here is that the SSIM filter just uses the pixel
    values, ignoring the color ranges.

    Proposed solution is to add a warning.
    ```
    $ ./ffmpeg -filter_threads 1 -filter_complex_threads 1 -i /tmp/foo.full.y4m -i /tmp/foo.limited.y4m -lavfi "ssim" -f null -
    ...
    [Parsed_ssim_0 @ 0x3766280] master and reference frames use different color ranges (pc != tv)
    ...
    [Parsed_ssim_0 @ 0x3766280] SSIM Y:0.000000 (0.000000) U:0.000000 (0.000000) V:0.000000 (0.000000) All:0.000000 (0.000000)
    ```

    Tested :

    Ran fate.
    ```
    $ make fate -j
    ...
    TEST seek-lavf-ppmpipe
    TEST seek-lavf-pgmpipe
    TEST seek-lavf-mxf_opatom
    ```

    • [DH] libavfilter/vf_ssim.c
  • vf_colorspace : Interpret unspecified color range as limited range

    19 septembre 2016, par Vittorio Giovara
    vf_colorspace : Interpret unspecified color range as limited range
    

    This is the assumption that is made in pixel format conversion do
    throughout the code (in particular swscale), and BT-specifications
    mandate.

    Add a warning to inform the user that an automatic selection is being
    made.

    Signed-off-by : Vittorio Giovara <vittorio.giovara@gmail.com>
    Signed-off-by : Ronald S. Bultje <rsbultje@gmail.com>

    • [DH] libavfilter/vf_colorspace.c