
Recherche avancée
Autres articles (111)
-
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
Supporting all media types
13 avril 2011, parUnlike 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 (...)
-
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...)
Sur d’autres sites (4007)
-
Matomo’s privacy-friendly web analytics software named best of the year 2022
25 janvier 2023, par Erin -
FFmpegAudio object has no attribute _process
28 janvier 2023, par Benjamin TsoumagasI'm trying to make a Discord music bot that is remotely hosted and to do that I need ffmpeg to work. I was able to add it using my Dockerfile but upon trying to play music with the bot I get the following errors. For context, I am hosting on Fly.io and using python with the Nextcord library. Below is my relevant code and the error message. Please let me know if any more information is required.


import nextcord, os, json, re, youtube_dl
from nextcord import Interaction, application_checks
from nextcord.ext import commands

youtube_dl.utils.bug_reports_message = lambda: ''

ytdl_format_options = {
 "format": "bestaudio/best",
 'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
 'restrictfilenames': True,
 'noplaylist': True,
 'nocheckcertificate': True,
 'ignoreerrors': False,
 'logtostderr': False,
 'quiet': True,
 'no_warnings': True,
 'default_search': 'auto',
 'source_address': '0.0.0.0',
}

ffmpeg_options = {"options": "-vn"}

ytdl = youtube_dl.YoutubeDL(ytdl_format_options)

class YTDLSource(nextcord.PCMVolumeTransformer):
 def __init__(self, source, *, data, volume=0.5):
 super().__init__(source, volume)
 self.data = data
 self.title = data.get("title")
 self.url = data.get("url")

 @classmethod
 async def from_url(cls, url, *, loop=None, stream=False):
 loop = loop or asyncio.get_event_loop()
 data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))

 if "entries" in data:
 data = data["entries"][0]
 
 filename = data["url"] if stream else ytdl.prepare_filename(data)
 return cls(nextcord.FFmpegAudio(filename, *ffmpeg_options), data=data)

async def ensure_voice(interaction: Interaction):
 if interaction.guild.voice_client is None:
 if interaction.user.voice:
 await interaction.user.voice.channel.connect()
 else:
 await interaction.send("You are not connected to a voice channel.")
 raise commands.CommandError("Author not connected to a voice channel.")
 elif interaction.guild.voice_client.is_playing():
 interaction.guild.voice_client.stop()

class Music(commands.Cog, name="Music"):
 """Commands for playing music in voice channels"""

 COG_EMOJI = "🎵"

 def __init__(self, bot):
 self.bot = bot
 
 @application_checks.application_command_before_invoke(ensure_voice)
 @nextcord.slash_command()
 async def play(self, interaction: Interaction, *, query):
 """Plays a file from the local filesystem"""

 source = nextcord.PCMVolumeTransformer(nextcord.FFmpegPCMAudio(query))
 interaction.guild.voice_client.play(source, after=lambda e: print(f"Player error: {e}") if e else None)

 await interaction.send(f"Now playing: {query}")

 @application_checks.application_command_before_invoke(ensure_voice)
 @nextcord.slash_command()
 async def yt(self, interaction: Interaction, *, url):
 """Plays from a URL (almost anything youtube_dl supports)"""

 async with interaction.channel.typing():
 player = await YTDLSource.from_url(url, loop=self.bot.loop)
 interaction.guild.voice_client.play(
 player, after=lambda e: print(f"Player error: {e}") if e else None
 )

 await interaction.send(f"Now playing: {player.title}")

 @application_checks.application_command_before_invoke(ensure_voice)
 @nextcord.slash_command()
 async def stream(self, interaction: Interaction, *, url):
 """Streams from a URL (same as yt, but doesn't predownload)"""

 async with interaction.channel.typing():
 player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True)
 interaction.voice_client.play(
 player, after=lambda e: print(f"Player error: {e}") if e else None
 )

 await interaction.send(f"Now playing: {player.title}")

def setup(bot):
 bot.add_cog(Music(bot))



