Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (69)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP 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" (...)

  • 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 (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (6444)

  • FFMPEG show audio frequency waves with border

    13 juillet 2020, par Nikhil Solanki

    I am trying to generate sine waves or audio frequency like this using this command :

    


    ffmpeg -i combine2.mp4 -i image1.png -i song.mp3 -t 20 -filter_complex "[0]split=2[color][alpha]; [color]crop=iw/2:ih:0:0[color]; [alpha]crop=iw/2:ih:iw/2:ih[alpha]; [color][alpha]alphamerge[v1];
[1]scale=540:960, setsar=1[v2];
[2]showfreqs=s=540x100:mode=line:ascale=sqrt:colors=white|red[v3];
[v2][v3] overlay=main_w-overlay_w:main_h-overlay_h-10[v4];
[v4][v1] overlay=1" output_video2.mp4 -y


    


    This command shows frequency of audio with white colour only and also its not smooth as above image. So, how can I generate waves like above image smooth and bordered ?

    


    Output video :
screenshot

    


  • Seeking with ffmpeg options fails or causes delayed playback in Discord bot

    29 août 2022, par J Petersen

    My Discord bot allows users to play a song starting from a timestamp.

    


    The problem is that playback is delayed and audio plays faster and is jumbled if start times >= 30s are set.

    


    Results from testing different start times. Same URL, 30 second duration :

    


    





    


    


    


    


    


    



    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    


    Entered Start Time (s) Playback Delay (s) Song Playback Time (s)
    0 3 30
    30 10 22
    60 17 17
    120 31 2
    150 120 <1

    &#xA;

    &#xA;

    I am setting the start time using ffmpeg_options as suggested in this question.

    &#xA;

    Does anyone understand why the audio playback is being delayed/jumbled ? How can I improve playback delay and allow users to start in the middle of a multi-chapter YouTube video ?

    &#xA;

    Code :

    &#xA;

    import discord&#xA;import youtube_dl&#xA;import asyncio&#xA;&#xA;&#xA;# Suppress noise about console usage from errors&#xA;youtube_dl.utils.bug_reports_message = lambda: ""&#xA;&#xA;&#xA;ytdl_format_options = {&#xA;    "format": "bestaudio/best",&#xA;    "outtmpl": "%(extractor)s-%(id)s-%(title)s.%(ext)s",&#xA;    "restrictfilenames": True,&#xA;    "noplaylist": False,&#xA;    "yesplaylist": True,&#xA;    "nocheckcertificate": True,&#xA;    "ignoreerrors": False,&#xA;    "logtostderr": False,&#xA;    "quiet": True,&#xA;    "no_warnings": True,&#xA;    "default_search": "auto",&#xA;    "source_address": "0.0.0.0",  # Bind to ipv4 since ipv6 addresses cause issues at certain times&#xA;}&#xA;&#xA;ytdl = youtube_dl.YoutubeDL(ytdl_format_options)&#xA;&#xA;&#xA;class YTDLSource(discord.PCMVolumeTransformer):&#xA;    def __init__(self, source: discord.AudioSource, *, data: dict, volume: float = 0.5):&#xA;        super().__init__(source, volume)&#xA;&#xA;        self.data = data&#xA;&#xA;        self.title = data.get("title")&#xA;        self.url = data.get("url")&#xA;&#xA;    @classmethod&#xA;    async def from_url(cls, url, *, loop=None, stream=False, timestamp = 0):&#xA;        ffmpeg_options = {&#xA;            "options": f"-vn -ss {timestamp}"}&#xA;&#xA;        loop = loop or asyncio.get_event_loop()&#xA;&#xA;        data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))&#xA;        if "entries" in data:&#xA;            # Takes the first item from a playlist&#xA;            data = data["entries"][0]&#xA;&#xA;        filename = data["url"] if stream else ytdl.prepare_filename(data)&#xA;        return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)&#xA;&#xA;&#xA;intents = discord.Intents.default()&#xA;&#xA;bot = discord.Bot(intents=intents)&#xA;&#xA;@bot.slash_command()&#xA;async def play(ctx, audio: discord.Option(), seconds: discord.Option(), timestamp: discord.Option()):&#xA;    channel = ctx.author.voice.channel&#xA;    voice = await channel.connect()&#xA;    player = await YTDLSource.from_url(audio, loop=bot.loop, stream=True, timestamp=int(timestamp))&#xA;    voice.play(player)&#xA;    await asyncio.sleep(int(seconds))&#xA;    await voice.disconnect()&#xA;&#xA;token = token value&#xA;bot.run(token)&#xA;

    &#xA;

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