Recherche avancée

Médias (1)

Mot : - Tags -/wave

Autres articles (32)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (7287)

  • 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;

  • FFMPEG not working for larger size file using PHP in my VPS server with CentOS

    28 juillet 2019, par MrinmoyMk

    I want to compress and convert different audio formats into mp3 file using ffmpeg in php. I have already installed ffmpeg and is working fine for files below 0.9 mb. Whenever I try to submit files larger than 0.9 mb then I get error .
    It may be there is some mistake in my VPS server configuration or mistake in my PHP codes. Could you please help me.

    I have also already tried setting the chmod or permission as 777 in my server to the needed files in my server

    This is my PHP code

    if (isset($_POST['submit'])) {

    $path = "song/"; //set your folder path
    $mp3_local=$_FILES['mp3_local']['name'];

    $tmp = $_FILES['mp3_local']['tmp_name'];


    exec("ffmpeg -i ".$tmp." -ab 96k ./out96/$mp3_local.mp3");}

    This is the error message that I receive when submitting files greater than 0.9 mb :

    Forbidden

    You don’t have permission to access /convert.php on this server.

    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

    But now after disabling ModSecurity in my server configuration the above 403 error is gone but still the FFMPEG is not being able to handle larger size files

    How do I solve this ?

  • youtube_dl, ffmpeg, discord.py is not playing songs even w/o streaming

    27 août 2021, par BlueFire02

    I have tried many times to make a basic queue system, I tested the play command to see if it worked back then and it did, unfortunately during this construction I have been having a lot of problems just playing the song. I did try to implement a queueing system but all that comes out is this specific error :

    &#xA;

    [tls @ 0x7f8244705240] IO Error: -9806 [https @ 0x7f824480b000] Will reconnect at 835584 in 0 second(s), error=Input/output error.&#xA;

    &#xA;

    Additional Info : I also installed ffmpeg onto my mac, I only put the 1 file called ffmpeg in my path if that helps but I am pretty sure it has to do something with youtube_dl.

    &#xA;

    Code : (Make sure to put your guild_id in the guild_id spot, another thing is when you invite the bot make sure in the 2auth section click 'bot' and 'application.commands')

    &#xA;

    import discord&#xA;from discord.ext import commands&#xA;import youtube_dl&#xA;from discord_slash import cog_ext, SlashContext&#xA;from youtube_search import YoutubeSearch&#xA;import asyncio&#xA;import os&#xA;&#xA;&#xA;guild_ids = [GUILD ID GOES HERE]&#xA;queue = []&#xA;global is_playing&#xA;is_playing = False&#xA;time_video = 0 &#xA;&#xA;class music(commands.Cog):&#xA;  def __init__(self, client):&#xA;    self.client = client&#xA;  &#xA;  @cog_ext.cog_slash(name="ping", guild_ids=guild_ids)&#xA;  async def ping(self, ctx):&#xA;    await ctx.send(content="Pong!")&#xA;  &#xA;  @cog_ext.cog_slash(name="join", guild_ids=guild_ids)&#xA;  async def join(self, ctx):&#xA;    if ctx.author.voice is None:&#xA;      return await ctx.send ("You are not in a voice channel!")&#xA;    voice_channel = ctx.author.voice.channel&#xA;    await voice_channel.connect()&#xA;    await ctx.guild.change_voice_state(channel=ctx.author.voice.channel, self_mute=True, self_deaf=True)&#xA;    await ctx.send("I joined the party :tada:")&#xA;  &#xA;  @cog_ext.cog_slash(name="disconnect", guild_ids=guild_ids)&#xA;  async def disconnect(self, ctx):&#xA;    await ctx.voice_client.disconnect()&#xA;  &#xA;  @cog_ext.cog_slash(name="play", guild_ids=guild_ids)&#xA;  async def play(self, ctx, input):&#xA;    if &#x27;https://www.youtube.com/watch?&#x27; in input or &#x27;https://youtu.be/&#x27; in input:&#xA;      YTDL_OPTIONS = {&#x27;format&#x27;:"bestaudio"}&#xA;      with youtube_dl.YoutubeDL(YTDL_OPTIONS) as ydl:&#xA;        info_dict = ydl.extract_info(input, download=False)&#xA;        video_title = info_dict.get(&#x27;title&#x27;, None)&#xA;&#xA;        results = YoutubeSearch(video_title, max_results=1).to_json()&#xA;        print(results)&#xA;        url_suffix_int = results.find(&#x27;url_suffix&#x27;) &#x2B; 14&#xA;&#xA;&#xA;        results2 = "".join([&#x27;https://www.youtube.com&#x27;, str(results[url_suffix_int:-3])])&#xA;&#xA;        title_int = results.find(&#x27;title&#x27;) &#x2B; 9&#xA;        title_int2 = results.find(&#x27;long_desc&#x27;) - 4&#xA;        title_string = str(results[title_int:title_int2])&#xA;&#xA;        thumbnail_int = results.find(&#x27;thumbnail&#x27;) &#x2B; 15&#xA;        title_split = results.find(&#x27;title&#x27;) - 5&#xA;        splitboth = str(results[thumbnail_int:title_split])&#xA;        final_result = splitboth.split(&#x27;", "&#x27;, 1)[0]&#xA;&#xA;        channel_int = results.find(&#x27;channel&#x27;) &#x2B; 11&#xA;        channel_int2 = results.find(&#x27;duration&#x27;) - 4&#xA;        channel_string = str(results[channel_int:channel_int2])&#xA;&#xA;        duration_int = results.find(&#x27;duration&#x27;) &#x2B; 12&#xA;        duration_int2 = results.find(&#x27;views&#x27;) - 4&#xA;        duration_string = str(results[duration_int:duration_int2])&#xA;&#xA;        views_int = results.find(&#x27;views&#x27;) &#x2B; 9&#xA;        views_int2 = results.find(&#x27;publish_time&#x27;) - 4&#xA;        views_string = str(results[views_int:views_int2])&#xA;&#xA;        embed = discord.Embed(title=title_string, colour=discord.Colour(0x1), url=results2)&#xA;&#xA;        embed.set_thumbnail(url=final_result)&#xA;        embed.set_author(name="Added to queue", icon_url=self.client.user.avatar_url)&#xA;&#xA;        embed.add_field(name="Channel", value=channel_string, inline=True)&#xA;        embed.add_field(name="Song Duration", value=duration_string, inline=True)&#xA;        embed.add_field(name="Views", value=views_string, inline=True)&#xA;&#xA;        await ctx.send(embed=embed)&#xA;&#xA;        queue.append(input)&#xA;        await start_queue(self, ctx)&#xA;&#xA;    else:&#xA;      results = YoutubeSearch(input, max_results=1).to_json()&#xA;      print(results)&#xA;      url_suffix_int = results.find(&#x27;url_suffix&#x27;) &#x2B; 14&#xA;&#xA;&#xA;      results2 = "".join([&#x27;https://www.youtube.com&#x27;, str(results[url_suffix_int:-3])])&#xA;&#xA;      title_int = results.find(&#x27;title&#x27;) &#x2B; 9&#xA;      title_int2 = results.find(&#x27;long_desc&#x27;) - 4&#xA;      title_string = str(results[title_int:title_int2])&#xA;&#xA;      thumbnail_int = results.find(&#x27;thumbnail&#x27;) &#x2B; 15&#xA;      title_split = results.find(&#x27;title&#x27;) - 5&#xA;      splitboth = str(results[thumbnail_int:title_split])&#xA;      final_result = splitboth.split(&#x27;", "&#x27;, 1)[0]&#xA;&#xA;      channel_int = results.find(&#x27;channel&#x27;) &#x2B; 11&#xA;      channel_int2 = results.find(&#x27;duration&#x27;) - 4&#xA;      channel_string = str(results[channel_int:channel_int2])&#xA;&#xA;      duration_int = results.find(&#x27;duration&#x27;) &#x2B; 12&#xA;      duration_int2 = results.find(&#x27;views&#x27;) - 4&#xA;      duration_string = str(results[duration_int:duration_int2])&#xA;&#xA;      views_int = results.find(&#x27;views&#x27;) &#x2B; 9&#xA;      views_int2 = results.find(&#x27;publish_time&#x27;) - 4&#xA;      views_string = str(results[views_int:views_int2])&#xA;&#xA;      embed = discord.Embed(title=title_string, colour=discord.Colour(0x1), url=results2)&#xA;&#xA;      embed.set_thumbnail(url=final_result)&#xA;      embed.set_author(name="Added to queue", icon_url=self.client.user.avatar_url)&#xA;&#xA;      embed.add_field(name="Channel", value=channel_string, inline=True)&#xA;      embed.add_field(name="Song Duration", value=duration_string, inline=True)&#xA;      embed.add_field(name="Views", value=views_string, inline=True)&#xA;&#xA;      await ctx.send(embed=embed)&#xA;&#xA;      queue.append(results2)&#xA;      await start_queue(self, ctx)&#xA;    &#xA;&#xA;  @cog_ext.cog_slash(name="pause", guild_ids=guild_ids)&#xA;  async def pause(self, ctx):&#xA;    ctx.voice_client.pause()&#xA;  &#xA;  &#xA;  @cog_ext.cog_slash(name="resume", guild_ids=guild_ids)&#xA;  async def resume(self, ctx):&#xA;    ctx.voice_client.resume()&#xA;&#xA;  &#xA;def setup(client):&#xA;  client.add_cog(music(client))&#xA;&#xA;async def start_queue(self, ctx):&#xA;    print(is_playing)&#xA;    if len(queue) &lt;= 0:&#xA;      await ctx.voice_client.disconnect()&#xA;    while(len(queue) > 0):&#xA;      if(is_playing == False):&#xA;        await start(self, ctx, queue[0])&#xA;&#xA;    &#xA;&#xA;async def start(self, ctx, link_yt):&#xA;      global is_playing&#xA;      is_playing = True&#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;      YTDL_OPTIONS = {&#x27;format&#x27;:"bestaudio"}&#xA;      vc = ctx.voice_client&#xA;      with youtube_dl.YoutubeDL(YTDL_OPTIONS) as ydl:&#xA;        info = ydl.extract_info(link_yt, download=False)&#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;        await asyncio.sleep(info[&#x27;duration&#x27;] &#x2B; 1)&#xA;        print("Done")&#xA;        del queue[0]&#xA;        is_playing = False&#xA;

    &#xA;

    Final Note : I did try to download and play the song but in the end it gave me the following error :

    &#xA;

    Options reconnect not found.&#xA;

    &#xA;