Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (95)

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

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (9613)

  • FFmpeg avcodec_encode_video2 access violation

    28 février 2016, par JustPingo

    I’ve been trying to encode a frame using FFmpeg with Visual C++. Here is how I do it.
    I first have a planar RGB24 image buffer. I convert it to planar YUV using the following rule :

    Y = ((66 * R + 129 * G + 25 * B + 128) >> 8) + 16;
    U = ((-38 * R - 74 * G + 112 * B + 128) >> 8) + 128;
    V = ((112 * R - 94 * G - 18 * B + 128) >> 8) + 128;

    I implemented it like this :

    void rgb8toYuv(uchar* rgb, uchar* yuv, uint pixelAmount) {
       uchar r, g, b;
       for (uint i = 0; i < pixelAmount; i++) {
           r = rgb[3 * i];
           g = rgb[3 * i + 1];
           b = rgb[3 * i + 2];
           yuv[3 * i] = ((66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
           yuv[3 * i + 1] = ((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
           yuv[3 * i + 2] = ((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
       }
    }

    I open everything like this (I’m using malloc because I’m used to it in C and it’s my first C++ program, I guess it shouldn’t cause any problem ?) :

    AVCodec* codec = avcodec_find_encoder(AV_CODEC_ID_H264);
    AVFormatContext* outContext;
    avformat_alloc_output_context2(&outContext, NULL, "mp4", filepath);

    AVStream* video = avformat_new_stream(outContext, codec);
    video->codec->bit_rate = VIDEOBITRATE;
    video->codec->width = VIDEOWIDTH;
    video->codec->height = VIDEOHEIGHT;
    video->time_base = fps;
    video->codec->gop_size = 10;
    video->codec->max_b_frames = 1;
    video->codec->pix_fmt = AV_PIX_FMT_YUV420P;
    video->codec->codec_id = AV_CODEC_ID_H264;
    video->codec->codec_type = AVMEDIA_TYPE_VIDEO;

    avio_open(&outContext->pb, filepath, AVIO_FLAG_READ_WRITE);
    avformat_write_header(outContext, NULL);

    AVFrame* frame = av_frame_alloc();
    frame->width = VIDEOWIDTH;
    frame->height = VIDEOHEIGHT;
    frame->format = AV_PIX_FMT_YUV420P;

    Then, here is the function I use to encode a frame :

    void encodeFrame(uint currentFrame, uchar* data) { // RGB data
       uchar* yuvData = (uchar*) malloc(videoWidth * videoHeight * 3);
       rgb8toYuv(data, yuvData, videoWidth * videoHeight);
       av_image_fill_arrays(frame->data, frame->linesize, yuvData, AV_PIX_FMT_YUV420P, videoWidth, videoHeight, 3); // I'm not sure about that 3, I couldn't find any documentation about it

       AVPacket* packet = (AVPacket*) malloc(sizeof(AVPacket));
       memset(packet, 0, sizeof(AVPacket));
       av_init_packet(packet);
       packet->data = NULL;
       packet->size = 0;

       frame->pts = currentFrame; // I don't know if this is corrrect too
       avcodec_encode_video2(video->codec, packet, frame, NULL);
       av_interleaved_write_frame(outContext, packet);
       av_packet_unref(packet);

       free(yuvData);
       free(packet);
    }

    However, this causes an Access violation writing location 0x00000000 on avcodec_encode_video2. I checked the errors returned by every of FFmpeg’s functions, and it seems like they all work except av_image_fill_arrays that returns a weird 1382400 error, although according to the debugger’s RAM-viewing tool, everything gets filled correctly.

    It seems like avcodec_encode_video2 tries to access a NULL object that shouldn’t be, however I can’t find what it could be, as I followed a lot of sources example, and I don’t know what I did wrong.

    Thanks in advance !

    EDIT : After applying the fix suggested by Edgar Rokyan (which is setting the 4th argument to an int pointer), I now get an access violation on 0x00000024, still with avformat_alloc_output_context2. I believe the problem is similar, but I still can’t find anything.

  • FFMPEG / libav : How is UYVY422 written inside AVFrame structure ?

    26 avril 2016, par Sir DrinksCoffeeALot

    I’m trying to copy frame data from AVFrame structure to a buffer. I know how to do that with YUV420P format since Y data is stored inside AVFrame frame->data[0], U data is stored inside AVFrame frame->data[1] and V data is stored inside AVFrame frame->data[2], so it was easy to memcpy() Y,U and V data separately + it’s planar format so i was able to do that with ease :

    for (y = 0; y < height; y++)
       {
           memcpy(buffer + y*frame->linesize[0], frame->data[0] + y*frame->linesize[0], width);
       }

       buffer += ySize;

       for (y = 0; y < height / 2; y++)
       {
           memcpy(buffer + y*frame->linesize[1], frame->data[1] + y*frame->linesize[1], width / 2);
       }

       buffer += uSize;

       for (y = 0; y < height / 2; y++)
       {
           memcpy(buffer + y*frame->linesize[2], frame->data[2] + y*frame->linesize[2], width / 2);
       }

    But when it comes to UYVY422 i have no idea how the data is stored inside the structure. I have general knowledge about UYVY422 format and that it’s written like it name suggests UYVYUYVYUYVY... and so on. But my question is how do i know how much data is stored in AVFrame frame->data[0], AVFrame frame->data[1] and AVFrame frame->data[2] field so i can memcpy() exact amount to the buffer ?

  • avcodec/v4l2_buffers : Add handling for NV21 and YUV420P

    22 mars 2018, par Dave Stevenson
    avcodec/v4l2_buffers : Add handling for NV21 and YUV420P
    

    The single planar support was for NV12 only.
    Add NV21 and YUV420P support.

    Signed-off-by : Aman Gupta <aman@tmm1.net>

    • [DH] libavcodec/v4l2_buffers.c