Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (107)

  • Soumettre améliorations et plugins supplémentaires

    10 avril 2011

    Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
    Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (14193)

  • Discord bot returns ffmpeg error despite being added to PATH

    22 février 2024, par Sam

    I 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 sarsonj

    I 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 njoye

    Thanks 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 a File 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 through homebrew following this article and compiled OpenCV from the official source. This is the CMakeCache.txt that CMake 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 equals False and image equals None.
    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 used ffmpeg in previous (not OpenCV-related) projects and CMakeCache.txt reports that ffmpeg 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 of cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules ../ >> result.txt : pastebin