
Recherche avancée
Autres articles (60)
-
Contribute to documentation
13 avril 2011Documentation 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 (...) -
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...) -
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)
Sur d’autres sites (4635)
-
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 :


-
Trying loop an mp3 and output the mp3 with ffmpeg
12 février 2023, par Chewie The ChorkieI have a 7 second mp3. I want to loop it 3 times and give me back the output. It only plays once in the output, though.


I've tried setting the duration to 21 seconds instead (the atrim parameter), but in that case the output will only play once, and the remaining 14 seconds is silent.


ffmpeg -i explosion.mp3 -filter_complex "[0:a]aresample=async=1:min_hard_comp=0.100000:first_pts=0,apad,atrim=end=7,aloop=loop=3:size=0[outa]" -map "[outa]" -c:a libmp3lame -q:a 2 output.mp3



-
wrong play audio samples
8 août 2014, par Ivan LisovichI have a problem with a ffmpeg and NAudio libs.
I worked with the old ffmpeg library and there the audio plays correctly.
read video in manage c++// Read frames and save to list audio frames
while(av_read_frame(pFormatCtx, &packet) >= 0)
{
if(packet.stream_index == videoStream)
{
// reade image
}
else if(packet.stream_index == audioStream)
{
int b = av_dup_packet(&packet);
if(b >= 0) {
int audio_pkt_size = packet.size;
libffmpeg::uint8_t* audio_pkt_data = packet.data;
while(audio_pkt_size > 0)
{
int got_frame = 0;
int len1 = libffmpeg::avcodec_decode_audio4(aCodecCtx, &frame, &got_frame, &packet);
if(len1 < 0)
{
/* if error, skip frame */
audio_pkt_size = 0;
break;
}
audio_pkt_data += len1;
audio_pkt_size -= len1;
if (got_frame)
{
int data_size = libffmpeg::av_samples_get_buffer_size ( NULL, aCodecCtx->channels, frame.nb_samples, aCodecCtx->sample_fmt, 1 );
array<byte>^ managedBuf = gcnew array<byte>(data_size);
System::IntPtr iptr = System::IntPtr( frame.data[0] );
System::Runtime::InteropServices::Marshal::Copy( iptr, managedBuf, 0, data_size );
audioData->Add(managedBuf);
}
}
}
}
// Free the packet that was allocated by av_read_frame
libffmpeg::av_free_packet(&packet);
}
</byte></byte>I return audioData to c# code and play in NAudio library
play in c#var recordingFormat = new WaveFormat(reader.SampleRate, 16, reader.Channels);
var waveProvider = new BufferedWaveProvider(recordingFormat) { DiscardOnBufferOverflow = true, BufferDuration = TimeSpan.FromMilliseconds(10000) };
var waveOut = new DirectSoundOut();
waveOut.Init(waveProvider);
waveOut.Play();
foreach (byte[] data in audioData)
{
waveProvider.AddSamples(data, 0, data.Length);
}but audio not playing.
what am I doing wrong ?