Recherche avancée

Médias (91)

Autres articles (103)

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

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

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

Sur d’autres sites (7781)

  • avformat/mpegenc : Ensure packet queue stays valid

    15 février 2021, par Andreas Rheinhardt
    avformat/mpegenc : Ensure packet queue stays valid
    

    The MPEG-PS muxer uses a custom queue of custom packets. To keep track
    of it, it has a pointer (named predecode_packet) to the head of the
    queue and a pointer to where the next packet is to be added (it points
    to the next-pointer of the last element of the queue) ; furthermore,
    there is also a pointer that points into the queue (called premux_packet).

    The exact behaviour was as follows : If premux_packet was NULL when a
    packet is received, it is taken to mean that the old queue is empty and
    a new queue is started. premux_packet will point to the head of said
    queue and the next_packet-pointer points to its next pointer. If
    predecode_packet is NULL, it will also made to point to the newly
    allocated element.

    But if premux_packet is NULL and predecode_packet is not, then there
    will be two queues with head elements premux_packet and
    predecode_packet. Yet only elements reachable from predecode_packet are
    ever freed, so the premux_packet queue leaks.
    Worse yet, when the predecode_packet queue will be eventually exhausted,
    predecode_packet will be made to point into the other queue and when
    predecode_packet will be freed, the next pointer of the preceding
    element of the queue will still point to the element just freed. This
    element might very well be still reachable from premux_packet which
    leads to use-after-frees lateron. This happened in the tickets mentioned
    below.

    Fix this by never creating two queues in the first place by checking for
    predecode_packet to know whether the queue is empty. If premux_packet is
    NULL, then it is set to the newly allocated element of the queue.

    Fixes tickets #6887, #8188 and #8266.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

    • [DH] libavformat/mpegenc.c
  • 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.

    &#xA;&#xA;

    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.

    &#xA;&#xA;

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

    &#xA;&#xA;

    int encode_frame(uint8_t* rgb24Data)&#xA;{&#xA;    AVFrame *frame = av_frame_alloc();&#xA;    if (!frame)&#xA;        return COULD_NOT_ALLOCATE_FRAME;&#xA;&#xA;    frame->format = codec_context->pix_fmt;&#xA;    frame->width = codec_context->width;&#xA;    frame->height = codec_context->height;&#xA;&#xA;    int ret = av_image_alloc(frame->data, frame->linesize, codec_context->width, codec_context->height, codec_context->pix_fmt, 32);&#xA;    if (ret &lt; 0)&#xA;        return COULD_NOT_ALLOCATE_PIC_BUF;&#xA;&#xA;    SwsContext * ctx = sws_getContext(codec_context->width, codec_context->height,&#xA;        AV_PIX_FMT_RGB24, codec_context->width, codec_context->height,&#xA;        AV_PIX_FMT_YUV420P, 0, 0, 0, 0);&#xA;&#xA;&#xA;    uint8_t * inData[1] = { rgb24Data };&#xA;    int inLinesize[1] = { 3 * codec_context->width };&#xA;&#xA;    sws_scale(ctx, inData, inLinesize, 0, codec_context->height, frame->data, frame->linesize); // From RGB to YUV&#xA;&#xA;    frame->pts = frame_counter&#x2B;&#x2B;;&#xA;&#xA;    ret = avcodec_send_frame(codec_context, frame);&#xA;    if (ret &lt; 0)&#xA;        return ERROR_ENCODING_FRAME_SEND;&#xA;&#xA;    AVPacket pkt;&#xA;    av_init_packet(&amp;pkt);&#xA;    pkt.data = NULL;&#xA;    pkt.size = 0;&#xA;&#xA;    while (true)&#xA;    {&#xA;        ret = avcodec_receive_packet(codec_context, &amp;pkt);&#xA;        if (!ret)&#xA;        {&#xA;            if (pkt.pts != AV_NOPTS_VALUE)&#xA;                pkt.pts = av_rescale_q(pkt.pts, codec_context->time_base, video_st->time_base);&#xA;            if (pkt.dts != AV_NOPTS_VALUE)&#xA;                pkt.dts = av_rescale_q(pkt.dts, codec_context->time_base, video_st->time_base);&#xA;&#xA;            av_write_frame(outctx, &amp;pkt);&#xA;            av_packet_unref(&amp;pkt);&#xA;        }&#xA;        else if (ret == AVERROR(EAGAIN))&#xA;        {&#xA;            frame->pts = frame_counter&#x2B;&#x2B;;&#xA;            ret = avcodec_send_frame(codec_context, frame);&#xA;            if (ret &lt; 0)&#xA;                return ERROR_ENCODING_FRAME_SEND;&#xA;        }&#xA;        else if (ret &lt; 0)&#xA;            return ERROR_ENCODING_FRAME_RECEIVE;&#xA;        else&#xA;            break;&#xA;    }&#xA;&#xA;    // This one&#xA;    av_frame_free(&amp;frame);&#xA;}&#xA;

    &#xA;&#xA;

    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(&amp;frame);.

    &#xA;&#xA;

    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.".

    &#xA;&#xA;

    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.

    &#xA;&#xA;

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

    &#xA;&#xA;

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

    &#xA;&#xA;

    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.

    &#xA;

  • avformat_close_input memory leak ?

    20 janvier 2021, par Keen Jackdaw

    I developed an app to push live stream with ffmpeg. When I checked the app with leaks --atExit -- <the app="app"></the> (I'm on mac), I found some memory leak with AVFormatContext.

    &#xA;

    The minimized code are provided below :

    &#xA;

    #include <iostream>&#xA;&#xA;extern "C" {&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavdevice></libavdevice>avdevice.h>&#xA;}&#xA;&#xA;void foo() {&#xA;    avdevice_register_all();&#xA;&#xA;    AVFormatContext *avInputFormatContext = avformat_alloc_context();&#xA;    AVInputFormat *avInputFormat = av_find_input_format("avfoundation");&#xA;    std::cout &lt;&lt; "open input" &lt;&lt; std::endl;&#xA;    int ret = avformat_open_input(&amp;avInputFormatContext, "Capture screen 0", avInputFormat, nullptr);&#xA;    if (ret &lt; 0) { std::cout &lt;&lt; "open input failed: " &lt;&lt; ret &lt;&lt; std::endl; return;}&#xA;&#xA;    avformat_close_input(&amp;avInputFormatContext);&#xA;&#xA;}&#xA;&#xA;int main() {&#xA;    foo();&#xA;    return 0;&#xA;}&#xA;&#xA;</iostream>

    &#xA;

    The output is

    &#xA;

    Process:         ffmpegtest [87726]&#xA;Path:            /Users/USER/*/ffmpegtest&#xA;Load Address:    0x10a752000&#xA;Identifier:      ffmpegtest&#xA;Version:         ???&#xA;Code Type:       X86-64&#xA;Platform:        macOS&#xA;Parent Process:  leaks [87725]&#xA;&#xA;Date/Time:       2021-01-20 15:44:57.533 &#x2B;0800&#xA;Launch Time:     2021-01-20 15:44:55.760 &#x2B;0800&#xA;OS Version:      macOS 11.1 (20C69)&#xA;Report Version:  7&#xA;Analysis Tool:   /Applications/Xcode.app/Contents/Developer/usr/bin/leaks&#xA;Analysis Tool Version:  Xcode 12.3 (12C33)&#xA;&#xA;Physical footprint:         9.9M&#xA;Physical footprint (peak):  10.6M&#xA;----&#xA;&#xA;leaks Report Version: 4.0&#xA;Process 87726: 14143 nodes malloced for 2638 KB&#xA;Process 87726: 1 leak for 32 total leaked bytes.&#xA;&#xA;    1 (32 bytes) ROOT LEAK: 0x7f8c61e1b040 [32]  length: 16  "Capture screen 0"&#xA;

    &#xA;

    Did I miss something ?

    &#xA;