
Recherche avancée
Médias (1)
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (62)
-
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)
Sur d’autres sites (6114)
-
OpusError while using ffmpeg library in discord.py
18 avril 2021, par The Assignment NerdWhile playing a local file or youtube audio, I get
OpusError: invalid argument
error

The play command looks like :


# bot.py
import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
from models import *
from discord.voice_client import VoiceClient
import logging
from config import *
import youtube_dl
from youtube_dl import YoutubeDL

@bot.command()
async def play(ctx):
 user=ctx.author
 voice_channel=user.voice.channel
 channel=None
 # only play music if user is in a voice channel
 if voice_channel:
 # grab user's voice channel
 channel=voice_channel.name
 await ctx.send('User is in channel: '+ channel)
 # create StreamPlayer
 vc = await voice_channel.connect()
 url="https://www.youtube.com/watch?v=AOeY-nDp7hI"
 YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist':'True'}
 FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
 voice = discord.utils.get(bot.voice_clients, guild=ctx.guild)
 print(0)
 if not voice.is_playing():
 print("1")
 with YoutubeDL(YDL_OPTIONS) as ydl:
 info = ydl.extract_info(url, download=False)
 print(2)
 URL = info['formats'][0]['url']
 print(3)
 voice.play(discord.FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
 print(4)
 voice.is_playing()
 print("Strated playing")
 else:
 await ctx.send("Already playing song")
 return
 else:
 await ctx.send('User is not in a channel.')



My error :


0
1
[youtube] AOeY-nDp7hI: Downloading webpage
[youtube] Downloading just video AOeY-nDp7hI because of --no-playlist
2
3
Ignoring exception in command play:
Traceback (most recent call last):
 File "/opt/homebrew/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
 ret = await coro(*args, **kwargs)
 File "/Users/mohit/programming/discord/area-51-helper/main.py", line 115, in play
 voice.play(discord.FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
 File "/opt/homebrew/lib/python3.9/site-packages/discord/voice_client.py", line 564, in play
 self.encoder = opus.Encoder()
 File "/opt/homebrew/lib/python3.9/site-packages/discord/opus.py", line 291, in __init__
 self.set_fec(True)
 File "/opt/homebrew/lib/python3.9/site-packages/discord/opus.py", line 326, in set_fec
 _lib.opus_encoder_ctl(self._state, CTL_SET_FEC, 1 if enabled else 0)
 File "/opt/homebrew/lib/python3.9/site-packages/discord/opus.py", line 92, in _err_lt
 raise OpusError(result)
discord.opus.OpusError: invalid argument

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

Traceback (most recent call last):
 File "/opt/homebrew/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
 await ctx.command.invoke(ctx)
 File "/opt/homebrew/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
 await injected(*ctx.args, **ctx.kwargs)
 File "/opt/homebrew/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped
 raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OpusError: invalid argument



I'm using these version


discord.py==1.0.1
ffmpeg==4.3.2
youtube_dl==2021.4.17



-
ffmpeg m4a/m4b/mp4 output file's "Time" value is incorrect when read into iTunes
2 juin 2019, par PistoletPierreI’m using ffmpeg to convert audiobooks to m4a/m4b/mp4. All seems to work until trying to play them in iTunes. It plays in VLC, QuickTime, and MacOS’s Quicklook without issue.
"So why are you posting here ? This isn’t an iTunes forum."
I’m hoping this is iTunes being picky about file formats and that I can add some magic argument to my ffmpeg command and have it spit out something that iTunes can read.
Below is the bash function I’m using to do the conversion. I’ve tried m4a/mp4/m4b as values for TEMP_FILE_EXTENSION and tried opening the intermediate file as well. It’s always the same corrupted "Time" value when you put it in iTunes.
dedrm_audible () {
# Check for AtomicParsley, ffmpeg, and 3 args
if (! type AtomicParsley >/dev/null 2>/dev/null) || (! type ffmpeg >/dev/null 2>/dev/null) || [ ! $# -eq 3 ]; then
echo "Usage:"
echo " dedrm_audible <path to="to"> <activation bytes="bytes"> <path to="to" output="output" file="file">"
echo " Note: AtomicParsley and ffmpeg must be in PATH variable"
return
fi
local ORIGINAL_PWD="$(pwd)"
local TEMP_DIR="/tmp/audible"
local AUDIOBOOK_FILE="$1"
local ACTIVATION_BYTES="$2"
local OUTPUT_FILE="$3"
local FULL_AUDIOBOOK_PATH="$(realpath "${AUDIOBOOK_FILE}")"
local OUTPUT_PATH="$(realpath "${OUTPUT_FILE}")"
local TEMP_FILE_EXTENSION="m4a"
mkdir -p "${TEMP_DIR}"
cd "${TEMP_DIR}"
# Extract the book cover
ffmpeg -activation_bytes "${ACTIVATION_BYTES}" -i "${FULL_AUDIOBOOK_PATH}" -vcodec copy artwork.png
# Convert the audio
ffmpeg -activation_bytes "${ACTIVATION_BYTES}" -i "${FULL_AUDIOBOOK_PATH}" -vn -c:a copy -v debug output.${TEMP_FILE_EXTENSION}
# Add the cover to the new file
AtomicParsley output.${TEMP_FILE_EXTENSION} --artwork artwork.png --overWrite
# Put it where you want it and clean up
cp output.${TEMP_FILE_EXTENSION} "${OUTPUT_PATH}"
rm artwork.png
rm output.${TEMP_FILE_EXTENSION}
cd "${ORIGINAL_PWD}"
}
</path></activation></path>It goes off without a hitch. The new file is there waiting for me, with all the metadata including the cover when I do a "Get Info" or "Quick look" on it (I’m on MacOS). But when opening it and trying to play it in iTunes, the "time" field is way off and it immediately skips to the next song/audiobook in the queue.
Attempts to convert it within iTunes fail immediately - too quickly to see what’s happening. The errors in the console simply say "Assert failure :" (with nothing after the colon).
edit : Tommy answered the question. Here’s a working bash function :
dedrm_audible () {
# Check for AtomicParsley, ffmpeg, and 3 args
if (! type AtomicParsley >/dev/null 2>/dev/null) || (! type ffmpeg >/dev/null 2>/dev/null) || [ ! $# -eq 3 ]; then
echo "Usage:"
echo " dedrm_audible <path to="to"> <activation bytes="bytes"> <path to="to" output="output" file="file">"
echo " Note: AtomicParsley and ffmpeg must be in PATH variable"
return
fi
local ORIGINAL_PWD="$(pwd)"
local TEMP_DIR="/tmp/audible"
local AUDIOBOOK_FILE="$1"
local ACTIVATION_BYTES="$2"
local OUTPUT_FILE="$3"
# Alternative to realpath (since I read somewhere that it's not there by default on some systems): OUTPUT_PATH="$( cd "$( dirname "$OUTPUT_FILE" )" && pwd )"
local FULL_AUDIOBOOK_PATH="$(realpath "${AUDIOBOOK_FILE}")"
local AUDIOBOOK_NAME="${$(basename "${FULL_AUDIOBOOK_PATH}")%.aax}.m4a"
local OUTPUT_PATH="$(realpath "${OUTPUT_FILE}")"
local TEMP_FILE_EXTENSION="m4a"
mkdir -p "${TEMP_DIR}"
cd "${TEMP_DIR}"
cp "${FULL_AUDIOBOOK_PATH}" "${AUDIOBOOK_NAME}"
# Extract the book cover
ffmpeg -activation_bytes "${ACTIVATION_BYTES}" -i "${AUDIOBOOK_NAME}" -vcodec copy artwork.png
# Convert the audio
ffmpeg -activation_bytes "${ACTIVATION_BYTES}" -i "${AUDIOBOOK_NAME}" -vn -c:a copy -v debug output.${TEMP_FILE_EXTENSION}
# Add the cover to the new file
AtomicParsley output.${TEMP_FILE_EXTENSION} --artwork artwork.png --overWrite
# Put it where you want it and clean up
mv output.${TEMP_FILE_EXTENSION} "${OUTPUT_PATH}"
rm artwork.png
rm "${AUDIOBOOK_NAME}"
cd "${ORIGINAL_PWD}"
}
</path></activation></path> -
When I try to play my Music Discord Bot it doesn't play music
1er juin 2020, par EthanDevelopsWhen I try to play my Music Discord Bot it doesn't play music. It uses ytdl-core and ffmpeg
My code is :



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

const ytdl = require("ytdl-core")


const token = 'API TOKEN'

const PREFIX = '?';

var version = '1.2';

var servers = {};

bot.on('ready', () =>{
 console.log('This bot is online!' + version);
})

bot.on('message', message => {

 let args = message.content.substring(PREFIX.length).split(" ");

 switch(args[0]){
 case 'play':

 function play(connection, message){
 var server = servers[message.guild.id];

 server.dispatcher = connection.play(ytdl(server.queue[0], {filter: "audioonly"}))

 server.queue.shift();

 server.dispatcher.on("end", function(){
 if(server.queue[0]){
 play(connection, message);
 }else {
 connection.disconnect();
 }
 });



 }



 if(!args[1]){
 message.channel.send("You need to provide a link!")
 return;
 }

 if(!message.member.voice.channel){
 message.channel.send("You must be in a Voice Channel to play the bot!")
 return;
 }

 if(!servers[message.guild.id]) servers[message.guild.id] = {
 queue: []
 }

 var server = servers[message.guild.id];

 server.queue.push(args[1]);

 if(!message.guild.voice) message.member.voice.channel.join().then(function(connection){
 play(connection, message);
 })

 break;
 }



 });


 bot.login(token);




Whenever I try to play a song this error happens :





(node:5180) UnhandledPromiseRejectionWarning : Error : FFmpeg/avconv not
 found !
 at Function.getInfo (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\prism-media\src\core\FFmpeg.js:130:11)
 at Function.create (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\prism-media\src\core\FFmpeg.js:143:38)
 at new FFmpeg (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\prism-media\src\core\FFmpeg.js:44:27)
 at AudioPlayer.playUnknown (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20)
 at VoiceConnection.play (C :\Users\picar\Desktop\DiscordMusicBot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28)
 at play (C :\Users\picar\Desktop\DiscordMusicBot\index.js:29:48)
 at C :\Users\picar\Desktop\DiscordMusicBot\index.js:66:17
 at processTicksAndRejections (internal/process/task_queues.js:97:5)
 (node:5180) UnhandledPromiseRejectionWarning : Unhandled promise rejection. This error originated either by throwing inside of an async
 function without a catch block, or by rejecting a promise which was
 not handled with .catch(). To terminate the node process on unhandled
 promise rejection, use the CLI flag
--unhandled-rejections=strict

 (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
 (rejection id : 1)
 (node:5180) [DEP0018] DeprecationWarning : Unhandled promise rejections are deprecated. In the future, promise rejections that are
 not handled will terminate the Node.js process with a non-zero exit
 code




I'm getting very frustrated as the tutorial I'm watching is using a different version of everything !!! Please help.