Recherche avancée

Médias (91)

Autres articles (53)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • Librairies et logiciels spécifiques aux médias

    10 décembre 2010, par

    Pour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
    Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

Sur d’autres sites (4326)

  • ffmpeg can play video but not a stream containing the same data

    21 mai 2017, par Robbsen

    This is my first time encountering video codecs/video streaming.

    I am receiving raw h.264 packets over TCP. When I connect to the socket, listen to it and simply save the received data to a file, I am able to play it back using

    ffplay data.h264

    However, when I try to directly play it from the stream without saving it, using

    ffplay tcp://addr:port

    all I get is the error

    Invalid data found when processing input

    Why is that ?

  • Discord theme songs

    29 septembre 2021, par SweLG

    I want to give some of my friends theme songs and I have been able to do it using the code below

    


    @commands.Cog.listener()
    async def on_voice_state_update(ctx, member, before, after):
        if member.name in theme_songs.keys():
            voice = await member.voice.channel.connect()
            voice.play(discord.FFmpegPCMAudio(source=f"theme_songs/{theme_songs[member.name]}"))


    


    The problem is the bot is activated every time something happens, i.e. muting, going live etc.
How could i make it so that it only looks for member joining ?

    


  • How do I loop audio files in discord.py ?

    25 septembre 2021, par Jonah Alexander

    I cannot for the life of me find or figure out a solution that works anymore. here is both the bit of code that is actually important, and the whole file if you would like to see that too

    


        async def play(self, ctx: commands.Context, url, lp):
        channel = ctx.author.voice.channel

        if lp == 'loop':
            await channel.connect()

            async with ctx.typing():
                player = await YTDLSource.from_url(url, loop=self.bot.loop)
                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))
            while True:
                if not ctx.voice_client.is_playing():
                    async with ctx.typing():
                        ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
                time.sleep(0.5)
        else:
            async with ctx.typing():
                await channel.connect()
                player = await YTDLSource.from_url(url, loop=self.bot.loop)
                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))


    


    from discord.ext import commands
import ffmpeg
import youtube_dl.YoutubeDL
import asyncio
import time


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'  # bind to ipv4 since ipv6 addresses cause issues sometimes
}

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 MyBoi(commands.Cog):
    def __init__(self, bot: commands.Bot):
        self.bot = bot
        self.voice_states = {}

    @commands.command(name='leave')
    async def leave(self, ctx: commands.Context):
        await ctx.voice_client.disconnect()

    @commands.command(name='play')
    async def play(self, ctx: commands.Context, url, lp):
        channel = ctx.author.voice.channel

        if lp == 'loop':
            await channel.connect()

            async with ctx.typing():
                player = await YTDLSource.from_url(url, loop=self.bot.loop)
                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))
            while True:
                if not ctx.voice_client.is_playing():
                    async with ctx.typing():
                        ctx.voice_client.play(player, after=lambda e: print('Player error: %s' % e) if e else None)
                time.sleep(0.5)
        else:
            async with ctx.typing():
                await channel.connect()
                player = await YTDLSource.from_url(url, loop=self.bot.loop)
                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))


intents = discord.Intents.all()

clnt = commands.Bot(command_prefix='#', intents=intents)
clnt.add_cog(MyBoi(clnt))

lop = {0: False}
plr = {}


@clnt.event
async def on_ready():
    print("ready")


clnt.run("the actual key normally")


    


    is the code poorly made and/or badly organized ? probably. but this is a personal project and did not expect to be sharing this with anyone. If you need clarification on anything lmk.

    


    with the code here, the issue im getting is when I do the looped version, the bot disconnects for a frame and reconnects, then I get this error

    


    


    discord.ext.commands.errors.CommandInvokeError : Command raised an exception : ClientException : Not connected to voice.

    


    


    the bot does not disconnect immediately when not using the looped version, and trying to manually reconnect it at the start of the loop gives me an error saying it's already connected.

    


    also sidenote I did not write the YTDLSource class or the ytdl_format_options.