Recherche avancée

Médias (1)

Mot : - Tags -/blender

Autres articles (29)

  • 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 (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

  • 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 (...)

Sur d’autres sites (3061)

  • Keep getting "discord.ext.commands.errors.CommandInvokeError : Command raised an exception : KeyError : 'source'" error

    22 février 2023, par kris

    Everytime I try to run play command in my bot, I get this error in the terminal, kind of new to coding so not exactly sure whats going on. It was working just fine, then it started not to work.

    


    import discord

from discord.ext import commands

from youtube_dl import YoutubeDL

class music_cog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        
        self.is_playing = False
        self.is_paused = False

        self.music_queue = []
        self.YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'}
        self.FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}

        self.vc = None

    def search_yt(self, item):
        with YoutubeDL(self.YDL_OPTIONS) as ydl:
            try:
                info = ydl.extract_info("ytsearch:%s" % item, download=False)['entries'][0]
            except Exception:
                return False
        return {'sourcffmpege': info['formats'][0]['url'], 'title': info['title']}
    
    def play_next(self):
        if len(self.music_queue) > 0:
            self.is_playing = True

            m_url = self.music_queue[0][0]['source']

            self.music_queue.pop(0)

            self.vc.play(discord.FFmpegPCMAudio(executable="ffmpeg", source=m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
        else:
            self.is_playing = False

    async def play_music(self, ctx):
        if len(self.music_queue) > 0:
            self.is_playing = True

            m_url=self.music_queue[0][0]['source']

            if self.vc == None or not self.vc.is_connected():
                self.vc = await self.music_queue[0][1].connect()

                if self.vc == None:
                    await ctx.send("Could not connect to the voice channel")
                    return
            else:
                await self.vc.move_to(self.music_queue[0][1])

            self.music_queue.pop(0)

            self.vc.play(discord.FFmpegPCMAudio(executable="ffmpeg", source=m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())

    @commands.command(name="play", aliases=["p", "playing"], help="Play the selected song from youtube")
    async def play(self, ctx, *args):
        query = " ".join(args)

        voice_channel = ctx.author.voice.channel
        if voice_channel is None:
            await ctx.send("Connect to a voice channel!")
        elif self.is_paused:
            self.vc.resume()
        else:
            song = self.search_yt(query)
            if type(song) == type(True):
                await ctx.send("Could not download the song. Incorrect format, try a different keyword")
            else:
                await ctx.send("Song added to the queue")
                self.music_queue.append([song, voice_channel])

                if self.is_playing == False:
                    await self.play_music(ctx)

    @commands.command(name="pause", help="Pauses the current song being played")
    async def pause(self, ctx, *args):
        if self.is_playing:
            self.is_playing = False
            self.is_paused = True
            self.vc.pause()
        elif self.is_paused:
            self.vc.resume()

    @commands.command(name="resume", aliases=["r"], help="Resumes playing the current song")
    async def resume(self, ctx, *args):
        if self.is_paused:
            self.is_playing = True
            self.is_paused = False
            self.vc.resume()

    @commands.command(name="skip", aliases=["s"], help="Skips the currently played song")
    async def skip(self, ctx, *args):
        if self.vc != None and self.vc:
            self.vc.stop()
            await self.play_music(ctx)

    @commands.command(name="queue", aliases=["q"], help="Displays all the songs currently in the queue")
    async def queue(self, ctx):
        retval = ""

        for i in range(0, len(self.music_queue)):
            if i > 5: break
            retval += self.music_queue[i][0]['title'] + '\n'

        if retval != "":
            await ctx.send(retval)
        else:
            await ctx.send("No music in queue.")
    
    @commands.command(name="clear", aliases=["c", "bin"], help="Stops the current song and clears the queue")
    async def clear(self, ctx, *args):
        if self.vc != None and self.is_playing:
            self.vc.stop()
        self.music_queue = []
        await ctx.send("Music queue cleared")

    @commands.command(name="leave", aliases=["l"], help="Kicks the bot from the voice channel")
    async def leave(self, ctx):
        self.is_playing = False
        self.is_paused = False
        await self.vc.disconnect()

async def setup(bot):
    await bot.add_cog(music_cog(bot))


    


    this is my music_cogs.py, this is where error is coming from

    


    was working just fine then it started to give me this error after a while.

    


    raceback (most recent call last):
  File "C:\Users\poopt\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 229, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\poopt\Code\cool_bot\cogs\music_cog.py", line 77, in play
    await self.play_music(ctx)
  File "c:\Users\poopt\Code\cool_bot\cogs\music_cog.py", line 44, in play_music
    m_url=self.music_queue[0][0]['source']
KeyError: 'source'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
 line 1349, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\poopt\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 1023, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "C:\Users\poopt\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 238, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'source'


    


  • Error : "libavformat\avformat.h : No such file or directory"

    21 février 2023, par Abdo Daood

    I create a simple c++ file called test.cpp :

    


    #include <iostream>&#xA;#include &#xA;using namespace std;&#xA;&#xA;int main() &#xA;{&#xA;    cout &lt;&lt; "Hello, World!";&#xA;    return 0;&#xA;}&#xA;</iostream>

    &#xA;

    and using g++ in terminal to compile test.cpp file with the command :

    &#xA;

    g&#x2B;&#x2B; test.cpp -o test&#xA;

    &#xA;

    I get this error :

    &#xA;

    test.cpp:2:10: fatal error: libavformat\avformat.h: No such file or directory&#xA;    2 | #include &#xA;      |          ^~~~~~~~~~~~~~~~~~~~~~~~&#xA;compilation terminated.&#xA;

    &#xA;

    Notes :&#xA;libavformat\avformat.h path is : /usr/include/x86_64-linux-gnu/libavformat/avformat.h

    &#xA;

    and using ffmpeg version is :

    &#xA;

    $ ffmpeg -version&#xA;&#xA;ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers&#xA;built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)&#xA;configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared&#xA;libavutil      56. 70.100 / 56. 70.100&#xA;libavcodec     58.134.100 / 58.134.100&#xA;libavformat    58. 76.100 / 58. 76.100&#xA;libavdevice    58. 13.100 / 58. 13.100&#xA;libavfilter     7.110.100 /  7.110.100&#xA;libswscale      5.  9.100 /  5.  9.100&#xA;libswresample   3.  9.100 /  3.  9.100&#xA;libpostproc    55.  9.100 / 55.  9.100&#xA;

    &#xA;

    Using this command :

    &#xA;

    g&#x2B;&#x2B; `pkg-config --cflags libavformat` test.cpp  `pkg-config --libs libavformat` -o test&#xA;

    &#xA;

  • flient-ffmpeg getting error as "ffmpeg exited with code 1 : pipe:0 : Invalid data found when processing input"

    6 avril 2023, par Abhishek Rawal

    I am trying to create API where i need to get uploaded video and create thumbnail from that video. But conditions are :

    &#xA;

      &#xA;
    • Video should not store on local disk
    • &#xA;

    • Once thumbnail is create it should not store on local disk, instead it should directly uploaded to AWS s3 bucket.
    • &#xA;

    &#xA;

    Following is the code i am trying with :

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    const ffmpeg = require(&#x27;fluent-ffmpeg&#x27;);&#xA;const stream = require(&#x27;stream&#x27;);&#xA;&#xA;router.post(&#x27;/thumbnail&#x27;, upload.any(), (req, res) => {&#xA;  const videoBuffer = req.files[0].buffer;&#xA;  &#xA;  let readableVideoBuffer = new stream.PassThrough();&#xA;    readableVideoBuffer.write(videoBuffer);&#xA;    readableVideoBuffer.end()&#xA;    &#xA;  let bufferStream = new stream.PassThrough();&#xA;  &#xA;  ffmpeg(readableVideoBuffer)&#xA;    .on(&#x27;filenames&#x27;, function(filenames) {&#xA;      console.log(&#x27;Will generate &#x27; &#x2B; filenames.join(&#x27;, &#x27;))&#xA;    })&#xA;    .on(&#x27;end&#x27;, function() {&#xA;      console.log(&#x27;Screenshots taken&#x27;);&#xA;    })&#xA;    .on(&#x27;error&#x27;, (err) => {&#xA;      console.log(err);&#xA;    })&#xA;    .screenshots({&#xA;      count: 4,&#xA;      size: &#x27;100x100&#x27;,&#xA;      timestamps: [&#x27;00:00:01.000&#x27;],&#xA;    })&#xA;    .writeToStream(bufferStream, { end: true });  /* while using this statement i am getting error */&#xA;    &#xA;    const buffers = [];&#xA;    bufferStream.on(&#x27;data&#x27;, function (buf) {&#xA;      buffers.push(buf);&#xA;    });&#xA;    bufferStream.on(&#x27;end&#x27;, function () {&#xA;      const outputBuffer = Buffer.concat(buffers);&#xA;      // use s3 bucket code here&#xA;      console.log(&#x27;outputBuffer===========>&#x27;, outputBuffer)&#xA;    });&#xA;})

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    so while calling this API my app is crashing and i am getting error as :

    &#xA;

    &#xA;

    Error : ffmpeg exited with code 1 : pipe:0 : Invalid data found when&#xA;processing input

    &#xA;

    &#xA;

    Blockquote

    &#xA;

    If i am not using this statement :

    &#xA;

    &#xA;

    .writeToStream(bufferStream, end : true ) ;

    &#xA;

    &#xA;

    then able to save file but in local disk, which is not required in my case.

    &#xA;

    Please help me to understand what is wrong in this code, how i can resolve it.&#xA;Any type of help is appreciated.

    &#xA;