Recherche avancée

Médias (10)

Mot : - Tags -/wav

Autres articles (58)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • 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

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

Sur d’autres sites (8792)

  • How to access Nested structure member variables

    24 octobre 2013, par JAYANTHI

    I have an structure

    typedef struct AVFilter {

       const char *name;
       const char *description;
       const AVFilterPad *inputs;
       const AVFilterPad *outputs;
       const AVClass *priv_class;
       int flags;
       int (*init)(AVFilterContext *ctx);
       int (*init_dict)(AVFilterContext *ctx, AVDictionary **options);
       void (*uninit)(AVFilterContext *ctx);
       int (*query_formats)(AVFilterContext *);
       int priv_size;      
       struct AVFilter *next;
       int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
       int (*init_opaque)(AVFilterContext *ctx, void *opaque);

    } AVFilter;

    I dont knw how to access nested structure variables and my code is,

       AVFilter avfilter_vsrc_color = {
       avfilter_vsrc_color.name            = "color",
       avfilter_vsrc_color.description     = NULL_IF_CONFIG_SMALL("Provide an uniformly colored input."),
       avfilter_vsrc_color.priv_class      = &color_class, // error here
       avfilter_vsrc_color.priv_size       = sizeof(TestSourceContext),
       avfilter_vsrc_color.init            = color_init,
       avfilter_vsrc_color.uninit          = uninit,
       avfilter_vsrc_color.query_formats   = color_query_formats,
       avfilter_vsrc_color.inputs          = NULL,
       avfilter_vsrc_color.outputs         = color_outputs,
       avfilter_vsrc_color.process_command = color_process_command
    };

    I have compiled the code in vs2010 and I m Getting error like

    c:\users\awki6\desktop\ffmpeg\libavfilter\vsrc_testsrc.cpp(273): error C2440: 'initializing' : cannot convert from 'const AVClass *' to 'const AVFilterPad *'
    2>          Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
  • http: only send range header when necessary

    22 septembre 2012, par Duncan Salerno

    http: only send range header when necessary

  • FFmpeg, access violation on av_frame_free when running though Unity

    1er février 2021, par Mockarutan

    I'm working on a video recording plugin for Unity using ffmpeg. I'm new to the video encoding domain and just got my code to work today. But I think a might have a few memory leaks and trying to fix them crashes Unity.

    



    The plugin is written i c++ (as external "C" code) and imported in a c# script in unity with a simple DllImport. Again, this is not my comfort area either, but it works.

    



    When a screen buffer is rendered, I put in a RGB24 buffer and send it to my c++ function, this one :

    



    int encode_frame(uint8_t* rgb24Data)
{
    AVFrame *frame = av_frame_alloc();
    if (!frame)
        return COULD_NOT_ALLOCATE_FRAME;

    frame->format = codec_context->pix_fmt;
    frame->width = codec_context->width;
    frame->height = codec_context->height;

    int ret = av_image_alloc(frame->data, frame->linesize, codec_context->width, codec_context->height, codec_context->pix_fmt, 32);
    if (ret < 0)
        return COULD_NOT_ALLOCATE_PIC_BUF;

    SwsContext * ctx = sws_getContext(codec_context->width, codec_context->height,
        AV_PIX_FMT_RGB24, codec_context->width, codec_context->height,
        AV_PIX_FMT_YUV420P, 0, 0, 0, 0);


    uint8_t * inData[1] = { rgb24Data };
    int inLinesize[1] = { 3 * codec_context->width };

    sws_scale(ctx, inData, inLinesize, 0, codec_context->height, frame->data, frame->linesize); // From RGB to YUV

    frame->pts = frame_counter++;

    ret = avcodec_send_frame(codec_context, frame);
    if (ret < 0)
        return ERROR_ENCODING_FRAME_SEND;

    AVPacket pkt;
    av_init_packet(&pkt);
    pkt.data = NULL;
    pkt.size = 0;

    while (true)
    {
        ret = avcodec_receive_packet(codec_context, &pkt);
        if (!ret)
        {
            if (pkt.pts != AV_NOPTS_VALUE)
                pkt.pts = av_rescale_q(pkt.pts, codec_context->time_base, video_st->time_base);
            if (pkt.dts != AV_NOPTS_VALUE)
                pkt.dts = av_rescale_q(pkt.dts, codec_context->time_base, video_st->time_base);

            av_write_frame(outctx, &pkt);
            av_packet_unref(&pkt);
        }
        else if (ret == AVERROR(EAGAIN))
        {
            frame->pts = frame_counter++;
            ret = avcodec_send_frame(codec_context, frame);
            if (ret < 0)
                return ERROR_ENCODING_FRAME_SEND;
        }
        else if (ret < 0)
            return ERROR_ENCODING_FRAME_RECEIVE;
        else
            break;
    }

    // This one
    av_frame_free(&frame);
}


    



    Now, this code might have a lot of issues that I'm not aware of, and you are free to point them out if you like. But the line that gives me error is av_frame_free(&frame);.

    



    If I run this in a synthetic test app in c++ that I made, it works. I can even run it in a c# synthetic test app (exactly like the c++ one), and it works. But if I run it though Unity, it crashes on the first frame. The log says "Read from location fe7f8097 caused an access violation.".

    



    I have tried with av_freep() and av_free(). Not sure exactly what makes them different (different example codes use different ones), but none work.

    



    So, what I'm I missing ? The frame is leaking if I don't free it right ? But why does it crash in Unity ?

    



    The whole thing works great in Unity if I don't have the av_frame_free(&frame);. Resulting video looks great !

    



    PS. I'm aware (as far as I know) that the frame also leaks if something fails and returns an error code. But one thing at a time.