2023-01-28T23:16:15Z app[7d3b734a] yyz [info]Exception ignored in: <function at="at" 0x7fa78ea61fc0="0x7fa78ea61fc0">
2023-01-28T23:16:15Z app[7d3b734a] yyz [info]Traceback (most recent call last):
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] File "/usr/local/lib/python3.10/site-packages/nextcord/player.py", line 116, in __del__
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] self.cleanup()
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] File "/usr/local/lib/python3.10/site-packages/nextcord/player.py", line 235, in cleanup
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] self._kill_process()
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] File "/usr/local/lib/python3.10/site-packages/nextcord/player.py", line 191, in _kill_process
2023-01-28T23:16:15Z app[7d3b734a] yyz [info]AttributeError: 'FFmpegA
2023-01-28T23:16:15Z app[7d3b734a] yyz [info]AttributeError: 'FFmpegA
dio' object has no attribute '_process'
2023-01-28T23:16:15Z app[7d3b734a] yyz [info]Ignoring exception in command :
2023-01-28T23:16:15Z app[7d3b734a] yyz [info]Traceback (most recent call last):
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] File "/usr/local/lib/python3.10/site-packages/nextcord/application_command.py", line 863, in invoke_callback_with_hooks
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] await self(interaction, *args, **kwargs)
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] File "/main/cogs/music.py", line 153, in yt
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] player = await YTDLSource.from_url(url, loop=self.bot.loop)
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] File "/main/cogs/music.py", line 71, in from_url 
2023-01-28T23:16:15Z app[7d3b734a] yyz [info] return cls(nextcord.FFmpegAudio(filename, *ffmpeg_options), data=data)
2023-01-28T23:16:15Z app[7d3b734a] yyz [info]
The above exception was the direct cause of the following exception:

re given
2023-01-28T23:16:15Z app[7d3b734a] yyz [info]The above exception was the direct cause of the following exception:
2023-01-28T23:16:15Z app[7d3b734a] yyz [info]nextcord.errors.ApplicationInvokeError: Command raised an exception: TypeError: FFmpegAudio.__init__() takes 2 positional arguments but 3 were given 
2023-01-28T23:16:19Z app[7d3b734a] yyz [info]Exception ignored in: <function at="at" 0x7fa78ea61fc0="0x7fa78ea61fc0">
2023-01-28T23:16:19Z app[7d3b734a] yyz [info]Traceback (most recent call last):
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] File "/usr/local/lib/python3.10/site-packages/nextcord/player.py", line 116, in __del__
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] self.cleanup()
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] File "/usr/local/lib/python3.10/site-packages/nextcord/player.py", line 235, in cleanup
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] self._kill_process()
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] File "/usr/local/lib/python3.10/site-packages/nextcord/player.py", line 191, in _kill_process
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] proc = self._process
2023-01-28T23:16:19Z app[7d3b734a] yyz [info]AttributeError: 'FFmpegAudio' object has no attribute 
'_process'
2023-01-28T23:16:19Z app[7d3b734a] yyz [info]Ignoring exception in command :
2023-01-28T23:16:19Z app[7d3b734a] yyz [info]Traceback (most recent call last):
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] File "/usr/local/lib/python3.10/site-packages/nextcord/application_command.py", line 863, in invoke_callback_with_hooks
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] await self(interaction, *args, **kwargs)
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] File "/main/cogs/music.py", line 153, in yt
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] player = await YTDLSource.from_url(url, loop=self.bot.loop)
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] File "/main/cogs/music.py", line 71, in from_url 
2023-01-28T23:16:19Z app[7d3b734a] yyz [info] return cls(nextcord.FFmpegAudio(filename, *ffmpeg_options), data=data)
2023-01-28T23:16:19Z app[7d3b734a] yyz [info]TypeError: FFmpegAudio.__init__() takes 2 positional arguments but 3 were given
2023-01-28T23:16:19Z app[7d3b734a] yyz [info]The above exception was the direct cause of the following exception:
2023-01-28T23:16:19Z app[7d3b734a] yyz [info]nextcord.errors.ApplicationInvokeError: Command raised an exception: TypeError: FFmpegAudio.__init__() takes 2 positional arguments but 3 were given
</function></function>


Similar posts have been made but their issues were typos in changing 'option' : '-vn' to 'options' : '-vn'. I've combed through for any other errors but I can't find any. I was hoping to see I made a similar mistake, but this is the template I was following from the Nextcord developers and I had no luck :


-
What is Multi-Touch Attribution ? (And How To Get Started)
2 février 2023, par Erin — Analytics Tips