
Recherche avancée
Médias (29)
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (50)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains 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, parPré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 2013Puis-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 hihihiI'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:
Traceback (most recent call last):
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\ext\commands\core.py", line 165, in wrapped
 ret = await coro(*args, **kwargs)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "c:\Users\gmmz5\OneDrive\เดสก์ท็อป\python\qweqwewqeqewqe\hi.py", line 4
5, in tts
 source = await nextcord.FFmpegOpusAudio.from_probe("please read this.mp3", method="fallback")
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 496, in from_probe
 return cls(source, bitrate=bitrate, codec=codec, **kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 426, in __init__
 super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 165, in __init__
 self._process: subprocess.Popen = self._spawn_process(args, **kwargs) 
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 184, in _spawn_process
 raise ClientException(executable + " was not found.") from None
nextcord.errors.ClientException: ffmpeg was not found.

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

Traceback (most recent call last):
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\ext\commands\bot.py", line 1381, in invoke
 await ctx.command.invoke(ctx)
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\ext\commands\core.py", line 948, in invoke
 await injected(*ctx.args, **ctx.kwargs)
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\ext\commands\core.py", line 174, in wrapped
 raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: 
ClientException: ffmpeg was not found.
Exception ignored in: <function at="at" 0x0000022c43a47ba0="0x0000022c43a47ba0"> 
Traceback (most recent call last):
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 116, in __del__
 self.cleanup()
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 235, in cleanup
 self._kill_process()
 File "C:\Users\gmmz5\AppData\Local\Programs\Python\Python311\Lib\site-packages\nextcord\player.py", line 191, in _kill_process
 proc = self._process
 ^^^^^^^^^^^^^
AttributeError: 'FFmpegOpusAudio' object has no attribute '_process'
</function>


-
Keep getting "discord.ext.commands.errors.CommandInvokeError : Command raised an exception : KeyError : 'source'" error
22 février 2023, par krisEverytime 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'



-
Select subtitle stream in ffmpeg in order to take screenshot
7 octobre 2020, par Snake EyesI want to capture screen from mkv which has embedded subtitles which media info looks like :


General
Complete name : MyVideo.mkv
Format : Matroska
Format version : Version 4
File size : 2.25 GiB
Duration : 1 h 47 min
Overall bit rate : 2 993 kb/s
Writing application : mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
Writing library : libebml v1.3.5 + libmatroska v1.4.8

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1 h 47 min
Bit rate : 2 735 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.055
Stream size : 2.05 GiB (91%)
Default : Yes
Forced : No

Audio
ID : 2
Format : E-AC-3
Format/Info : Enhanced AC-3
Commercial name : Dolby Digital Plus
Codec ID : A_EAC3
Duration : 1 h 47 min
Bit rate mode : Constant
Bit rate : 256 kb/s
Channel(s) : 6 channels
Channel layout : L R C LFE Ls Rs
Sampling rate : 48.0 kHz
Frame rate : 31.250 FPS (1536 SPF)
Compression mode : Lossy
Stream size : 197 MiB (9%)
Language : English
Service kind : Complete Main
Default : Yes
Forced : No

Text #1
ID : 3
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 1 h 46 min
Bit rate : 53 b/s
Count of elements : 1626
Stream size : 42.1 KiB (0%)
Title : SDH
Language : English
Default : No
Forced : No

Text #2
ID : 4
Format : UTF-8
Codec ID : S_TEXT/UTF8
Codec ID/Info : UTF-8 Plain Text
Duration : 1 h 46 min
Bit rate : 53 b/s
Count of elements : 1595
Stream size : 41.8 KiB (0%)
Language : Spanish
Default : No
Forced : No

Menu
01:44:57.011 : en:Credits



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


I tried :


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



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


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