Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (111)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Les notifications de la ferme

    1er décembre 2010, par

    Afin d’assurer une gestion correcte de la ferme, il est nécessaire de notifier plusieurs choses lors d’actions spécifiques à la fois à l’utilisateur mais également à l’ensemble des administrateurs de la ferme.
    Les notifications de changement de statut
    Lors d’un changement de statut d’une instance, l’ensemble des administrateurs de la ferme doivent être notifiés de cette modification ainsi que l’utilisateur administrateur de l’instance.
    À la demande d’un canal
    Passage au statut "publie"
    Passage au (...)

  • Initialisation de MediaSPIP (préconfiguration)

    20 février 2010, par

    Lors de l’installation de MediaSPIP, celui-ci est préconfiguré pour les usages les plus fréquents.
    Cette préconfiguration est réalisée par un plugin activé par défaut et non désactivable appelé MediaSPIP Init.
    Ce plugin sert à préconfigurer de manière correcte chaque instance de MediaSPIP. Il doit donc être placé dans le dossier plugins-dist/ du site ou de la ferme pour être installé par défaut avant de pouvoir utiliser le site.
    Dans un premier temps il active ou désactive des options de SPIP qui ne le (...)

Sur d’autres sites (6680)

  • How to replace the video track in a video file with a still image ?

    22 février 2021, par cornerstore

    I am trying to use ffmpeg to replace the video track in a video file with a still image. I tried some commands I got from other questions such as the one here

    


    ffmpeg -i x.png -i orig.mp4 final.mp4

    


    ffmpeg -r 1/5 -i x.png -r 30 -i orig.mp4 final.mp4

    


    But these didn't work. I'm not sure which of these arguments are required or not. The output should be accepted by YouTube as a valid video - I was able to simply remove the video track, but apparently they don't let you upload a video without a video track.

    


  • Pycord Music Bot : AttributeError : 'FFmpegAudio' object has no attribute '_process'

    5 juin 2022, par Steven Mao

    I've made a discord Cog that should be able to queue up and play music, but I'm getting an error from FFmpeg when I actually try to play the URL. I have found an identical question on StackOverflow, but this user's problem was a random typo. The inputs should all be correct, so I am not sure if the problem is my code or my package.

    


    What have I done wrong ?

    


    class MusicClass(commands.Cog):
    #universal attributes
    YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'}
    FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}

    def __init__(self, bot):
        self.bot = bot
        self.is_playing = False
        self.music_queue = [[],''] #[[music1, music2, music3...], channel_obj]
        self.vc = ''

    @commands.command()
    async def join(self, ctx):
        if not ctx.message.author.voice:
            await ctx.send("{} is not connected to a voice channel".format(ctx.message.author.name))
            return
        else:
            channel = ctx.message.author.voice.channel
        await channel.connect()

    @commands.command()
    async def leave(self, ctx):
        voice_client = ctx.message.guild.voice_client
        if voice_client.is_connected():
            await voice_client.disconnect()
        else:
            await ctx.send("The bot is not connected to a voice channel.")
    
    #rtype: list[dict{str:}]
    #params: search string/web URL, top number of results to show
    #returns list of top 5 queries and their information
    def search_yt(self, search_query, num_results = 3):
        with YoutubeDL(self.YDL_OPTIONS) as ydl:
            try:
                top_results = ydl.extract_info(f"ytsearch{num_results}:{search_query}", download=False)['entries'][0:{num_results}]
                for i in range(len(top_results)):
                    top_results[i] = {
                        'title': top_results[i]['title'],
                        'source': top_results[i]['formats'][0]['url'],
                        'channel': top_results[i]['channel'],
                        'duration': top_results[i]['duration'],
                        'url': top_results[i]['webpage_url']
                    }
            except:
                print(f'SEARCH_YT ERROR\t search="{search_query}"')
                return False
            return top_results
    
    #rtype: None
    #looks at queue, decides whether to play the next song in queue or stop
    def play_next(self):
        print('called play_next')
        if len(self.music_queue) > 0:
            self.is_playing = True
            #assigns url AND removes from queue
            music_url = self.music_queue[0][0]['source']
            self.music_queue[0].pop(0)
            self.vc.play(discord.FFmpegAudio(music_url, **self.FFMPEG_OPTIONS), after = lambda e: self.play_next())
        else:
            self.is_playing = False

    #rtype: None
    #similar to play_next but optimized for first-time playing
    #checks if a song in queue + checks if bot's connected, then begins to play
    async def play_now(self):
        print('called play_now, queue:', self.music_queue[0])
        if len(self.music_queue) > 0:
            self.is_playing = True
            music_url = self.music_queue[0][0]['source']
            if self.vc == '' or not self.vc.is_connected():
                self.vc = await self.music_queue[1].connect()
            else:
                print('moving to new channel')
                self.vc = await self.bot.move_to(self.music_queue[1])
            self.music_queue[0].pop(0)

            #######################################################################################################
            print('ERROR HAPPENS RIGHT HERE')
            self.vc.play(discord.FFmpegAudio(music_url, **self.FFMPEG_OPTIONS), after = lambda e: self.play_next())
            #######################################################################################################
            
        else:
            self.is_playing = False

    @commands.command()
    #dynamically checks for URL link or search query, then attempts to play
    async def p(self, ctx, *args):
        voice_channel = ctx.author.voice.channel

        if voice_channel == None: #not in a VC
            await ctx.send('You have to be in a voice channel first')
            return
        else: #set channel, search and play music
            if self.music_queue[1] != voice_channel:
                self.music_queue[1] = voice_channel
            if args[0].startswith('https://www.youtube.com/watch'): #search URL
                #search web_url directly and send object to music queue
                with YoutubeDL(self.YDL_OPTIONS) as ydl:
                    try:
                        print('attempting to extract URL:', args[0])
                        music_obj = ydl.extract_info(args[0], download=False)
                        music_obj = {
                        'title': music_obj['title'],
                        'source': music_obj['formats'][0]['url'],
                        'channel': music_obj['channel'],
                        'duration': music_obj['duration'],
                        'url': music_obj['webpage_url']
                        }
                        print('music object:', music_obj)
                        print('appending URL song queue')
                        self.music_queue[0].append(music_obj)
                    except:
                        print('URL search failed. URL =', args[0])
            else: #search query, display search results, ask for which one, then add to queue
                num_results = args[len(args)-1] if args[len(args)-1].isdigit() else 3
                song_list = self.search_yt(' '.join(args), num_results)
            
            if not self.is_playing:
                await self.play_now()


    


    Now my error message...

    


    Exception ignored in: <function at="at" 0x7ff4b0a5b5e0="0x7ff4b0a5b5e0">&#xA;Traceback (most recent call last):&#xA;  File "/home/stevenmao/.local/lib/python3.8/site-packages/discord/player.py", line 127, in __del__&#xA;    self.cleanup()&#xA;  File "/home/stevenmao/.local/lib/python3.8/site-packages/discord/player.py", line 247, in cleanup&#xA;    self._kill_process()&#xA;  File "/home/stevenmao/.local/lib/python3.8/site-packages/discord/player.py", line 198, in _kill_process&#xA;    proc = self._process&#xA;AttributeError: &#x27;FFmpegAudio&#x27; object has no attribute &#x27;_process&#x27;&#xA;</function>

    &#xA;

  • Why i get error when i try to run command play in python script of discord bot

    30 mai 2022, par UNDERTAKER 86

    My code of music discord bot :

    &#xA;

    import ffmpeg&#xA;import asyncio&#xA;import discord&#xA;from discord.ext import commands&#xA;import os&#xA;import requests&#xA;import random&#xA;import json&#xA;from replit import db&#xA;import youtube_dl&#xA;from keep_alive import keep_alive&#xA;&#xA;class music(commands.Cog):&#xA;    def __init__(self, client):&#xA;        self.client = client&#xA;&#xA;    @commands.command()&#xA;    async def join(self, ctx):&#xA;        if ctx.author.voice is None:&#xA;            await ctx.send(f&#x27;{ctx.message.author.mention}, Ты не подключён к голосовому чату!&#x27;)&#xA;        voice_channel = ctx.author.voice.channel&#xA;        if ctx.voice_client is None:&#xA;            await voice_channel.connect()&#xA;        else:&#xA;            await ctx.voice_client.move_to(voice_channel)&#xA;  &#xA;    @commands.command()&#xA;    async def leave(self, ctx):&#xA;        if ctx.author.voice is None:&#xA;            await ctx.send(f&#x27;{ctx.message.author.mention}, Ты не подключён к голосовому чату!&#x27;)&#xA;        else:&#xA;            await ctx.voice_client.disconnect()&#xA;            await ctx.send(f&#x27;{ctx.message.author.mention}, Пока!&#x27;)&#xA;&#xA;    @commands.command()&#xA;    async def play(self, ctx, *, url):&#xA;        if ctx.author.voice is None:&#xA;            await ctx.send(f&#x27;{ctx.message.author.mention}, Ты не подключён к голосовому чату!&#x27;)&#xA;        ctx.voice_client.stop()&#xA;        ffmpeg_options = {&#x27;before_options&#x27;: &#x27;-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5&#x27;, &#x27;options&#x27;: &#x27;-vn&#x27;}&#xA;        YDL_OPTIONS = {&#x27;format&#x27;: &#x27;bestaudio/best&#x27;, &#x27;noplaylist&#x27;: &#x27;True&#x27;, &#x27;simulate&#x27;: &#x27;True&#x27;,&#xA;                       &#x27;preferredquality&#x27;: &#x27;32bits&#x27;, &#x27;preferredcodec&#x27;: &#x27;wav&#x27;, &#x27;key&#x27;: &#x27;FFmpegExtractAudio&#x27;}&#xA;        vc = ctx.voice_client&#xA;&#xA;        with youtube_dl.YoutubeDL(YDL_OPTIONS) as ydl:&#xA;            if &#x27;https://&#x27; in url:&#xA;                info = ydl.extract_info(url, download=False)&#xA;            else:&#xA;                info = ydl.extract_info(f&#x27;ytsearch:{url}&#x27;, download=False)[&#x27;entries&#x27;][0]&#xA;            url2 = info[&#x27;formats&#x27;][0][&#x27;url&#x27;]&#xA;            source = await discord.FFmpegOpusAudio.from_probe(url2, **ffmpeg_options)&#xA;            vc.play(source)&#xA;&#xA;    @commands.command()&#xA;    async def pause(self, ctx):&#xA;        if ctx.author.voice is None:&#xA;            await ctx.send(f&#x27;{ctx.message.author.mention}, Ты не подключён к голосовому чату!&#x27;)&#xA;            await ctx.voice_client.pause()&#xA;            await ctx.send(f&#x27;{ctx.message.author.mention}, Пауза&#x27;)&#xA;&#xA;    @commands.command()&#xA;    async def resume(self, ctx):&#xA;        if ctx.author.voice is None:&#xA;            await ctx.send(f&#x27;{ctx.message.author.mention}, Ты не подключён к голосовому чату!&#x27;)&#xA;            await ctx.voice_client.resume()&#xA;            await ctx.send(f&#x27;{ctx.message.author.mention}, Играет&#x27;)&#xA;&#xA;#    @commands.command()&#xA; #   async def stop(self, ctx):&#xA;  #      await ctx.voice_client.stop()&#xA;   #     ctx.send(f&#x27;{author.mention}, Остановлен&#x27;)&#xA;&#xA;#   @commands.command()&#xA; #  async def repeat(self, ctx):&#xA;  #    await ctx.voice_client.repeat()&#xA;   #   ctx.send(f&#x27;{author.mention}, Повтор&#x27;)&#xA;&#xA;#   @commands.command()&#xA; #  async def loop(self, ctx):&#xA;  #    await ctx.voice_client.loop()&#xA;   #   ctx.send(f&#x27;{author.mention}, Повтор&#x27;)&#xA;&#xA;keep_alive()&#xA;def setup(client):&#xA;    client.add_cog(music(client))&#xA;

    &#xA;

    But i get error when i write in discord command play :

    &#xA;

    [youtube] rUd2diUWDyI: Downloading webpage&#xA;[youtube] Downloading just video rUd2diUWDyI because of --no-playlist&#xA;[youtube] rUd2diUWDyI: Downloading webpage&#xA;[youtube] Downloading just video rUd2diUWDyI because of --no-playlist&#xA;Ignoring exception in command play:&#xA;Traceback (most recent call last):&#xA;  File "/home/runner/MBOT/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped&#xA;    ret = await coro(*args, **kwargs)&#xA;  File "/home/runner/MBOT/music.py", line 51, in play&#xA;    source = await discord.FFmpegOpusAudio.from_probe(url2, **ffmpeg_options)&#xA;  File "/home/runner/MBOT/venv/lib/python3.8/site-packages/discord/player.py", line 387, in from_probe&#xA;    return cls(source, bitrate=bitrate, codec=codec, **kwargs)&#xA;  File "/home/runner/MBOT/venv/lib/python3.8/site-packages/discord/player.py", line 324, in __init__&#xA;    super().__init__(source, executable=executable, args=args, **subprocess_kwargs)&#xA;  File "/home/runner/MBOT/venv/lib/python3.8/site-packages/discord/player.py", line 138, in __init__&#xA;    self._process = self._spawn_process(args, **kwargs)&#xA;  File "/home/runner/MBOT/venv/lib/python3.8/site-packages/discord/player.py", line 147, in _spawn_process&#xA;    raise ClientException(executable &#x2B; &#x27; was not found.&#x27;) from None&#xA;discord.errors.ClientException: ffmpeg was not found.&#xA;

    &#xA;

    I try install ffmpeg in console python, but this dont helped me. Please, give me answer on my question. I use service replit.com to coding on python. Because i want to install this script on server. How i can solve this problem ?

    &#xA;