Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (63)

  • L’utiliser, en parler, le critiquer

    10 avril 2011

    La première attitude à adopter est d’en parler, soit directement avec les personnes impliquées dans son développement, soit autour de vous pour convaincre de nouvelles personnes à l’utiliser.
    Plus la communauté sera nombreuse et plus les évolutions seront rapides ...
    Une liste de discussion est disponible pour tout échange entre utilisateurs.

  • Les statuts des instances de mutualisation

    13 mars 2010, par

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

  • MediaSPIP Init et Diogène : types de publications de MediaSPIP

    11 novembre 2010, par

    À l’installation d’un site MediaSPIP, le plugin MediaSPIP Init réalise certaines opérations dont la principale consiste à créer quatre rubriques principales dans le site et de créer cinq templates de formulaire pour Diogène.
    Ces quatre rubriques principales (aussi appelées secteurs) sont : Medias ; Sites ; Editos ; Actualités ;
    Pour chacune de ces rubriques est créé un template de formulaire spécifique éponyme. Pour la rubrique "Medias" un second template "catégorie" est créé permettant d’ajouter (...)

Sur d’autres sites (7078)

  • OpenCV VideoCapture can't read from stream

    18 décembre 2018, par Josep Valls

    I can open a stream in VLC but in OpenCV I cannot capture frames. (Python 2.7, OpenCV 3.4.3 binary distribution x86, Windows 10). I’ve been following this guide : https://medium.com/@tomgrek/hackers-guide-to-the-aws-deeplens-1b8281bc6e24 but I cannot seem to read from random streams online (not sure whether I should be able to, I saw this question opencv videocapture can’t open MJPEG stream about compiling with ffmpeg but I just downloaded the binary available in Sourceforge).

    • I am using an AWS Deeplens, updated to the latest version.

    • Installed ffmpeg, latest version.

    Then, in /etc/ffserver.conf I added :

    <stream>
    File "/opt/awscam/out/ch1_out.h264"
    VideoFrameRate 6
    VideoSize 320x240
    NoAudio
    </stream>

    <stream>
    File "/opt/awscam/out/ch2_out.mjpeg"
    VideoFrameRate 3
    VideoSize 640x480
    Format mjpeg
    NoAudio
    </stream>
    • I start ffserver -f /etc/ffserver.conf
    • On my Windows machine, I use WSL and open an SSH tunnel into the AWS Deeplens ssh -L 8090:localhost:8090 aws_cam@192.168.0.10
    • At this point, in my Windows machine I can open VLC and if I point to http://localhost:8090/camera.mjpeg I can see the stream from the camera.

    But if I run the following code :

    cam = cv2.VideoCapture("http://localhost:8090/camera.mjpeg")
    success, frame = cam.read()
    opened = cam.isOpened()
    success, frame, opened

    I get :

    False, None, False

    If I browse to http://localhost:8090/stat.html, I see :

    Available Streams
    Path    Served Conns     bytes  Format  Bit rate kbits/s    Video kbits/s   Codec   Audio kbits/s    Codec  Feed
    test1.mpg   0   0   mpeg    96  64  mpeg1video  32  mp2 feed1.ffm
    test.asf    0   0   asf_stream  320 256 msmpeg4 64  wmav2   feed1.ffm
    stat.html   17  42150   -   -   -       -  
    index.html  0   0   -   -   -       -  
    camera.h264 3   6805k   h264    0   0   libx264 0       /opt/awscam/out/ch1_out.h264
    camera.mjpeg    12  41073k  mjpeg   0   0   mjpeg   0       /opt/awscam/out/ch2_out.mjpeg

    And every time I call VideoCapture() I see how the number of Served for the camera.mjpeg stream increased by a 2 or 3 and the bytes, increases a few megabytes but I don’t see anything in OpenCV. I have not tried any other video device in my Windows 10 but I can read images no problem. I also tried a random stream online, also opens in VLC but not in OpenCV, tried this one : http://136.176.70.200/mjpg/video.mjpg

    Any ideas ?

  • ffmpeg memory leak when opening libx264 encoder

    18 octobre 2023, par ksb496

    I have spotted a memory leak issue when I use the libx264 encoder in the FFmpeg C API. Specifically, when it comes to deallocate memory after encoding a video. After tracking the factor that causes it, I realized that it happens after invoking avcodec_open2, which allocates some memory that afterwards cannot be freed. Once the video is processed, calling avcodec_close and then avcodec_free_context does not entirely free all the allocated memory.

    &#xA;

    After some investigation, I found out that the problem could be located in AVCodecContext::priv_data being allocated but not being freed afterwards. In this question a solution to the issue is proposed. However, I tried to implement it without success (the memory being leaked seems to be exactly the same).

    &#xA;

    As a matter of fact, the following simple code (which includes the patch that was proposed in the aforementioned question), in which the codec is being opened and closed multiple times without even writing a single frame or allocating an AVFormatContext, illustrates the memory leak.

    &#xA;

    #include &#xA;extern "C"{&#xA;#include &#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    avcodec_register_all();&#xA;&#xA;    AVCodec *codec;&#xA;    AVCodecContext *c;&#xA;    for (int n=0; n&lt;2000; n&#x2B;&#x2B;)&#xA;    {&#xA;        codec = avcodec_find_encoder_by_name("libx264");&#xA;        c=avcodec_alloc_context3(codec);&#xA;        c->pix_fmt=AV_PIX_FMT_YUV420P;&#xA;        c->width=1920;&#xA;        c->height=1080;&#xA;        c->time_base=(AVRational){1, 30};&#xA;        c->framerate=(AVRational){30, 1};&#xA;        avcodec_open2(c, codec, NULL);&#xA;        avcodec_close(c);&#xA;        av_opt_free(c->priv_data);&#xA;        av_freep(&amp;c->priv_data);&#xA;        avcodec_free_context(&amp;c);&#xA;    }&#xA;    return 0;&#xA;}&#xA;

    &#xA;

    It must be remarked that if the line codec = avcodec_find_encoder_by_name("libx264") is replaced to an invocation to an internal/native encoder, e.g., codec = avcodec_find_encoder(AV_CODEC_ID_MPEG4), then the memory leak issue completely disappears. Hence, it certainly seems to be an issue related to some private data of the external encoder not being properly freed.

    &#xA;

    It is also worth mentioning that I am using an old version of ffmpeg and libx264. To be more precise, ffmpeg version 2.8git and libx264 version 0.136.x. For technical reasons that are beyond the scope of this question, it is not possible to upgrade the libraries to newer versions onto the project in which these are being used. I am fully aware that most of the involved ffmpeg/libx264 code has been probably changed along the years and many functions became deprecated or fixed, and thus reporting this as a possible bug in the ffmpeg developer's mailbox is out of the question.

    &#xA;

    Nevertheless, I am still asking this here because I would like to know whether it is just some mistake on my end and/or something I am not taking into account when it comes to free all the memory relative to an external encoder (best case scenario). Otherwise, I would like to know whether there can be some reasonably cheap solution through some custom code or function that can be implemented as a patch (assuming it is indeed an issue related to ffmpeg/libx264), no matter if it makes the whole deallocation code less elegant or concise. If someone is still working on these older versions of ffmpeg and can come up with a workaround, that would be highly appreciated.

    &#xA;

  • ffmpeg memory leak when opening libx264 encoder

    18 octobre 2023, par ksb496

    I have spotted a memory leak issue when I use the libx264 encoder in the FFmpeg C API. Specifically, when it comes to deallocate memory after encoding a video. After tracking the factor that causes it, I realized that it happens after invoking avcodec_open2, which allocates some memory that afterwards cannot be freed. Once the video is processed, calling avcodec_close and then avcodec_free_context does not entirely free all the allocated memory.

    &#xA;

    After some investigation, I found out that the problem could be located in AVCodecContext::priv_data being allocated but not being freed afterwards. In this question a solution to the issue is proposed. However, I tried to implement it without success (the memory being leaked seems to be exactly the same).

    &#xA;

    As a matter of fact, the following simple code (which includes the patch that was proposed in the aforementioned question), in which the codec is being opened and closed multiple times without even writing a single frame or allocating an AVFormatContext, illustrates the memory leak.

    &#xA;

    #include &#xA;extern "C"{&#xA;#include &#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    avcodec_register_all();&#xA;&#xA;    AVCodec *codec;&#xA;    AVCodecContext *c;&#xA;    for (int n=0; n&lt;2000; n&#x2B;&#x2B;)&#xA;    {&#xA;        codec = avcodec_find_encoder_by_name("libx264");&#xA;        c=avcodec_alloc_context3(codec);&#xA;        c->pix_fmt=AV_PIX_FMT_YUV420P;&#xA;        c->width=1920;&#xA;        c->height=1080;&#xA;        c->time_base=(AVRational){1, 30};&#xA;        c->framerate=(AVRational){30, 1};&#xA;        avcodec_open2(c, codec, NULL);&#xA;        avcodec_close(c);&#xA;        av_opt_free(c->priv_data);&#xA;        av_freep(&amp;c->priv_data);&#xA;        avcodec_free_context(&amp;c);&#xA;    }&#xA;    return 0;&#xA;}&#xA;

    &#xA;

    It must be remarked that if the line codec = avcodec_find_encoder_by_name("libx264") is replaced to an invocation to an internal/native encoder, e.g., codec = avcodec_find_encoder(AV_CODEC_ID_MPEG4), then the memory leak issue completely disappears. Hence, it certainly seems to be an issue related to some private data of the external encoder not being properly freed.

    &#xA;

    It is also worth mentioning that I am using an old version of ffmpeg and libx264. To be more precise, ffmpeg version 2.8git and libx264 version 0.136.x. For technical reasons that are beyond the scope of this question, it is not possible to upgrade the libraries to newer versions onto the project in which these are being used. I am fully aware that most of the involved ffmpeg/libx264 code has been probably changed along the years and many functions became deprecated or fixed, and thus reporting this as a possible bug in the ffmpeg developer's mailbox is out of the question.

    &#xA;

    Nevertheless, I am still asking this here because I would like to know whether it is just some mistake on my end and/or something I am not taking into account when it comes to free all the memory relative to an external encoder (best case scenario). Otherwise, I would like to know whether there can be some reasonably cheap solution through some custom code or function that can be implemented as a patch (assuming it is indeed an issue related to ffmpeg/libx264), no matter if it makes the whole deallocation code less elegant or concise. If someone is still working on these older versions of ffmpeg and can come up with a workaround, that would be highly appreciated.

    &#xA;