
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (66)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
(Dés)Activation de fonctionnalités (plugins)
18 février 2011, parPour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)
Sur d’autres sites (6790)
-
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.