
Recherche avancée
Autres articles (28)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...) -
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 (...)
Sur d’autres sites (6714)
-
why ffmpeg process successfully terminated with return code of 1 without play anything
24 juillet 2023, par Exc`I tried replacing youtube_dl with yt_dlp and replaced some of the code, the code worked fine but when using the command, the bot doesn't play music but immediately ffmpeg process 15076 successfully terminated with return code of 1


Is there a problem with my code or the ffmpg option or ytdlp option that doesn't support the yt_dlp library ?`


self.YTDL_OPTIONS = {
 'format': 'bestaudio/best',
 'outtmpl': 'F:/DISCORD BOT/Ex/music/%(extractor)s-%(id)s-%(title)s.%(ext)s',
 'restrictfilenames': True,
 'retry_max': 'auto',
 'noplaylist': True,
 'nocheckcertificate': True,
 'ignoreerrors': True,
 'logtostderr': False,
 'quiet': True,
 'no_warnings': True,
 'default_search': 'auto',
 'source_address': '0.0.0.0',
 'postprocessors': [{
 'key': 'FFmpegExtractAudio',
 'preferredcodec': 'mp3',
 'preferredquality': '192',
 }],
 'youtube_api_key': 'api'
 }
self.FFMPEG_OPTIONS = {
 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
 'options': '-vn',
 'executable':r'F:\DISCORD BOT\Ex\ffmpeg\bin\ffmpeg.exe'
 }

 
 @commands.hybrid_command(
 name="play",
 aliases=["p"],
 usage="",
 description="KARAUKENAN.",
 
 )
 @app_commands.describe(
 judul_lagu="link ato judul lagunya"
 )
 async def play(self, ctx, judul_lagu:str):
 await ctx.defer()
 voice_channel = ctx.author.voice
 if not voice_channel or not voice_channel.channel:
 await ctx.send("Join voice channel dulu gblk!")
 return

 voice_channel = voice_channel.channel
 song = self.search_song(judul_lagu)
 if not song:
 await ctx.send("Lagnya tdk ditemukan, coba keword lain.")
 return

 if not self.bot.voice_clients:
 voice_client = await voice_channel.connect()
 else:
 voice_client = self.bot.voice_clients[0]
 if voice_client.channel != voice_channel:
 await voice_client.move_to(voice_channel)

 self.music_queue.append([song, voice_client])
 if not self.is_playing:
 await self.play_music(ctx)
 
 async def play_music(self, ctx):
 self.is_playing = True
 while len(self.music_queue) > 0:
 song = self.music_queue[0][0]
 voice_client = self.music_queue[0][1]
 await ctx.send(f"Playing {song['title']}")

 voice_client.play(discord.FFmpegPCMAudio(song['source'], **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
 voice_client.is_playing()

 while voice_client.is_playing():
 await asyncio.sleep(1)

 self.music_queue.pop(0)
 self.is_playing = False

 await ctx.send("Queue is empty.")
 voice_client.stop()

 def play_next(self):
 if len(self.music_queue) > 0:
 self.is_playing = False

 def search_song(self, judul_lagu):
 ydl = yt_dlp.YoutubeDL(self.YTDL_OPTIONS)
 with ydl:
 try:
 info = ydl.extract_info(f"ytsearch:{judul_lagu}", download=False)['entries'][0]
 return {'source': info['formats'][0]['url'], 'title': info['title']}
 except Exception:
 return None





when i use /play the bot sucess serch song but immediately terminate does not play any music


2023-04-10 13:06:45 INFO discord.voice_client Connecting to voice...
2023-04-10 13:06:45 INFO discord.voice_client Starting voice handshake... (connection attempt 1)
2023-04-10 13:06:46 INFO discord.voice_client Voice handshake complete. Endpoint found singapore11075.discord.media
2023-04-10 13:06:50 INFO discord.player ffmpeg process 15076 successfully terminated with return code of 1.





-
DiscordJS 14 Voice works on Windows but not Linux
20 décembre 2023, par WoscaDiscord.js V14 voice works on windows but as soon as I run it through an Ubuntu server, it doesn't work. I have install all dependencies on both platforms. Whenever I try to play audio through the Ubuntu server it gets the bot to join the voice channel, but no sound is played. I have narrowed it down to some sort of playback issue with FFMpeg, and I have tried using opus. Here is the Dependency report generated on the ubuntu server :




Core Dependencies


- 

- @discordjs/voice : 0.16.1
- prism-media : 1.3.5

Opus Libraries - @discordjs/opus : 0.9.0
- opusscript : not found

Encryption Libraries - sodium-native : 4.0.4
- sodium : not found
- libsodium-wrappers : 0.7.13
- tweetnacl : not found

FFmpeg - version : 6.0-static
- libopus : yes
























Here is the file it is using to run the music. There are no errors in the output :


const fs = require("fs");
const { SlashCommandBuilder } = require("@discordjs/builders");
const {
 AudioPlayerStatus,
 createAudioPlayer,
 createAudioResource,
 joinVoiceChannel,
 StreamType,
} = require("@discordjs/voice");
module.exports = {
 data: new SlashCommandBuilder()
 .setName("play")
 .setDescription("Plays a song.")
 .addAttachmentOption((option) =>
 option
 .setName("song")
 .setDescription("The song to play.")
 .setRequired(true)
 ),

 async execute(interaction) {
 await interaction.reply({ content: "Preparing song...", ephemeral: true });
 const attachment = interaction.options.getAttachment("song");
 const channel = interaction.member.voice.channel;
 if (!channel)
 return await interaction.editReply({
 content: "Join a voice channel!",
 ephemeral: true,
 });
 const connection = joinVoiceChannel({
 channelId: channel.id,
 guildId: channel.guild.id,
 adapterCreator: channel.guild.voiceAdapterCreator,
 });
 const player = createAudioPlayer();
 console.log(attachment.url);
 const resource = createAudioResource(attachment.url, {
 inputType: StreamType.Opus,
 });
 player.play(resource);
 connection.subscribe(player);
 await interaction.editReply({
 content: `Playing ${attachment.name}!`,
 ephemeral: true,
 });
 await new Promise((resolve) => setTimeout(resolve, 2000));
 player.on(AudioPlayerStatus.Idle, () => {
 console.log("destroy");
 connection.destroy();
 });
 },
};



-
I tried programming a discord bot for music, it joins the channel, it apparently "speaks" but i can't hear anything
2 avril 2020, par boraxI tried to code it alone, but I got the same problem, then I copied the code from https://gabrieltanner.org/blog/dicord-music-bot and it persists. I have downloaded FFmpeg, but I still think the problem lies there. Any suggestions ? (it's my first time here, I don't know how much of the code is relevant, also, i get this Error : FFmpeg/avconv not found !)



const Discord = require('discord.js');
const client = new Discord.Client();

const ytdl = require("ytdl-core");

const token = 'REDACTED';

const prefix = '$';

var version = '1.1.2';

var servers = {};

const queue = new Map();

client.on('ready', () => {
 console.log('BOT is online');
})
client.once("ready", () => {
 console.log("Ready!");
 });

 client.once("reconnecting", () => {
 console.log("Reconnecting!");
 });

 client.once("disconnect", () => {
 console.log("Disconnect!");
 });

 client.on("message", async message => {
 if (message.author.bot) return;
 if (!message.content.startsWith(prefix)) return;

 const serverQueue = queue.get(message.guild.id);

 if (message.content.startsWith(`${prefix}play`)) {
 execute(message, serverQueue);
 return;
 } else if (message.content.startsWith(`${prefix}skip`)) {
 skip(message, serverQueue);
 return;
 } else if (message.content.startsWith(`${prefix}stop`)) {
 stop(message, serverQueue);
 return;
 } else {
 message.channel.send("You need to enter a valid command!");
 }
 });

 async function execute(message, serverQueue) {
 const args = message.content.split(" ");

 const voiceChannel = message.member.voice.channel;
 if (!voiceChannel)
 return message.channel.send(
 "You need to be in a voice channel to play music!"
 );
 const permissions = voiceChannel.permissionsFor(message.client.user);
 if (!permissions.has("CONNECT") || !permissions.has("SPEAK")) {
 return message.channel.send(
 "I need the permissions to join and speak in your voice channel!"
 );
 }

 const songInfo = await ytdl.getInfo(args[1]);
 const song = {
 title: songInfo.title,
 url: songInfo.video_url
 };

 if (!serverQueue) {
 const queueContruct = {
 textChannel: message.channel,
 voiceChannel: voiceChannel,
 connection: null,
 songs: [],
 volume: 5,
 playing: true
 };

 queue.set(message.guild.id, queueContruct);

 queueContruct.songs.push(song);

 try {
 var connection = await voiceChannel.join();
 queueContruct.connection = connection;
 play(message.guild, queueContruct.songs[0]);
 } catch (err) {
 console.log(err);
 queue.delete(message.guild.id);
 return message.channel.send(err);
 }
 } else {
 serverQueue.songs.push(song);
 return message.channel.send(`${song.title} has been added to the queue!`);
 }
 }

 function skip(message, serverQueue) {
 if (!message.member.voice.channel)
 return message.channel.send(
 "You have to be in a voice channel to stop the music!"
 );
 if (!serverQueue)
 return message.channel.send("There is no song that I could skip!");
 serverQueue.connection.dispatcher.end();
 }

 function stop(message, serverQueue) {
 if (!message.member.voice.channel)
 return message.channel.send(
 "You have to be in a voice channel to stop the music!"
 );
 serverQueue.songs = [];
 serverQueue.connection.dispatcher.end();
 }

 function play(guild, song) {
 const serverQueue = queue.get(guild.id);
 if (!song) {
 serverQueue.voiceChannel.leave();
 queue.delete(guild.id);
 return;
 }

 const dispatcher = serverQueue.connection
 .play(ytdl(song.url))
 .on("finish", () => {
 serverQueue.songs.shift();
 play(guild, serverQueue.songs[0]);
 })
 .on("error", error => console.error(error));
 dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);
 serverQueue.textChannel.send(`Start playing: **${song.title}**`);
 }

client.login(token);