Recherche avancée

Médias (0)

Mot : - Tags -/metadatas

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

Autres articles (35)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

Sur d’autres sites (7446)

  • DiscordJS Music Bot Connects and Then Immediately Disconnects From Voice Channel

    23 janvier 2020, par კΙбthebraɨɴs

    I see that questions similar to this one have been asked, and after following their solutions I still end up the same as I started. Below I have listed my code, a link to test it with a sample bot I created, and the modules you will need to test it using a self-hosted instance.

    My problem is that upon connecting to the specified voice channel, the bot immediately leaves afterwards without any signs of errors or exceptions. I’m not sure if it is a problem with my code, or with one of the libraries I am using. The only console output I receive is as follows :

    Bot Ready For Use
    joined channel
    left channel

    Thanks !

    My Code

    var voiceChannel = message.member.voiceChannel;

    if (!message.member.voiceChannel) return message.channel.send(`You do realize you have to be in a voice channel to do that, right ${message.author.username}?`)

    if (!message.member.voiceConnection) voiceChannel.join().then(async connection => {

       let streamURL = args.slice(1).join(" ")
       let streamTitle = "";
       let streamThumb = "";
       let streamAuth = "";
       let streamAuthThumb = "";

       if (streamURL.includes("https://www.youtube.com") || streamURL.includes("https://youtu.be/") && !streamURL.includes(' ')) {
           let results = await youtube.getVideo(streamURL)

           let {
               body
           } = await snekfetch.get(`https://www.googleapis.com/youtube/v3/channels?part=snippet&id=${results.channel.id}&fields=items%2Fsnippet%2Fthumbnails&key=${ytapikey}`).query({
               limit: 800
           })

           streamTitle = results.title
           streamThumb = results.thumbnails.medium.url
           streamAuth = results.channel.title
           streamAuthThumb = body.items[0].snippet.thumbnails.medium.url

       } else if (!streamURL.includes("https://www.youtube.com") || !streamURL.includes("https://youtu.be/")) {

           let results = await youtube.searchVideos(streamURL)

           let {
               body
           } = await snekfetch.get(`https://www.googleapis.com/youtube/v3/channels?part=snippet&id=${results[0].channel.id}&fields=items%2Fsnippet%2Fthumbnails&key=${ytapikey}`).query({
               limit: 800
           })

           streamURL = results[0].url
           streamTitle = results[0].title
           streamThumb = results[0].thumbnails.medium.url
           streamAuth = results[0].channel.title
           streamAuthThumb = body.items[0].snippet.thumbnails.medium.url

       } else {
           return message.reply("I can only play videos from YouTube (#NotSponsored).")
       }

       console.log("joined channel");
       const stream = ytdl('https://www.youtube.com/watch?v=gOMhN-hfMtY', {
           filter: 'audioonly'
       });
       const dispatcher = connection.playStream(stream, {
           seek: 0,
           volume: 1
       });
       dispatcher.on("end", end => {
           console.log("left channel");
           voiceChannel.leave();
       });

       let musicEmbed = new Discord.RichEmbed()
           .setAuthor(streamAuth, streamAuthThumb)
           .setTitle(`Now Playing:`)
           .addField(`${streamAuth}`, `${streamTitle}`)
           .setImage(streamThumb)
           .setColor(embedRed)
           .setFooter(`${streamAuth} - ${streamTitle} (${streamURL}`)

       message.channel.send(musicEmbed)

    }).catch(console.error);
    break

    List of Modules

    discord.js
    simple-youtube-api
    node-opus
    ffmpeg
    ffbinaries
    ffmpeg-binaries
    opusscript
    snekfetch
    node-fetch
    ytdl-core

    Click here to use my sample bot through repl.it.

    Thanks Again !

  • FFMpeg C++ encoder fails with hardware acceleration quick sync intel

    28 août 2022, par teals

    I am trying to debug an issue I have with a simple C++ encoder using FFMmpeg. The following code below works correctly on these other hardware acceleration systems/platforms :

    


      

    • Mac/VideoToolbox,
    • 


    • Cuda/NVEnc
    • 


    • Raspberry pi/h264_v4l2m2m.
    • 


    


    It fails on intel quick sync at avcodec_open2. I'm using Ubuntu 22.04. I built FFMpeg from source with the Intel Media SDK installed and configured. I verified that the QuickSync install works. I also have a corresponding decoder implementation that works correctly using intel quick sync. So I know everything properly installed. I am also running this on an 11th Gen Intel CPU.

    


    [hevc_qsv @ 0x564b0d34f0c0] Low power mode is unsupported (This sometimes shows up)
