Recherche avancée

Médias (2)

Mot : - Tags -/doc2img

Autres articles (30)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (5628)

  • 2023-04-18 18:25:05 INFO discord.player ffmpeg process ##### successfully terminated with return code of 0

    19 avril 2023, par I_am_thing

    I am making a discord music bot with discord.py and ctx, it uses Spotify

    


    I am using FFmpeg for my music feature. This is my !play code

    


    client_id = ''
client_secret = ''
client_credentials_manager = SpotifyClientCredentials(client_id=client_id, client_secret=client_secret)
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)

bot.volume = 0.5 # initial volume of the bot (can be changed)

@bot.command()
async def play(ctx, *, track_query):
    # check if the query is a valid Spotify link
    if 'open.spotify.com/track/' in track_query:
        track_id = track_query.split('/')[-1] # extract the track ID from the link
    else:
        # search for tracks with the given name
        track_results = sp.search(q=track_query, type='track', limit=1)
        if len(track_results['tracks']['items']) == 0:
            await ctx.send(f'Sorry, I could not find any track with the name "{track_query}".')
            return
        track_id = track_results['tracks']['items'][0]['id'] # get the track ID for the first search result
    track_info = sp.track(track_id) # get the track information for the given ID
    track_name = track_info['name']
    track_artist = track_info['artists'][0]['name']
    track_duration = time.strftime('%M:%S', time.gmtime(track_info['duration_ms']//1000))
    track_preview_url = track_info['preview_url'] # get the preview URL for the track
    if track_preview_url is None:
        await ctx.send(f'Sorry, the track "{track_name}" by {track_artist} cannot be played.')
        return
    voice_channel = ctx.author.voice.channel
    if voice_channel is None:
        await ctx.send('Please join a voice channel first.')
        return
    voice_client = await voice_channel.connect()
    audio_source = discord.FFmpegPCMAudio(track_preview_url, options="-b:a 128k -bufsize 512k")
    voice_client.play(audio_source, after=lambda e: print('Player error: %s' % e) if e else None)
    voice_client.source = discord.PCMVolumeTransformer(voice_client.source)
    voice_client.source.volume = bot.volume

    # format the embed message
    embed = discord.Embed(title=track_name, description=track_artist, color=0xff8c00)
    embed.add_field(name='Duration', value=track_duration, inline=True)
    embed.set_thumbnail(url=track_info['album']['images'][0]['url'])
    embed.set_footer(text='This music is from https://www.spotify.com/')
    await ctx.send(embed=embed)

    while voice_client.is_playing():
        await asyncio.sleep(1)
    await voice_client.disconnect()


    


    I joined the unofficial ffmpeg discord server no one could find a fix I searched for ages and I couldn't fix it

    


  • Anyway to get current playtime of a song ?

    2 décembre 2019, par Blue Lightning

    So this is the basic voice that I’m currently using to play music through my bot. I’m streaming the audio (using the stream async function) opposed to downloading it local. Anyway I can get the current playtime of the song that is being played ?

    So whenever someone plays a song, they can, whenever they want, see how much of the song they played through already.

    import asyncio

    import discord
    import youtube_dl

    from discord.ext import commands

    # Suppress noise about console usage from errors
    youtube_dl.utils.bug_reports_message = lambda: ''


    ytdl_format_options = {
       'format': 'bestaudio/best',
       'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
       'restrictfilenames': True,
       'noplaylist': True,
       'nocheckcertificate': True,
       'ignoreerrors': False,
       'logtostderr': False,
       'quiet': True,
       'no_warnings': True,
       'default_search': 'auto',
       'source_address': '0.0.0.0'
    }

    ffmpeg_options = {
       'options': '-vn'
    }

    ytdl = youtube_dl.YoutubeDL(ytdl_format_options)


    class YTDLSource(discord.PCMVolumeTransformer):
       def __init__(self, source, *, data, volume=0.5):
           super().__init__(source, volume)

           self.data = data

           self.title = data.get('title')
           self.url = data.get('url')

       @classmethod
       async def from_url(cls, url, *, loop=None, stream=False):
           loop = loop or asyncio.get_event_loop()
           data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))

           if 'entries' in data:
               # take first item from a playlist
               data = data['entries'][0]

           filename = data['url'] if stream else ytdl.prepare_filename(data)
           return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)


    class Music(commands.Cog):
       def __init__(self, bot):
           self.bot = bot

       @commands.command()
       async def join(self, ctx, *, channel: discord.VoiceChannel):
           """Joins a voice channel"""

           if ctx.voice_client is not None:
               return await ctx.voice_client.move_to(channel)

           await channel.connect()

       @commands.command()
       async def stream(self, ctx, *, url):
           """Streams from a url (same as yt, but doesn't predownload)"""

           async with ctx.typing():
               player = await YTDLSource.from_url(url, loop=self.bot.loop, stream=True)
               ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)

           await ctx.send('Now playing: {}'.format(player.title))

       @commands.command()
       async def volume(self, ctx, volume: int):
           """Changes the player's volume"""

           if ctx.voice_client is None:
               return await ctx.send("Not connected to a voice channel.")

           ctx.voice_client.source.volume = volume / 100
           await ctx.send("Changed volume to {}%".format(volume))

       @commands.command()
       async def stop(self, ctx):
           """Stops and disconnects the bot from voice"""

           await ctx.voice_client.disconnect()

       @play.before_invoke
       @yt.before_invoke
       @stream.before_invoke
       async def ensure_voice(self, ctx):
           if ctx.voice_client is None:
               if ctx.author.voice:
                   await ctx.author.voice.channel.connect()
               else:
                   await ctx.send("You are not connected to a voice channel.")
                   raise commands.CommandError("Author not connected to a voice channel.")
           elif ctx.voice_client.is_playing():
               ctx.voice_client.stop()

    bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"),
                      description='Relatively simple music bot example')

    @bot.event
    async def on_ready():
       print('Logged in as {0} ({0.id})'.format(bot.user))
       print('------')

    bot.add_cog(Music(bot))
    bot.run('token')
  • extract the audio from vidoe file and stream over UDP ? [on hold]

    14 août 2014, par Jega

    Actually i am planing to build the music application I would like to play the video on android phone and stream the audio to other phone or pc over UDP ? can you anyone please suggest me how to split audio stream from video using Gstreamer or ffempg on android ?