Recherche avancée

Médias (0)

Mot : - Tags -/objet éditorial

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

Autres articles (8)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (3045)

  • Heroku FFMPEG HEVC Video with Alpha support ?

    15 septembre 2022, par Patrick Vellia

    I am looking for a way to handle converting videos like Webm VP9 with alpha channel to HEVC with alpha mov or mp4 files that are playable in Safari (The Webm will work in all other browsers).

    


    While I can do this locally in my Rails app using streamio-ffmpeg gem and the havoc_videotoolbox encoder, this only works on Apple hardware.

    


    Therefore if I push it up to Heroku and use the Heroku ffmpeg build pack, the HEVC VideoToolbox is not available for use.

    


    FFMPEG does have the libx265 encoder but I can't find the property for this one to preserve the alpha channel.

    


    ffmpeg -I INPUT -c:v libx265 -preset medium -crf 26 -tag:v hvc1 OUTput.mp4


    


    there is a -x265-params flag, but I can't figure out which param will enable the alpha channel.

    


    I am hoping this is actually possible for my production app, otherwise I'd have to process this segment of our media locally and manually upload the HEVC components.

    


    Local Configuration
Apple Monterey with ffmpeg 5.1.1 installed on Intel
Rails 7

    


    Heroku

    


    FFMPEG build pack

    


    Hobby Plan

    


    Rails 7

    


  • Create drawbox with ffmpeg between specific seconds (without reencoding whole video - faster)

    31 mars 2022, par protter

    My plan was to put a transparent red box behind a video. This box should only be present from second 1-45.
But if the videos are 3 hours long, the process takes a long time although it only has to process 45 seconds.

    


    My first attempt takes too long :

    


    ffmpeg -i %1 -vf drawbox=0:9*ih/10:iw:ih/10:t=fill:color=red@0.5:enable='between(t,1,45)' "%~dp0transpred\%~n1%~x1

    


    Then i tried splitting the video into two parts. put the box on the first video, and then put the two back together again.

    


    ffmpeg  -ss 00:00:00.0000 -i %1 -to 00:00:45.0000  -vf drawbox=0:9*ih/10:iw:ih/10:t=fill:color=red@0.5:enable='between(t,1,45)' "%~dp0transpred\%~n1A%~x1"

    


    FFMpeg -ss 00:00:45.0000 -i %1 -c:v copy -c:a copy -avoid_negative_ts make_zero "%~dp0transpred\%~n1B%~x1"

    


    But i don't even have to try to put these two together, because they are not separated exactly at the second. I have read that this is due to "timestamps" and the different video and audio streams.

    


    Now I'm trying an approach to create a stream with the bar, and then overlay it with the finished video. I haven't quite managed that yet, and I don't know if it's faster.
Shortening the video is very fast.

    


    EDIT (Added as a replacement for the comment later)

    


    Thanks for your help I have almost done it with a slightly different approach. Unfortunately, the second part now always has no sound. No matter if I put A and B (B no sound) or B and A (A no sound) together.

    


      

    1. First split with mkvmerge so i have no worrys about the keyframes and get the exact time
mkvmerge --split timestamps:00:00:45.100 A.MKV -o splitmkm.mkv
    2. 


    3. Then add the Bar (Black because of easier testing) :
ffmpeg -i splitmkm-001.mkv -vf drawbox=0:9*ih/10:iw:ih/10:t=fill BAR1.MKV
    4. 


    5. Merge (mkvmerge ends with error) :
