Recherche avancée

Médias (0)

Mot : - Tags -/flash

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

Autres articles (59)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (6369)

  • Memory leak using ffmpeg library when extracting video frames [closed]

    23 février 2024, par Andy C

    I'm working on some code to extract and process image frames from video files. However the extraction loop seems to leak several hundreds of megabytes for each video processed. Initially I thought it was my frame processing code that was the culprit, but on commenting it out, the memory leak still occurs.

    


    The following code reproduces the problem on Windows 11. It leaks approximately 200MB of memory processing a 20 minute SD video.

    


    #include <iostream>&#xA;#include <fstream>&#xA;extern "C"&#xA;{&#xA;    #include <libavcodec></libavcodec>avcodec.h>&#xA;    #include <libavformat></libavformat>avformat.h>&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    const char* inputFileName = R"(inputVideo.mkv)";&#xA;&#xA;    AVFormatContext* pFormatCtx = avformat_alloc_context();&#xA;    if (avformat_open_input(&amp;pFormatCtx, inputFileName, nullptr, nullptr) != 0)&#xA;    {&#xA;        std::cout &lt;&lt; "Error: Could not open file " &lt;&lt; inputFileName &lt;&lt; &#x27;\n&#x27;;&#xA;        return -1;&#xA;    }&#xA;&#xA;    if (avformat_find_stream_info(pFormatCtx, nullptr) &lt; 0)&#xA;    {&#xA;        std::cout &lt;&lt; "Error: Could not find stream info for file " &lt;&lt; inputFileName &lt;&lt; &#x27;\n&#x27;;&#xA;        return -1;&#xA;    }&#xA;&#xA;    auto videoStreamIndex = -1;&#xA;    for (int i = 0; i &lt; pFormatCtx->nb_streams; i&#x2B;&#x2B;)&#xA;    {&#xA;        if (pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)&#xA;        {&#xA;            videoStreamIndex = i;&#xA;            break;&#xA;        }&#xA;    }&#xA;&#xA;    if (videoStreamIndex == -1)&#xA;    {&#xA;        std::cout &lt;&lt; "Error: Could not find video stream in file " &lt;&lt; inputFileName &lt;&lt; &#x27;\n&#x27;;&#xA;        return -1;&#xA;    }&#xA;&#xA;    const AVCodecParameters* pCodecParameters = pFormatCtx->streams[videoStreamIndex]->codecpar;&#xA;    auto* pCodec = avcodec_find_decoder(pCodecParameters->codec_id);&#xA;    if (pCodec == nullptr)&#xA;    {&#xA;        std::cout &lt;&lt; "Error: Could not find codec for file " &lt;&lt; inputFileName &lt;&lt; &#x27;\n&#x27;;&#xA;        return -1;&#xA;    }&#xA;&#xA;    auto* pCodecContext = avcodec_alloc_context3(pCodec);&#xA;    if (avcodec_parameters_to_context(pCodecContext, pCodecParameters) &lt; 0)&#xA;    {&#xA;        std::cout &lt;&lt; "Error: Could not copy codec parameters to codec context for file " &lt;&lt; inputFileName &lt;&lt; &#x27;\n&#x27;;&#xA;        return -1;&#xA;    }&#xA;&#xA;    if (avcodec_open2(pCodecContext, pCodec, nullptr) &lt; 0)&#xA;    {&#xA;        std::cout &lt;&lt; "Error: Could not open codec for file " &lt;&lt; inputFileName &lt;&lt; &#x27;\n&#x27;;&#xA;        return -1;&#xA;    }&#xA;&#xA;    int frameCount = 0;&#xA;&#xA;    AVPacket* pPacket = av_packet_alloc();&#xA;    AVFrame* pFrame = av_frame_alloc();&#xA;    while (av_read_frame(pFormatCtx, pPacket) >= 0)&#xA;    {&#xA;        if (pPacket->stream_index == videoStreamIndex)&#xA;        {&#xA;            auto response = avcodec_send_packet(pCodecContext, pPacket);&#xA;            if (response &lt; 0 || response == AVERROR_EOF)&#xA;            {&#xA;                av_packet_unref(pPacket);&#xA;                av_frame_unref(pFrame);&#xA;                continue;&#xA;            }&#xA;&#xA;            while (response >= 0)&#xA;            {&#xA;                response = avcodec_receive_frame(pCodecContext, pFrame);&#xA;                if (response == AVERROR(EAGAIN) || response == AVERROR_EOF)&#xA;                {&#xA;                    break;&#xA;                }&#xA;&#xA;                if (response &lt; 0)&#xA;                {&#xA;                    std::cout &lt;&lt; "Error: Could not receive frame for file " &lt;&lt; inputFileName &lt;&lt; &#x27;\n&#x27;;&#xA;                    return -1; // needs proper cleanup here, but this error does not occur in my testing&#xA;                }&#xA;&#xA;                // frame image processing here&#xA;                frameCount&#x2B;&#x2B;;&#xA;            }&#xA;            av_packet_unref(pPacket);&#xA;            av_frame_unref(pFrame);&#xA;        }&#xA;    }&#xA;&#xA;    av_frame_free(&amp;pFrame);&#xA;    av_packet_free(&amp;pPacket);&#xA;    avcodec_free_context(&amp;pCodecContext);&#xA;    avformat_close_input(&amp;pFormatCtx);&#xA;&#xA;    return frameCount;&#xA;&#xA;}&#xA;</fstream></iostream>

    &#xA;

    Any help would be appreciated.

    &#xA;

  • How to handle DHAV (.dav) video streams ?

    16 juin 2022, par Mateus Henrique

    I have a WPF app where I need to handle DHAV (.dav) video stream on runtime from a Digital Video Recorder (DVR). I'm using an SDK that can be found here Dahua SDK search

    &#xA;

    SDK: General_NetSDK_Eng_Win64_IS_V3.052.0000002.0.R.201103&#xA;

    &#xA;

    I need to handle every single frame from the video stream, convert it to a BitmapImage and then displays it in a WPF Image control. Something like : MJPEG Decoder

    &#xA;

    The problem is that I can't find any documentation on how to handle that data and the samples from the SDK doesn't show that either, instead they are built with WinForms and they only pass the Window Handle of the PictureBox's control to an exported DLL function and 'magically' shows the video stream :

    &#xA;

    [DllImport(LIBRARYNETSDK)]&#xA;public static extern IntPtr CLIENT_RealPlayEx(IntPtr lLoginID, int nChannelID, IntPtr hWnd, EM_RealPlayType rType);&#xA;

    &#xA;

    &#xA;

    OBS : 'hWnd' param is the Window Handle to display the video in.

    &#xA;

    &#xA;

    The problem with this approach is that I don't have any control over the video stream.

    &#xA;

    I have tried many FFMPEG wrappers for .NET but they only parse the data if I first write it to disk and only then I can convert it to some type I can handle.

    &#xA;

    This is the callback function that is called contantly during the application's runtime with the data I need to handle :

    &#xA;

        private void RealDataCallback(IntPtr lRealHandle, uint dwDataType, IntPtr pBuffer, uint dwBufSize, IntPtr param, IntPtr dwUser)&#xA;    {&#xA;        switch (dwDataType)&#xA;        {&#xA;            case 0: // original data&#xA;                break;&#xA;            case 1: // frame data&#xA;                HandleFrameData(lRealHandle, dwDataType, pBuffer, dwBufSize, param, dwUser);&#xA;                break;&#xA;            case 2: // yuv data&#xA;                break;&#xA;            case 3: // pcm audio data&#xA;                break;&#xA;        }&#xA;    }&#xA;&#xA;    private void HandleFrameData(IntPtr lRealHandle, uint dwDataType, IntPtr pBuffer, uint dwBufSize, IntPtr param, IntPtr dwUser)&#xA;    {&#xA;        // The pBuffer parameter format is DHAV (.dav) &#xA;        byte[] buff = new byte[dwBufSize];&#xA;        Marshal.Copy(pBuffer, buff, 0, (int)dwBufSize);&#xA;&#xA;        using (var ms = new MemoryStream(buff))&#xA;        {&#xA;        }&#xA;    }&#xA;

    &#xA;

    UPDATE

    &#xA;

    I'm able to convert the YUV data provided in the callback funcion to RGB but that is not the ideal solution. It would be so much better (and faster) if I can convert the original (.dav) data.

    &#xA;

    The RealDataCallback, in fact, only returns 1 frame per callback, but I don't know how to convert that frame to Bitmap. Any help would be appreciated.

    &#xA;

  • YouPHPTube Encoder is not encoding video [on hold]

    11 octobre 2019, par Tanjima Tani

    I successfully installed YouPHPTube an on demand video script. I tried to encode a local video but it is always in "pending" state. The error of encoding error log is as follows :

    [11-Oct-2019 23:54:25 Asia/Dhaka] Upload.php will set format
    [11-Oct-2019 23:54:25 Asia/Dhaka] Upload.php will let function decide decideFormatOrder
    [11-Oct-2019 23:54:25 Asia/Dhaka] decideFormatOrder: {"file":"myvideo.mp4","audioOnly":"false","spectrum":"false","webm":"false","inputHLS":"false","inputLow":"true","inputSD":"true","inputHD":"true","title":"","description":"","categories_id":"0"}
    [11-Oct-2019 23:54:25 Asia/Dhaka] decideFormatOrder: MP4 All
    [11-Oct-2019 23:54:25 Asia/Dhaka] {"status":"error", "msg":"getDurationFromFile ERROR, File () Not Found"}
    [11-Oct-2019 23:54:25 Asia/Dhaka] YouPHPTube-Encoder sending file to http://localhost/YouPHPTube/youPHPTubeEncoder.json
    [11-Oct-2019 23:54:25 Asia/Dhaka] YouPHPTube-Encoder reading file from
    [11-Oct-2019 23:54:25 Asia/Dhaka] YouPHPTube-Streamer answer {"error":false,"video_id":14}
    [11-Oct-2019 23:54:25 Asia/Dhaka] {"error":false,"format":"mp4","file":"","resolution":"","videoDownloadedLink":null,"target":"http:\/\/localhost\/YouPHPTube\/youPHPTubeEncoder.json","postFields":11,"response_raw":"{\"error\":false,\"video_id\":14}","response":{"error":false,"video_id":14}}
    [11-Oct-2019 17:54:27 UTC] downloadFile: start queue_id = 14
    [11-Oct-2019 17:54:27 UTC] downloadFile: url = http://localhost/YouPHPTube-Encoder/videos/original_myvideo_YPTuniqid_5da0c1d10f5c29.50237780
    [11-Oct-2019 17:54:27 UTC] downloadFile:strpos global['webSiteRootURL'] = http://localhost/YouPHPTube-Encoder/
    [11-Oct-2019 17:54:27 UTC] downloadFile: this file was uploaded from file and thus is in the videos
    [11-Oct-2019 17:54:27 UTC] downloadFile: downloadedFile = /var/www/html/YouPHPTube-Encoder/videos/original_myvideo_YPTuniqid_5da0c1d10f5c29.50237780 | url = http://localhost/YouPHPTube-Encoder/videos/original_myvideo_YPTuniqid_5da0c1d10f5c29.50237780
    [11-Oct-2019 17:54:27 UTC] Try to get UTF8 URL http://localhost/YouPHPTube-Encoder/videos/original_myvideo_YPTuniqid_5da0c1d10f5c29.50237780
    [11-Oct-2019 17:54:27 UTC] Try to get UTF8 decode URL http://localhost/YouPHPTube-Encoder/videos/original_myvideo_YPTuniqid_5da0c1d10f5c29.50237780
    [11-Oct-2019 17:54:27 UTC] downloadFile: success
    [11-Oct-2019 17:54:27 UTC] downloadFile: {"error":false,"filename":"14_tmpFile.mp4","pathFileName":"\/var\/www\/html\/YouPHPTube-Encoder\/videos\/14_tmpFile.mp4"}
    [11-Oct-2019 17:54:27 UTC] sendImages: Sending image to [14]
    [11-Oct-2019 17:54:27 UTC] Duration found: 0:00:26
    [11-Oct-2019 17:54:27 UTC] sendImages: YouPHPTube-Encoder sending file to http://localhost/YouPHPTube/objects/youPHPTubeEncoderReceiveImage.json.php
    [11-Oct-2019 17:54:27 UTC] sendImages: YouPHPTube-Encoder reading file from /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4
    [11-Oct-2019 17:54:27 UTC] getImage: ffmpeg -ss 00:00:13 -i /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4 -vframes 1 -y /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4.jpg
    [11-Oct-2019 17:54:27 UTC] getImage: takes 0.11579895019531 sec to complete
    [11-Oct-2019 17:54:27 UTC] getGifImage
    [11-Oct-2019 17:54:27 UTC] getGif: Starts
    [11-Oct-2019 17:54:28 UTC] getGif: takes 0.51563596725464 sec to complete
    [11-Oct-2019 17:54:29 UTC] sendImages: curl_init
    [11-Oct-2019 17:54:29 UTC] sendImages: curl_exec
    [11-Oct-2019 17:54:29 UTC] sendImages: YouPHPTube-Streamer answer {"error":false,"video_id":14}
    [11-Oct-2019 17:54:29 UTC] {"error":false,"file":"\/var\/www\/html\/YouPHPTube-Encoder\/videos\/14_tmpFile.mp4","target":"http:\/\/localhost\/YouPHPTube\/objects\/youPHPTubeEncoderReceiveImage.json.php","postFields":6,"response_raw":"{\"error\":false,\"video_id\":14}","response":{"error":false,"video_id":14}}
    [11-Oct-2019 17:54:29 UTC] run:runMultiResolution
    [11-Oct-2019 17:54:29 UTC] YouPHPTube-Encoder Start Encoder [ffmpeg -i /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4 -vf scale=-2:720 -movflags +faststart -preset ultrafast -vcodec h264 -acodec aac -strict -2 -max_muxing_queue_size 1024 -y /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_HD.mp4]
    [11-Oct-2019 17:54:29 UTC] ffmpeg -i /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4 -vf scale=-2:720 -movflags +faststart -preset ultrafast -vcodec h264 -acodec aac -strict -2 -max_muxing_queue_size 1024 -y /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_HD.mp4 --- [] --- (8, /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4, /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_HD.mp4, 14)
    [11-Oct-2019 17:54:29 UTC] YouPHPTube-Encoder Start Encoder [ffmpeg -i /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4 -vf scale=-2:540 -movflags +faststart -preset ultrafast -vcodec h264 -acodec aac -strict -2 -max_muxing_queue_size 1024 -y /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_SD.mp4]
    [11-Oct-2019 17:54:29 UTC] ffmpeg -i /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4 -vf scale=-2:540 -movflags +faststart -preset ultrafast -vcodec h264 -acodec aac -strict -2 -max_muxing_queue_size 1024 -y /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_SD.mp4 --- [] --- (7, /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4, /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_SD.mp4, 14)
    [11-Oct-2019 17:54:29 UTC] YouPHPTube-Encoder Start Encoder [ffmpeg -i /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4 -vf scale=-2:360 -movflags +faststart -preset ultrafast -vcodec h264 -acodec aac -strict -2 -max_muxing_queue_size 1024 -y /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_Low.mp4]
    [11-Oct-2019 17:54:29 UTC] ffmpeg -i /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4 -vf scale=-2:360 -movflags +faststart -preset ultrafast -vcodec h264 -acodec aac -strict -2 -max_muxing_queue_size 1024 -y /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_Low.mp4 --- [] --- (1, /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4, /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_Low.mp4, 14)
    [11-Oct-2019 17:54:29 UTC] Trying again: [1] => Execute code error "Array\n(\n)\n"
    Code: ffmpeg -i /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile.mp4 -vf scale=-2:360 -movflags +faststart -preset ultrafast -vcodec h264 -acodec aac -strict -2 -max_muxing_queue_size 1024 -y /var/www/html/YouPHPTube-Encoder/videos/14_tmpFile_converted_Low.mp4
    [11-Oct-2019 23:54:30 Asia/Dhaka] ERROR on get http://localhost/YouPHPTube/plugin/CustomizeAdvanced/advancedCustom.json.php false
    [11-Oct-2019 23:54:30 Asia/Dhaka] PHP Warning:  Creating default object from empty value in /var/www/html/YouPHPTube-Encoder/view/index.php on line 233

    What to do next ? Thanks in advance