[hevc_qsv @ 0x563691234000] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height


    


    This is the only error that I get and I haven't found any helpful resources. I tried playing around with different parameters but nothing seems to work. Any help or insight would be extremely helpful.

    


    bool VideoEncoder::create() {&#xA;    char const* outfile = filePath.c_str();&#xA;&#xA;     // open output format context&#xA;    int ret = avformat_alloc_output_context2(&amp;ofctx, nullptr, nullptr, outfile);&#xA;    if (ret &lt; 0) {&#xA;        std::cerr &lt;&lt; "fail to avformat_alloc_output_context2(" &lt;&lt; outfile &lt;&lt; "): ret=" &lt;&lt; ret;&#xA;        return false;&#xA;    }&#xA;&#xA;    // create new video stream&#xA;    const AVCodec* codec = avcodec_find_encoder_by_name(encoderName.c_str());&#xA;    vstrm = avformat_new_stream(ofctx, codec);&#xA;    if (!vstrm) {&#xA;        std::cerr &lt;&lt; "fail to avformat_new_stream";&#xA;        return false;&#xA;    }&#xA;&#xA;    // open video encoder&#xA;    cctx = avcodec_alloc_context3(codec);&#xA;    if (!vstrm) {&#xA;        std::cerr &lt;&lt; "fail to avcodec_alloc_context3";&#xA;        return false;&#xA;    }&#xA;    const AVRational dst_fps = {fps, 1};&#xA;    cctx->width = width;&#xA;    cctx->height = height;&#xA;    if(pixel_format != AV_PIX_FMT_NONE) {&#xA;        cctx->pix_fmt = pixel_format;&#xA;    }&#xA;    else {&#xA;        cctx->pix_fmt = codec->pix_fmts[0];&#xA;    }&#xA;    cctx->time_base = av_inv_q(dst_fps);&#xA;    cctx->framerate = dst_fps;&#xA;    cctx->bit_rate = bitrate * 1000000;&#xA;&#xA;&#xA;    AVDictionary* options = nullptr;&#xA;    if(gpu_id >= 0) {&#xA;        av_dict_set_int(&amp;options, "gpu", gpu_id, 0);&#xA;    }&#xA;&#xA;    &#xA;    if (ofctx->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;        cctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;    ret = avcodec_open2(cctx, codec, &amp;options);&#xA;    if (ret &lt; 0) {&#xA;        std::cerr &lt;&lt; "fail to avcodec_open2: ret=" &lt;&lt; ret;&#xA;        return false;&#xA;    }&#xA;    avcodec_parameters_from_context(vstrm->codecpar, cctx);&#xA;&#xA;    //For mac/quicktime we need to add hvc1 tag.&#xA;    if (encoderName.find("hevc") != std::string::npos) {&#xA;        vstrm->codecpar->codec_tag = MKTAG(&#x27;h&#x27;, &#x27;v&#x27;, &#x27;c&#x27;, &#x27;1&#x27;);&#xA;    }&#xA;&#xA;    /*&#xA;    std::cout&#xA;        &lt;&lt; "outfile: " &lt;&lt; outfile &lt;&lt; "\n"&#xA;        &lt;&lt; "format:  " &lt;&lt; ofctx->oformat->name &lt;&lt; "\n"&#xA;        &lt;&lt; "vcodec:  " &lt;&lt; codec->name &lt;&lt; "\n"&#xA;        &lt;&lt; "size:    " &lt;&lt; width &lt;&lt; &#x27;x&#x27; &lt;&lt; height &lt;&lt; "\n"&#xA;        &lt;&lt; "fps:     " &lt;&lt; av_q2d(cctx->framerate) &lt;&lt; "\n"&#xA;        &lt;&lt; "pixfmt:  " &lt;&lt; av_get_pix_fmt_name(cctx->pix_fmt) &lt;&lt; "\n"&#xA;        &lt;&lt; std::flush;*/&#xA;&#xA;    // initialize sample scaler&#xA;    swsCtx = sws_getContext(&#xA;        width, height, AV_PIX_FMT_BGR24,&#xA;        width, height, cctx->pix_fmt,&#xA;        SWS_BILINEAR, nullptr, nullptr, nullptr);&#xA;    if (!swsCtx) {&#xA;        std::cerr &lt;&lt; "fail to sws_getContext";&#xA;        return false;&#xA;    }&#xA;&#xA;    // allocate frame buffer for encoding&#xA;    frame = av_frame_alloc();&#xA;    frame->width = width;&#xA;    frame->height = height;&#xA;    frame->format = static_cast<int>(cctx->pix_fmt);&#xA;    ret = av_frame_get_buffer(frame, 32);&#xA;    if (ret &lt; 0) {&#xA;        std::cerr &lt;&lt; "fail to av_frame_get_buffer: ret=" &lt;&lt; ret;&#xA;        return false;&#xA;    }&#xA;&#xA;    // allocate packet to retrive encoded frame&#xA;    pkt = av_packet_alloc();&#xA;    // open output IO context&#xA;    ret = avio_open2(&amp;ofctx->pb, outfile, AVIO_FLAG_WRITE, nullptr, nullptr);&#xA;    if (ret &lt; 0) {&#xA;        std::cerr &lt;&lt; "fail to avio_open2: ret=" &lt;&lt; ret;&#xA;        return false;&#xA;    }&#xA;&#xA;    // write media container header (if any)&#xA;    ret = avformat_write_header(ofctx, nullptr);&#xA;    if (ret &lt; 0) {&#xA;        std::cerr &lt;&lt; "fail to avformat_write_header: ret=" &lt;&lt; ret;&#xA;        return false;&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;</int>

    &#xA;

  • FFmpegPCMaudio doesn't work on my server but it works on my computer

    4 mai 2023, par Alex

    I am developing a Discord bot with python that can play music. When I do the tests on my computer all work find but when I take all the files to put there in my server it stop working. So I tried to run it on an other computer and no, it still does not work.

    &#xA;

    First I was thinking it was a power problems but the other computer is almost the same. I tried to install all the packages that I have on my computer to the second but the music part still not work. It's not a Discord API problem because my others commands work find.

    &#xA;

    import discord&#xA;from discord.ext import commands&#xA;from youtube_dl import YoutubeDL&#xA;&#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;&#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;,&#xA;                               &#x27;options&#x27;: &#x27;-vn&#x27;}&#xA;&#xA;        self.vc = ""&#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;&#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):&#xA;        if len(self.music_queue) > 0:&#xA;            self.is_playing = True&#xA;&#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;&#xA;            if self.vc == "" or not self.vc.is_connected() or self.vc == None:&#xA;                self.vc = await self.music_queue[0][1].connect()&#xA;            else:&#xA;                await self.vc.move_to(self.music_queue[0][1])&#xA;&#xA;            print(self.music_queue)&#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", help="Plays a selected song from youtube")&#xA;    async def p(self, ctx, *args):&#xA;        query = " ".join(args)&#xA;&#xA;        voice_channel = discord.utils.get(ctx.guild.voice_channels, name=&#x27;General&#x27;)&#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;        else:&#xA;            song = self.search_yt(query)&#xA;            if type(song) == type(True):&#xA;                await ctx.send(&#xA;                    "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()&#xA;&#xA;    @commands.command(name="queue", help="Displays the current songs in queue")&#xA;    async def q(self, ctx):&#xA;        retval = ""&#xA;        for i in range(0, len(self.music_queue)):&#xA;            retval &#x2B;= self.music_queue[i][0][&#x27;title&#x27;] &#x2B; "\n"&#xA;&#xA;        print(retval)&#xA;        if retval != "":&#xA;            await ctx.send(retval)&#xA;        else:&#xA;            await ctx.send("No music in queue")&#xA;&#xA;    @commands.command(name="skip", help="Skips the current song being played")&#xA;    async def skip(self, ctx):&#xA;        if self.vc != "" and self.vc:&#xA;            self.vc.stop()&#xA;            # try to play next in the queue if it exists&#xA;            await self.play_music()&#xA;&#xA;    @commands.command(name="disconnect", help="Disconnecting bot from VC")&#xA;    async def dc(self, ctx):&#xA;        await self.vc.disconnect()&#xA;&#xA;    @commands.command(name="pause")&#xA;    async def pause(self, ctx):&#xA;        voice = discord.utils.get(self.bot.voice_clients, guild=ctx.guild)&#xA;        if voice.is_playing():&#xA;            voice.pause()&#xA;        else:&#xA;            await ctx.send("Currently no audio is playing.")&#xA;&#xA;    @commands.command(name="resume")&#xA;    async def resume(self, ctx):&#xA;        voice = discord.utils.get(self.bot.voice_clients, guild=ctx.guild)&#xA;        if voice.is_paused():&#xA;            voice.resume()&#xA;        else:&#xA;            await ctx.send("The audio is not paused.")&#xA;

    &#xA;

    There are not any error messages, the bot just joins the voice chat and does nothing.

    &#xA;

    If someone can tell me we it work just on my computer I will be very grateful.

    &#xA;

    My files :&#xA;my files

    &#xA;