ffmpeg -safe 0 -f concat -i list.txt -c copy output1.mkv
    6. 


    


    EDIT (Answer to kesh)

    


    This was the error Again, audio codec config's must match across all your concat files. The drawbox changed the audio Codec from AC-3 to Vorbis.

    


    the procedure is now :

    


      

    1. mkvtoolnix\mkvmerge --split timestamps:00:00:05.100  %1 -o A_splitmkm.mkv with mkvmerge i have an exact split at the time, and i don't have to learn about keyframes.
    2. 


    3. ffmpeg -i A_splitmkm-001.mkv -vf drawbox=0:9*ih/10:iw:ih/10:t=fill:color=red A_BARmkm.MKV create the Bar
    4. 


    5. ffmpeg -i A_BARmkm.MKV -i A_splitmkm-001.mkv -map 0:v  -map 1 -map -1:v  -c copy A_BARwithAudio.mkv redo the step with the changed audio from drawbox
    6. 


    7. ffmpeg -safe 0 -f concat -i list.txt -map 0  -c copy A_output1.mkv merge
    8. 


    


    Now everything works.
Thanks alot !

    


  • CUDA_ERORR_INVALID_CONTEXT

    15 août 2021, par Meme Machine

    I am making a desktop sharing application based off of these repositories from NVIDIA.

    


    https://github.com/NVIDIA/video-sdk-samples/tree/master/nvEncDXGIOutputDuplicationSample

    


    https://github.com/NVIDIA/video-sdk-samples/blob/master/Samples/AppDecode/AppDecD3D/

    


    https://github.com/NVIDIA/video-sdk-samples/tree/master/Samples/AppDecode/AppDecMem

    


    I intend to have a setup function that is called once when Remote Desktop is selected, and then a second function that actually displays the received frames which is called when a frame is received

    


    The below functions are nearly identical to the main() and NvD3D() functions found in AppDecD3D and AppDecMem repositories

    


    CUcontext cuContext = NULL; // maybe it has to do with this variable?&#xA;&#xA;int setup()&#xA;{&#xA;    char szInFilePath[256] = "C:\\Users\\Admin\\Desktop\\test.h264";&#xA;    int iGpu = 0;&#xA;    int iD3d = 0;&#xA;    try&#xA;    {&#xA;        //ParseCommandLine(argc, argv, szInFilePath, NULL, iGpu, NULL, &amp;iD3d);&#xA;        CheckInputFile(szInFilePath);&#xA;&#xA;        ck(cuInit(0));&#xA;        int nGpu = 0;&#xA;        ck(cuDeviceGetCount(&amp;nGpu));&#xA;        if (iGpu &lt; 0 || iGpu >= nGpu)&#xA;        {&#xA;            std::ostringstream err;&#xA;            err &lt;&lt; "GPU ordinal out of range. Should be within [" &lt;&lt; 0 &lt;&lt; ", " &lt;&lt; nGpu - 1 &lt;&lt; "]" &lt;&lt; std::endl;&#xA;            throw std::invalid_argument(err.str());&#xA;        }&#xA;        CUdevice cuDevice = 0;&#xA;        ck(cuDeviceGet(&amp;cuDevice, iGpu));&#xA;        char szDeviceName[80];&#xA;        ck(cuDeviceGetName(szDeviceName, sizeof(szDeviceName), cuDevice));&#xA;        std::cout &lt;&lt; "GPU in use: " &lt;&lt; szDeviceName &lt;&lt; std::endl;&#xA;&#xA;        ck(cuCtxCreate(&amp;cuContext, CU_CTX_SCHED_BLOCKING_SYNC, cuDevice));&#xA;        //NvDecD3D<framepresenterd3d11>(szInFilePath);&#xA;&#xA;        std::cout &lt;&lt; "Display with D3D11." &lt;&lt; std::endl;&#xA;    }&#xA;    catch (const std::exception&amp; ex)&#xA;    {&#xA;        std::cout &lt;&lt; ex.what();&#xA;        exit(1);&#xA;    }&#xA;    return 0;&#xA;}&#xA;&#xA;template<class typename="std::enable_if<std::is_base_of<FramePresenterD3D," framepresentertype="framepresentertype">::value>>&#xA;int NvDecD3D(char* szInFilePath)&#xA;{&#xA;    FileDataProvider dp(szInFilePath);&#xA;    FFmpegDemuxer demuxer(&amp;dp);&#xA;    NvDecoder dec(cuContext, demuxer.GetWidth(), demuxer.GetHeight(), true, FFmpeg2NvCodecId(demuxer.GetVideoCodec()));&#xA;    FramePresenterType presenter(cuContext, demuxer.GetWidth(), demuxer.GetHeight());&#xA;    CUdeviceptr dpFrame = 0;&#xA;    ck(cuMemAlloc(&amp;dpFrame, demuxer.GetWidth() * demuxer.GetHeight() * 4));&#xA;    int nVideoBytes = 0, nFrameReturned = 0, nFrame = 0;&#xA;    uint8_t* pVideo = NULL, ** ppFrame;&#xA;&#xA;    do&#xA;    {&#xA;        demuxer.Demux(&amp;pVideo, &amp;nVideoBytes);&#xA;        dec.Decode(pVideo, nVideoBytes, &amp;ppFrame, &amp;nFrameReturned);&#xA;        if (!nFrame &amp;&amp; nFrameReturned)&#xA;            LOG(INFO) &lt;&lt; dec.GetVideoInfo();&#xA;&#xA;        for (int i = 0; i &lt; nFrameReturned; i&#x2B;&#x2B;)&#xA;        {&#xA;            if (dec.GetBitDepth() == 8)&#xA;                Nv12ToBgra32((uint8_t*)ppFrame[i], dec.GetWidth(), (uint8_t*)dpFrame, 4 * dec.GetWidth(), dec.GetWidth(), dec.GetHeight());&#xA;            else&#xA;                P016ToBgra32((uint8_t*)ppFrame[i], 2 * dec.GetWidth(), (uint8_t*)dpFrame, 4 * dec.GetWidth(), dec.GetWidth(), dec.GetHeight());&#xA;            presenter.PresentDeviceFrame((uint8_t*)dpFrame, demuxer.GetWidth() * 4);&#xA;        }&#xA;        nFrame &#x2B;= nFrameReturned;&#xA;    } while (nVideoBytes);&#xA;    ck(cuMemFree(dpFrame));&#xA;    std::cout &lt;&lt; "Total frame decoded: " &lt;&lt; nFrame &lt;&lt; std::endl;&#xA;    return 0;&#xA;}&#xA;</class></framepresenterd3d11>

    &#xA;

    Notice the line NvDecD3D<framepresenterd3d11>(szInFilePath);</framepresenterd3d11> ? I plan to call NvDecD3D() when a frame is received. So, I commented out the call in setup() and moved it to my asio:async_read function. (see below)

    &#xA;

    void do_read_body()&#xA;    {&#xA;        readBuffer.reserve(_read_msg.ReadLength);&#xA;        _read_msg.Body = readBuffer.data();&#xA;        auto self(shared_from_this());&#xA;        asio::async_read(_socket,&#xA;            asio::buffer(_read_msg.Body, _read_msg.ReadLength),&#xA;            [this, self](std::error_code ec, std::size_t /*length*/)&#xA;            {&#xA;                if (!ec)&#xA;                {&#xA;                    if (_read_msg.CmdId == 0x5)&#xA;                    {&#xA;                        std::cout &lt;&lt; "Received a frame" &lt;&lt; std::endl;&#xA;&#xA;                        NvDecD3D<framepresenterd3d11>(szInFilePath);&#xA;                    }&#xA;                    else&#xA;                    {&#xA;                        std::cout &lt;&lt; std::string(_read_msg.Body, 0, _read_msg.ReadLength) &lt;&lt; std::endl;&#xA;                    }&#xA;                    &#xA;                    do_read_header();&#xA;                }&#xA;                else&#xA;                {&#xA;                    _room.leave(shared_from_this());&#xA;                }&#xA;            });&#xA;    }&#xA;</framepresenterd3d11>

    &#xA;

    However, when I go to execute it, I get CUDA_ERORR_INVALID_CONTEXT when cuMemAlloc() is called. If I uncomment the call to NvDecD3D() inside setup() and call it from there, it does not error however.

    &#xA;

    Do you have any idea what could be causing this problem ? Perhaps it is related to the ASIO.

    &#xA;