
Recherche avancée
Médias (1)
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
Autres articles (29)
-
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 (...) -
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 (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)
Sur d’autres sites (3061)
-
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'



-
Error : "libavformat\avformat.h : No such file or directory"
21 février 2023, par Abdo DaoodI create a simple c++ file called
test.cpp
:

#include <iostream>
#include 
using namespace std;

int main() 
{
 cout << "Hello, World!";
 return 0;
}
</iostream>


and using g++ in terminal to compile test.cpp file with the command :


g++ test.cpp -o test



I get this error :


test.cpp:2:10: fatal error: libavformat\avformat.h: No such file or directory
 2 | #include 
 | ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.



Notes :

libavformat\avformat.h
path is :/usr/include/x86_64-linux-gnu/libavformat/avformat.h


and using ffmpeg version is :


$ ffmpeg -version

ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100



Using this command :


g++ `pkg-config --cflags libavformat` test.cpp `pkg-config --libs libavformat` -o test



-
flient-ffmpeg getting error as "ffmpeg exited with code 1 : pipe:0 : Invalid data found when processing input"
6 avril 2023, par Abhishek RawalI am trying to create API where i need to get uploaded video and create thumbnail from that video. But conditions are :


- 

- Video should not store on local disk
- Once thumbnail is create it should not store on local disk, instead it should directly uploaded to AWS s3 bucket.






Following is the code i am trying with :




const ffmpeg = require('fluent-ffmpeg');
const stream = require('stream');

router.post('/thumbnail', upload.any(), (req, res) => {
 const videoBuffer = req.files[0].buffer;
 
 let readableVideoBuffer = new stream.PassThrough();
 readableVideoBuffer.write(videoBuffer);
 readableVideoBuffer.end()
 
 let bufferStream = new stream.PassThrough();
 
 ffmpeg(readableVideoBuffer)
 .on('filenames', function(filenames) {
 console.log('Will generate ' + filenames.join(', '))
 })
 .on('end', function() {
 console.log('Screenshots taken');
 })
 .on('error', (err) => {
 console.log(err);
 })
 .screenshots({
 count: 4,
 size: '100x100',
 timestamps: ['00:00:01.000'],
 })
 .writeToStream(bufferStream, { end: true }); /* while using this statement i am getting error */
 
 const buffers = [];
 bufferStream.on('data', function (buf) {
 buffers.push(buf);
 });
 bufferStream.on('end', function () {
 const outputBuffer = Buffer.concat(buffers);
 // use s3 bucket code here
 console.log('outputBuffer===========>', outputBuffer)
 });
})







so while calling this API my app is crashing and i am getting error as :




Error : ffmpeg exited with code 1 : pipe:0 : Invalid data found when
processing input




Blockquote


If i am not using this statement :




.writeToStream(bufferStream, end : true ) ;




then able to save file but in local disk, which is not required in my case.


Please help me to understand what is wrong in this code, how i can resolve it.
Any type of help is appreciated.