Recherche avancée

Médias (91)

Autres articles (47)

  • Configuration spécifique pour PHP5

    4 février 2011, par

    PHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
    Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
    Modules spécifiques
    Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (4900)

  • 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;

  • Fighting with the VP8 Spec

    4 juin 2010, par Multimedia Mike — VP8

    As stated in a previous blog post on the matter, FFmpeg’s policy is to reimplement codecs rather than adopt other codebases wholesale. And so it is with Google’s recently open sourced VP8 codec, the video portion of their Webm initiative. I happen to know that the new FFmpeg implementation is in the capable hands of several of my co-developers so I’m not even worrying about that angle.

    Instead, I thought of another of my characteristically useless exercises : Create an independent VP8 decoder implementation entirely in pure Python. Silly ? Perhaps. But it has one very practical application : By attempting to write a new decoder based on the official bitstream documentation, this could serve as a mechanism for validating said spec, something near and dear to my heart.

    What is the current state of the spec ? Let me reiterate that I’m glad it exists. As I stated during the initial open sourcing event, everything that Google produced for the initial event went well beyond my wildest expectations. Having said that, the documentation does fall short in a number of places. Fortunately, I am on the Webm mailing lists and am sending in corrections and ideas for general improvement. For the most part, I have been able to understand the general ideas behind the decoding flow based on the spec and am even able to implement certain pieces correctly. Then I usually instrument the libvpx source code with output statements in order to validate that I’m doing everything right.

    Token Blocker
    Unfortunately, I’m quite blocked right now on the chapter regarding token/DCT coefficient decoding (chapter 13 in the current document iteration). In his seminal critique of the codec, Dark Shikari complained that large segments of the spec are just C code fragments copy and pasted from the official production decoder. As annoying as that is, the biggest insult comes at the end of section 13.3 :

    While we have in fact completely described the coefficient decoding procedure, the reader will probably find it helpful to consult the reference implementation, which can be found in the file detokenize.c.

    The reader most certainly will not find it helpful to consult the file detokenize.c. The file in question implements the coefficient residual decoding with an unholy sequence of C macros that contain goto statements. Honestly, I thought I did understand the coefficient decoding procedure based on the spec’s description. But my numbers don’t match up with the official decoder. Instrumenting or tracing macro’d code is obviously painful and studying the same code is making me think I don’t understand the procedure after all. To be fair, entropy decoding often occupies a lot of CPU time for many video decoders and I have little doubt that the macro/goto approach is much faster than clearer, more readable methods. It’s just highly inappropriate to refer to it for pedagogical purposes.

    Aside : For comparison, check out the reference implementation for the VC-1 codec. It was written so clearly and naively that the implementors used an O(n) Huffman decoder. That’s commitment to clarity.

    I wonder if my FFmpeg cohorts are having better luck with the DCT residue decoding in their new libavcodec implementation ? Maybe if I can get this Python decoder working, it can serve as a more appropriate reference decoder.

    Update : Almost immediately after I posted this entry, I figured out a big problem that was holding me back, and then several more small ones, and finally decoded by first correct DCT coefficient from the stream (I’ve never been so happy to see the number -448). I might be back on track now. Even better was realizing that my original understanding of the spec was correct.

    Unrelated
    I found this image on the Doom9 forums. I ROFL’d :



    It’s probably unfair and inaccurate but you have to admit it’s funny. Luckily, quality nitpickings aren’t my department. I’m just interested in getting codecs working, tested, and documented so that more people can use them reliably.

  • How can I make my loop command for a pythin discord bot work ?

    17 octobre 2022, par Dio

    so I am kinda new to python and wanted to make a discord music bot. It works pretty well, except that I am not able to figure out how to code the queue loop command and the playing now command(this one gives me a full link instead of just the name). I have bolded the 2 commands that I cannot figure out.

    &#xA;

       from ast import alias&#xA;import discord&#xA;from discord.ext import commands&#xA;&#xA;from youtube_dl import YoutubeDL&#xA;&#xA;class music_cog(commands.Cog):&#xA;    def __init__(self, bot):&#xA;        self.bot = bot&#xA;    &#xA;        #all the music related stuff&#xA;        self.is_playing = False&#xA;        self.is_paused = False&#xA;        self.is_loop = False&#xA;        self.now_playing =""&#xA;        # 2d array containing [song, channel]&#xA;        self.music_queue = []&#xA;        self.YDL_OPTIONS = {&#x27;format&#x27;: &#x27;bestaudio&#x27;, &#x27;noplaylist&#x27;:&#x27;True&#x27;}&#xA;        self.FFMPEG_OPTIONS = {&#x27;before_options&#x27;: &#x27;-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5&#x27;, &#x27;options&#x27;: &#x27;-vn&#x27;}&#xA;&#xA;        self.vc = None&#xA;&#xA;     #searching the item on youtube&#xA;    def search_yt(self, item):&#xA;        with YoutubeDL(self.YDL_OPTIONS) as ydl:&#xA;            try: &#xA;                info = ydl.extract_info("ytsearch:%s" % item, download=False)[&#x27;entries&#x27;][0]&#xA;            except Exception: &#xA;                return False&#xA;&#xA;        return {&#x27;source&#x27;: info[&#x27;formats&#x27;][0][&#x27;url&#x27;], &#x27;title&#x27;: info[&#x27;title&#x27;]}&#xA;&#xA;    def play_next(self):&#xA;        if len(self.music_queue) > 0:&#xA;            self.is_playing = True&#xA;&#xA;            #get the first url&#xA;            m_url = self.music_queue[0][0][&#x27;source&#x27;]&#xA;            self.now_playing =  self.music_queue[0][0][&#x27;title&#x27;]&#xA;            #remove the first element as you are currently playing it&#xA;            self.music_queue.pop(0)&#xA;&#xA;            self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())&#xA;        else:&#xA;            self.is_playing = False&#xA;&#xA;    # infinite loop checking &#xA;    async def play_music(self, ctx):&#xA;        if len(self.music_queue) > 0:&#xA;            self.is_playing = True&#xA;            m_url = self.music_queue[0][0][&#x27;source&#x27;]&#xA;            &#xA;            #try to connect to voice channel if you are not already connected&#xA;            if self.vc == None or not self.vc.is_connected():&#xA;                self.vc = await self.music_queue[0][1].connect()&#xA;&#xA;                #in case we fail to connect&#xA;                if self.vc == None:&#xA;                    await ctx.send("Could not connect to the voice channel")&#xA;                    return&#xA;            else:&#xA;                await self.vc.move_to(self.music_queue[0][1])&#xA;            self.now_playing = m_url&#xA;            #remove the first element as you are currently playing it&#xA;            self.music_queue.pop(0)&#xA;&#xA;            self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())&#xA;        else:&#xA;            self.is_playing = False&#xA;&#xA;    @commands.command(name="play", aliases=["p","playing"], help="Plays a selected song from youtube")&#xA;    async def play(self, ctx, *args):&#xA;        query = " ".join(args)&#xA;        &#xA;        voice_channel = ctx.author.voice.channel&#xA;        if voice_channel is None:&#xA;            #you need to be connected so that the bot knows where to go&#xA;            await ctx.send("Connect to a voice channel!")&#xA;        elif self.is_paused:&#xA;            self.vc.resume()&#xA;        else:&#xA;            global song&#xA;            song = self.search_yt(query)&#xA;            if type(song) == type(True):&#xA;                await ctx.send("Could not download the song. Incorrect format try another keyword. This could be due to playlist or a livestream format.")&#xA;            else:&#xA;                await ctx.send("Song added to the queue")&#xA;                self.music_queue.append([song, voice_channel])&#xA;                &#xA;                if self.is_playing == False:&#xA;                    await self.play_music(ctx)&#xA;&#xA;    @commands.command(name="pause", help="Pauses the current song being played")&#xA;    async def pause(self, ctx, *args):&#xA;        if self.is_playing:&#xA;            self.is_playing = False&#xA;            self.is_paused = True&#xA;            self.vc.pause()&#xA;            await ctx.send("Music paused")&#xA;        elif self.is_paused:&#xA;            self.is_paused = False&#xA;            self.is_playing = True&#xA;            self.vc.resume()&#xA;            await ctx.send("Music resumed")&#xA;&#xA;    @commands.command(name = "resume", aliases=["r"], help="Resumes playing with the discord bot")&#xA;    async def resume(self, ctx, *args):&#xA;        if self.is_paused:&#xA;            self.is_paused = False&#xA;            self.is_playing = True&#xA;            self.vc.resume()&#xA;            await ctx.send("Music resumed")&#xA;        else:&#xA;            await ctx.send("Music is not paused")&#xA;&#xA;    @commands.command(name="skip", aliases=["s"], help="Skips the current song being played")&#xA;    async def skip(self, ctx):&#xA;        if self.vc != None and self.vc:&#xA;            self.vc.stop()&#xA;            #try to play next in the queue if it exists&#xA;            await self.play_music(ctx)&#xA;            await ctx.send("Skipped current song")&#xA;&#xA;    @commands.command(name="queue", aliases=["q"], help="Displays the current songs in queue")&#xA;    async def queue(self, ctx):&#xA;        global retval &#xA;        retval = "```"&#xA;        for i in range(0, len(self.music_queue)):&#xA;            # display a max of 5 songs in the current queue&#xA;            #if (i > 4): break&#xA;            l = str(i&#x2B;1)&#xA;            retval &#x2B;= l &#x2B;". " &#x2B; self.music_queue[i][0][&#x27;title&#x27;] &#x2B; "\n"&#xA;&#xA;        if retval != "```":&#xA;            retval&#x2B;="```"&#xA;            await ctx.send(retval)&#xA;        else:&#xA;            await ctx.send("No music in queue")&#xA;&#xA;    **@commands.command(name="loop", help="Loops the queue")**&#xA;    async def loop(self, ctx):&#xA;        if self.is_loop == False:&#xA;            self.is_loop = True&#xA;        else:&#xA;            self.is_loop = False &#xA;        if self.is_loop == True:&#xA;            if len(self.music_queue)==0:&#xA;                await ctx.send("No music to loop")&#xA;            else:&#xA;                i=0&#xA;                while self.is_loop == True and i code>

    &#xA;