
Recherche avancée
Médias (91)
-
Les Miserables
9 décembre 2019, par
Mis à jour : Décembre 2019
Langue : français
Type : Textuel
-
VideoHandle
8 novembre 2019, par
Mis à jour : Novembre 2019
Langue : français
Type : Video
-
Somos millones 1
21 juillet 2014, par
Mis à jour : Juin 2015
Langue : français
Type : Video
-
Un test - mauritanie
3 avril 2014, par
Mis à jour : Avril 2014
Langue : français
Type : Textuel
-
Pourquoi Obama lit il mes mails ?
4 février 2014, par
Mis à jour : Février 2014
Langue : français
-
IMG 0222
6 octobre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Image
Autres articles (100)
-
Encodage et transformation en formats lisibles sur Internet
10 avril 2011MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...) -
Monitoring de fermes de MediaSPIP (et de SPIP tant qu’à faire)
31 mai 2013, parLorsque l’on gère plusieurs (voir plusieurs dizaines) de MediaSPIP sur la même installation, il peut être très pratique d’obtenir d’un coup d’oeil certaines informations.
Cet article a pour but de documenter les scripts de monitoring Munin développés avec l’aide d’Infini.
Ces scripts sont installés automatiquement par le script d’installation automatique si une installation de munin est détectée.
Description des scripts
Trois scripts Munin ont été développés :
1. mediaspip_medias
Un script de (...) -
Problèmes fréquents
10 mars 2010, parPHP et safe_mode activé
Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site
Sur d’autres sites (14991)
-
Discord bot returns ffmpeg error despite being added to PATH
22 février 2024, par SamI am creating a Discord bot to play music via Youtube as practice with APIs. Every time I run the command to play a Youtube video I am met with "ffmpeg was not found". I have downloaded ffmpeg (as I'm on Windows) and moved the folder to my C : drive. Once done, I've added it to the path within environment variables. The error persists.


- 

- I've added ffmpeg to my PATH as described in this video.
- Additionally, I've found forums where the suggested answer is to add ffmpeg to your PATH.






In command prompt, if I type "ffmpeg" it returns "'FFmpeg' is not recognized as an internal or external command, operable program or batch file."


Here is my code :


from typing import Final
import os
from dotenv import load_dotenv
from discord import Intents, Client, Message
from responses import get_response
import asyncio
import yt_dlp
import discord

#Step 0: Load our token from somewhere safe
load_dotenv()
#Final decorator makes it so that this cannot be overwritten or have subclasses
TOKEN: Final[str] = os.getenv('DISCORD_TOKEN')


voice_clients = {}
#Settings for the video download.
yt_dl_opts = {'format': 'bestaudio/best'}
ytdl = yt_dlp.YoutubeDL(yt_dl_opts)

#Settings for ffmpeg. 
ffmpeg_options = {'options': '-vn'}

# Step 1: Bot Setup - activate intents
intents: Intents = Intents.default()
intents.message_content = True #NOQA
client: Client = Client(intents=intents)

#Step 2: Message Functionality
async def send_message(message: Message, user_message: str):
 if not user_message:
 print('Message was empty because intents were not enabled... probably')
 return
 
 # The := "Walrus Operator" is used to prompt for input.
 if is_private := user_message[0] == '?':
 user_message = user_message[1:]
 
 try:
 response: str = get_response(user_message)
 await message.author.send(response) if is_private else await message.channel.send(response)
 except Exception as e:
 print(e)

#Step 3: Handling the startup for our bot.
 
@client.event
async def on_ready() -> None:
 print(f"{client.user} is now running")

#Step 4: Handle incoming messages
@client.event
async def on_message(message: Message) -> None:
 if message.author == client.user:
 return
 
 username: str = str(message.author)
 user_message: str = message.content
 channel: str = str(message.channel)

 print(f"[{channel}] {username}: '{user_message}")
 await send_message(message, user_message)

 if message.content.startswith("!play"):
 try:
 url = message.content.split()[1]
 
 #Handles the voice connection that a bot has to a certain channel
 voice_client = await message.author.voice.channel.connect()
 voice_clients[voice_client.guild.id] = voice_client

 loop = asyncio.get_event_loop()
 data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=False))

 song = data['url']
 player = discord.FFmpegPCMAudio(song, **ffmpeg_options)

 voice_client.play(player)



 except Exception as err:
 print(err)

# Step 5: Main entry point
def main() -> None:
 client.run(token=TOKEN)

if __name__ == '__main__':
 main()```



-
cannot open file using avformat_open_input - returns "Cannot open ! Invalid data found when processing input"
21 juin 2012, par sarsonjI am just playing with ffmpeg on iOS 5. I started with something simple, like opening .mov file.
The code fragment :
AVFormatContext *pFormatCtx = NULL;
av_register_all();
NSString* fileName = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mov"];
NSLog(@"File exists? %i", [[NSFileManager defaultManager] fileExistsAtPath:fileName]);
NSLog(@"FIle name: %@", fileName);
char errbuf[256];
int ret = avformat_open_input(&pFormatCtx, [fileName UTF8String], NULL, NULL);
if(ret != 0) {
av_strerror(ret,errbuf,sizeof(errbuf));
NSLog(@"Cannot open! %s", errbuf);
} else {
NSLog(@"Opened!");
}The test.mov exists in my bundle and avformat_open_input is trying to open it - but the avformat_open_input always returns (when decoded error code to string) :
Invalid data found when processing input.
(the error code when the file is missing is another text, I tried it).
I suppose that maybe ffmpg is not compiled with .mov support, but I am not able to open any movie file. I tried to look at ./configure options, but didn't find any hint.
-
ffmpeg avcodec_open2 returns -22 if I change my speaker configuration
5 octobre 2014, par pacificatorI keep having a strange issue lately.
Depending on how I set up my audio configuration in windows ( stereo/quad/5.1 ), a ffmpeg call to avcodec_open2() fails with error -22 or just works.
Not being able to find much about that error, I thought I should ask about it here.
The main flow goes like this :c = st->codec;
avformat_alloc_output_context2(&oc, NULL, NULL, "video.mpeg");
oc->fmt->audio_codec = AV_CODEC_ID_MP2;
AVDictionary* dict = NULL;
ret = av_dict_set(&dict, "ac", "2", 0);
c->request_channels = 2;
ret = avcodec_open2(c, codec, &dict); //HERE IT FAILS WITH -22 if speaker configuration is not stereoThe codec context ’c’ is set up like this in a stream :
st = avformat_new_stream(oc, *codec);
c = st->codec;
c->channels = 2;
c->channel_layout = AV_CH_LAYOUT_STEREO;
c->sample_fmt = AV_SAMPLE_FMT_S16;
c->codec_id = codec_id;Most of it is copied from their one of the muxing examples found in the documentation.
Everything works as expected if in windows I have set the output to stereo.If I set my speaker configuration to 5.1 ( 6 channels ), avcodec_open2 fails with error -22.
So I have a hard time understanding what am I doing wrong. Normally it should not be any relationship between my speaker configuration and the result of avcodec_open2.
Are there some other parameters that I need to set ?