Recherche avancée

Médias (29)

Mot : - Tags -/Musique

Autres articles (50)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

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

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (7060)

  • discord.py nextcord.py It cant read mp3 audio files

    23 février 2023, par hihihi hihihi

    I'm trying to make my discord bot speak some text, but I can't make it stream the generated mp3 audio file. I'm using Nextcord and FFmpeg.

    


    This is the code I run :

    


    @bot.command(name="bottalk")
async def bottalk(ctx, *args):
    text = " ".join(args)
    user = ctx.message.author
    if user.voice != None:
        try:
            vc = await user.voice.channel.connect()

        except:
            vc = ctx.voice_client   

        sound = gTTS(text=text, lang="en", slow=False)  
        sound.save("please read this.mp3")

        if vc.is_playing():
            vc.stop()

        source = await nextcord.FFmpegOpusAudio.from_probe("please read this.mp3", method="fallback")
        vc.play(source)
    else:
        await ctx.send("join vc")    


    


    When I run the code it generates the mp3 audio file but cannot play the audio file. I get this error :

    


    Ignoring exception in command bottalk:&#xA;Traceback (most recent call last):&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\ext\commands\core.py", line 165, in wrapped&#xA;    ret = await coro(*args, **kwargs)&#xA;          ^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "c:\Users\gmmz5\OneDrive\เดสก์ท็อป\python\qweqwewqeqewqe\hi.py", line 4&#xA;5, in tts&#xA;    source = await nextcord.FFmpegOpusAudio.from_probe("please read this.mp3", method="fallback")&#xA;             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 496, in from_probe&#xA;    return cls(source, bitrate=bitrate, codec=codec, **kwargs)  # type: ignore           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 426, in __init__&#xA;    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 165, in __init__&#xA;    self._process: subprocess.Popen = self._spawn_process(args, **kwargs)     &#xA;                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^     &#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 184, in _spawn_process&#xA;    raise ClientException(executable &#x2B; " was not found.") from None&#xA;nextcord.errors.ClientException: ffmpeg was not found.&#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;Traceback (most recent call last):&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\ext\commands\bot.py", line 1381, in invoke&#xA;    await ctx.command.invoke(ctx)&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\ext\commands\core.py", line 948, in invoke&#xA;    await injected(*ctx.args, **ctx.kwargs)&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\ext\commands\core.py", line 174, in wrapped&#xA;    raise CommandInvokeError(exc) from exc&#xA;nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: &#xA;ClientException: ffmpeg was not found.&#xA;Exception ignored in: <function at="at" 0x0000022c43a47ba0="0x0000022c43a47ba0">    &#xA;Traceback (most recent call last):&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 116, in __del__&#xA;    self.cleanup()&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 235, in cleanup&#xA;    self._kill_process()&#xA;  File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 191, in _kill_process&#xA;    proc = self._process&#xA;           ^^^^^^^^^^^^^&#xA;AttributeError: &#x27;FFmpegOpusAudio&#x27; object has no attribute &#x27;_process&#x27;&#xA;</function>

    &#xA;

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

    &#xA;

    import discord&#xA;&#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;        self.is_playing = False&#xA;        self.is_paused = False&#xA;&#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;    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;        return {&#x27;sourcffmpege&#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;            m_url = self.music_queue[0][0][&#x27;source&#x27;]&#xA;&#xA;            self.music_queue.pop(0)&#xA;&#xA;            self.vc.play(discord.FFmpegPCMAudio(executable="ffmpeg", source=m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())&#xA;        else:&#xA;            self.is_playing = False&#xA;&#xA;    async def play_music(self, ctx):&#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;            if self.vc == None or not self.vc.is_connected():&#xA;                self.vc = await self.music_queue[0][1].connect()&#xA;&#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;&#xA;            self.music_queue.pop(0)&#xA;&#xA;            self.vc.play(discord.FFmpegPCMAudio(executable="ffmpeg", source=m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())&#xA;&#xA;    @commands.command(name="play", aliases=["p", "playing"], help="Play the 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;            await ctx.send("Connect to a voice channel!")&#xA;        elif self.is_paused:&#xA;            self.vc.resume()&#xA;        else:&#xA;            song = self.search_yt(query)&#xA;            if type(song) == type(True):&#xA;                await ctx.send("Could not download the song. Incorrect format, try a different keyword")&#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;        elif self.is_paused:&#xA;            self.vc.resume()&#xA;&#xA;    @commands.command(name="resume", aliases=["r"], help="Resumes playing the current song")&#xA;    async def resume(self, ctx, *args):&#xA;        if self.is_paused:&#xA;            self.is_playing = True&#xA;            self.is_paused = False&#xA;            self.vc.resume()&#xA;&#xA;    @commands.command(name="skip", aliases=["s"], help="Skips the currently played song")&#xA;    async def skip(self, ctx, *args):&#xA;        if self.vc != None and self.vc:&#xA;            self.vc.stop()&#xA;            await self.play_music(ctx)&#xA;&#xA;    @commands.command(name="queue", aliases=["q"], help="Displays all the songs currently in the queue")&#xA;    async def queue(self, ctx):&#xA;        retval = ""&#xA;&#xA;        for i in range(0, len(self.music_queue)):&#xA;            if i > 5: break&#xA;            retval &#x2B;= self.music_queue[i][0][&#x27;title&#x27;] &#x2B; &#x27;\n&#x27;&#xA;&#xA;        if retval != "":&#xA;            await ctx.send(retval)&#xA;        else:&#xA;            await ctx.send("No music in queue.")&#xA;    &#xA;    @commands.command(name="clear", aliases=["c", "bin"], help="Stops the current song and clears the queue")&#xA;    async def clear(self, ctx, *args):&#xA;        if self.vc != None and self.is_playing:&#xA;            self.vc.stop()&#xA;        self.music_queue = []&#xA;        await ctx.send("Music queue cleared")&#xA;&#xA;    @commands.command(name="leave", aliases=["l"], help="Kicks the bot from the voice channel")&#xA;    async def leave(self, ctx):&#xA;        self.is_playing = False&#xA;        self.is_paused = False&#xA;        await self.vc.disconnect()&#xA;&#xA;async def setup(bot):&#xA;    await bot.add_cog(music_cog(bot))&#xA;

    &#xA;

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

    &#xA;

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

    &#xA;

    raceback (most recent call last):&#xA;  File "C:\Users\poopt\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 229, in wrapped&#xA;    ret = await coro(*args, **kwargs)&#xA;  File "c:\Users\poopt\Code\cool_bot\cogs\music_cog.py", line 77, in play&#xA;    await self.play_music(ctx)&#xA;  File "c:\Users\poopt\Code\cool_bot\cogs\music_cog.py", line 44, in play_music&#xA;    m_url=self.music_queue[0][0][&#x27;source&#x27;]&#xA;KeyError: &#x27;source&#x27;&#xA;&#xA;The above exception was the direct cause of the following exception:&#xA;&#xA;Traceback (most recent call last):&#xA; line 1349, in invoke&#xA;    await ctx.command.invoke(ctx)&#xA;  File "C:\Users\poopt\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 1023, in invoke&#xA;    await injected(*ctx.args, **ctx.kwargs)  # type: ignore&#xA;  File "C:\Users\poopt\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 238, in wrapped&#xA;    raise CommandInvokeError(exc) from exc&#xA;discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: &#x27;source&#x27;&#xA;

    &#xA;

  • Select subtitle stream in ffmpeg in order to take screenshot

    7 octobre 2020, par Snake Eyes

    I want to capture screen from mkv which has embedded subtitles which media info looks like :

    &#xA;

    General&#xA;Complete name                            : MyVideo.mkv&#xA;Format                                   : Matroska&#xA;Format version                           : Version 4&#xA;File size                                : 2.25 GiB&#xA;Duration                                 : 1 h 47 min&#xA;Overall bit rate                         : 2 993 kb/s&#xA;Writing application                      : mkvmerge v21.0.0 (&#x27;Tardigrades Will Inherit The Earth&#x27;) 64-bit&#xA;Writing library                          : libebml v1.3.5 &#x2B; libmatroska v1.4.8&#xA;&#xA;Video&#xA;ID                                       : 1&#xA;Format                                   : AVC&#xA;Format/Info                              : Advanced Video Codec&#xA;Format profile                           : High@L4&#xA;Format settings                          : CABAC / 4 Ref Frames&#xA;Format settings, CABAC                   : Yes&#xA;Format settings, Reference frames        : 4 frames&#xA;Codec ID                                 : V_MPEG4/ISO/AVC&#xA;Duration                                 : 1 h 47 min&#xA;Bit rate                                 : 2 735 kb/s&#xA;Width                                    : 1 920 pixels&#xA;Height                                   : 1 080 pixels&#xA;Display aspect ratio                     : 16:9&#xA;Frame rate mode                          : Constant&#xA;Frame rate                               : 23.976 (24000/1001) FPS&#xA;Color space                              : YUV&#xA;Chroma subsampling                       : 4:2:0&#xA;Bit depth                                : 8 bits&#xA;Scan type                                : Progressive&#xA;Bits/(Pixel*Frame)                       : 0.055&#xA;Stream size                              : 2.05 GiB (91%)&#xA;Default                                  : Yes&#xA;Forced                                   : No&#xA;&#xA;Audio&#xA;ID                                       : 2&#xA;Format                                   : E-AC-3&#xA;Format/Info                              : Enhanced AC-3&#xA;Commercial name                          : Dolby Digital Plus&#xA;Codec ID                                 : A_EAC3&#xA;Duration                                 : 1 h 47 min&#xA;Bit rate mode                            : Constant&#xA;Bit rate                                 : 256 kb/s&#xA;Channel(s)                               : 6 channels&#xA;Channel layout                           : L R C LFE Ls Rs&#xA;Sampling rate                            : 48.0 kHz&#xA;Frame rate                               : 31.250 FPS (1536 SPF)&#xA;Compression mode                         : Lossy&#xA;Stream size                              : 197 MiB (9%)&#xA;Language                                 : English&#xA;Service kind                             : Complete Main&#xA;Default                                  : Yes&#xA;Forced                                   : No&#xA;&#xA;Text #1&#xA;ID                                       : 3&#xA;Format                                   : UTF-8&#xA;Codec ID                                 : S_TEXT/UTF8&#xA;Codec ID/Info                            : UTF-8 Plain Text&#xA;Duration                                 : 1 h 46 min&#xA;Bit rate                                 : 53 b/s&#xA;Count of elements                        : 1626&#xA;Stream size                              : 42.1 KiB (0%)&#xA;Title                                    : SDH&#xA;Language                                 : English&#xA;Default                                  : No&#xA;Forced                                   : No&#xA;&#xA;Text #2&#xA;ID                                       : 4&#xA;Format                                   : UTF-8&#xA;Codec ID                                 : S_TEXT/UTF8&#xA;Codec ID/Info                            : UTF-8 Plain Text&#xA;Duration                                 : 1 h 46 min&#xA;Bit rate                                 : 53 b/s&#xA;Count of elements                        : 1595&#xA;Stream size                              : 41.8 KiB (0%)&#xA;Language                                 : Spanish&#xA;Default                                  : No&#xA;Forced                                   : No&#xA;&#xA;Menu&#xA;01:44:57.011                             : en:Credits&#xA;

    &#xA;

    I'm trying to capture with Spanish subtitle stream in the screen

    &#xA;

    I tried :

    &#xA;

    ffmpeg -ss 14 -copyts -i C:\MyVideo.mkv -map 0:0 -map 0:3 -codec copy -codec:3 mov_text -vframes 1 C:\test.png&#xA;

    &#xA;

    but is not working, means the PNG is not PNG actually. I don't know the format is output.

    &#xA;

    How to capture screen with spanish subtitle (position 4 in mediainfo) ?

    &#xA;