
Recherche avancée
Autres articles (76)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)
Sur d’autres sites (10368)
-
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.
-
OpenCV (3.3.0) returns fail on VideoCapture with Video but works with Webcam [OS X]
1er novembre 2017, par njoyeThanks for reading already, I’ve been trying to get this to work for a day and I didn’t get closer to the solution.
I’m trying to get this object tracker to work. When I use a video from my webcam (with :
python object-tracker-single.py -d 0
, everything works as expected.But as soon as I’m trying to use a video file (i’ve tried different formats :
.mp4
,.mkv
&.avi
. I also tried to use the file given in the repository, that didn’t work as well. To see if there is aFile not found
-Error, I passed an invalid path to the function and an error got printed, that has not been printed when I used the other videos. So the file(s) i’m using is(/are) valid and not corrupted.I installed
dlib
throughhomebrew
following this article and compiledOpenCV
from the official source. This is the CMakeCache.txt thatCMake
spit out. After the first time I compiled it, I added opencv_contrib to the mix, thinking that it could help (I also think that I actually needed it), but that didn’t fix the problem.This is the code I’m having problems with :
# Create the VideoCapture object
cam = cv2.VideoCapture(source)
# If Camera Device is not opened, exit the program
if not cam.isOpened():
print "Video device or file couldn't be opened"
exit()
print "Press key `p` to pause the video to start tracking"
while True:
# Retrieve an image and Display it.
retval, img = cam.read() #<-- this returns false when trying to read a video
if not retval:
print "Cannot capture frame device"
exit()At the marked line,
retval
equalsFalse
andimage
equalsNone
.
It would already help me if I could somehow debug this behavior, but I didn’t find any way of doing so.I found that many Windows Users had problems with missing
ffmpeg
support, but that is not the case for me, since I usedffmpeg
in previous (not OpenCV-related) projects andCMakeCache.txt
reports thatffmpeg
has been found and the compilation succeeded.I also tried using a fully qualified file-name for the video file, which either resulted in
Video device or file couldn't be opened
or the given problem.If you have any idea how this problem can be completely resolved, have an Idea on how to solve it or can provide me with a way of properly debugging this behavior, I’d be super glad to here it !
Thanks already !
-
System : MacBook Pro (macOS Sierra
10.12.6
)OpenCV Version :
3.3.0
Dlib Version (not necessary imo, but hey) :
19.4.0
Edit 2
Output ofcmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules ../ >> result.txt
: pastebin