Recherche avancée

Médias (0)

Mot : - Tags -/tags

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

Autres articles (86)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

Sur d’autres sites (5848)

  • How can I get my saved mp4 to exactly match the output of plot.show() ?

    10 mai 2019, par Jimmy

    When I try to save the results of an animation to mp4 using ffmpeg, I am getting a jumbled mess.

    plt.show() shows exactly what I want it to show in the animation. However, when I save it using ffmpeg, the result is very different from what plt.show() returns. I have tried various arguments for fps etc. but nothing has helped.

    %matplotlib
    import pandas as pd
    import matplotlib as mpl ## uncomment this if you are running this on a Mac
    #mpl.use('TkAgg')         ## and want to use blit=True
    import matplotlib.pyplot as plt
    import matplotlib.animation as animation
    import numpy as np
    import csv

    people = ('','Jim', 'Dan')
    plt.rcdefaults()
    fig, ax = plt.subplots()
    y_pos = np.arange(len(people))

    ax.set_xlim(0,10)
    ax.set_yticks(y_pos)
    ax.set_yticklabels(people)
    ax.invert_yaxis()
    ax.set_xlabel('Skill')
    titleList=['Basketball','Hockey','Baseball']
    df=[[0,5,7],[0,4,9],[0,2,6]]
    def animate(i):
      # Example data
       while i<3:
           ax.set_yticks(y_pos)
           ax.set_yticklabels(people)
           ax.set_xlabel(titleList[i])
           performance=df[i]

           title = ax.text(0.5,0.95,str(titleList[i]), bbox={'facecolor':'w', 'alpha':0.5, 'pad':5},transform=ax.transAxes, ha="center")

           rects = ax.barh(y_pos, performance, align='center',
                   color='blue', ecolor='None')
           return [rect for rect in rects] + [title]


    ani = animation.FuncAnimation(fig,animate, frames=3, blit=True
                               ,interval=2000,repeat=False)

    plt.rcParams['animation.ffmpeg_path'] = 'C:\\ffmpeg\\bin\\ffmpeg.exe'
    Writer = animation.writers['ffmpeg']
    ani.save('test.mp4')
    plt.show()

    The result is a very fast video where all the data gets written over (similar to the plt.show() results when blit=False).

  • Ghost image issues with ffmpeg -filter_complex displace

    5 juillet 2022, par raul.vila

    I've (almost) been able to apply a displacement based on 2 animated gaussian noise videos, but I'm having issues with a ghost image. A picture is worth a thousand words.

    


    Here you have a script to replicate the issue :

    


    ffmpeg -y -t 2 -f lavfi -i color=c=blue:s=160x120 -c:v libx264 -tune stillimage -pix_fmt rgb24 00_empty.mp4
ffmpeg -y -i 00_empty.mp4 -vf "drawtext=text=string1:y=h/2:x=w-t*w/2:fontcolor=white:fontsize=60" 01_text.mp4
ffmpeg -y -t 2 -f lavfi -i color=c=gray:s=160x120 -c:v libx264 -tune stillimage -pix_fmt rgb24 02_gray.mp4
ffmpeg -y -i 01_text.mp4 -i 02_gray.mp4 -i 02_gray.mp4 -filter_complex "[0][1][2]displace=edge=mirror" 03_displaced_text.mp4


    


    It creates a test video with a scrolling text and a gray dummy video. Then it applies a displacement based on the gray video. If I understand correctly, because the gray video is 100% gray, it should leave the video unchanged (or maybe displace everything by a fixed ammount of pixels), but it creates a "shadow". I tried with 3 different pixel formats (yuv420p, yuv444p, rgb24) because I found this question on stackoverflow talking about that :

    


    


    ffmpeg version 5.0.1-full_build-www.gyan.dev

    


    Any idea will be welcome.
    
Thanks !

    


  • Music queue, discord.py music bot

    29 mars 2021, par Luca M. Schmidt

    II'm trying to add a queue system to my music cog. When possible it should be able to add songs and play the next song after the one before ended. An explanation on how it should work is sufficient, there's no need to provide any code at all. If any additional information is needed feel free to ask.

    


    My Code (Stripped down a bit) :

    


    # IMPORT


import discord
from discord.ext import commands
import json
import asyncio
import youtube_dl



# LOKALE_VARIABLEN


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)

songs = asyncio.Queue()
play_next_song = asyncio.Event()


# ----

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')
        self.thumbnail = data.get('thumbnail')


    @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:
            data = data['entries'][0]

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


# COG_SETUP(START)


class Music(commands.Cog):

    def __init__(self, client):
        self.client = client


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

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

        await channel.connect()

    @commands.command()
    @commands.cooldown(1, 10, commands.BucketType.user)
    async def play(self, ctx, *, url):

        try:

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

        except:
            embed = discord.Embed(
                title='Fehler!',
                colour=discord.Colour.red(),
                description='Dies ist eine nicht Unterstützte URL!'
            )

            return await ctx.send(embed=embed)

        embed = discord.Embed(
            title='',
            colour=discord.Colour.blue(),
            description=f'[{format(player.title)}]({player.url})'
        )
        embed.set_author(name='Spielt gerade:')
        embed.set_image(url=player.thumbnail)
        embed.set_footer(text=f'Hinzugefügt von: {ctx.author.name}', icon_url=ctx.author.avatar_url)


        await ctx.send(embed=embed)




    @commands.command()
    async def volume(self, ctx, volume: int):

        if ctx.voice_client is None:

            embed = discord.Embed(
                title='Fehler!',
                colour=discord.Colour.red(),
                description='Ich bin mit keinem Sprachkanal verbunden!'
            )

            return await ctx.send(embed=embed)

        elif ctx.voice_client is not None:

            if volume in range(0, 201):
                try:
                    ctx.voice_client.source.volume = volume / 100

                    embed = discord.Embed(
                        title='Lautstärke',
                        colour=discord.Colour.blue(),
                        description=f'Lautstärke auf **{format(volume)}**% gestellt.'
                    )
                    embed.set_footer(text=f"Angepasst von: {ctx.author.name}", icon_url=ctx.author.avatar_url)

                    return await ctx.send(embed=embed)
                except:
                    pass

            else:

                embed = discord.Embed(
                    title='Fehler!',
                    colour=discord.Colour.red(),
                    description='Das ist Lauter, als die Musik geht!'
                )

                return await ctx.send(embed=embed)

    @commands.command()
    async def stop(self, ctx):
        try:

            await ctx.voice_client.disconnect()
            await ctx.message.delete()

        except:
            pass

    @commands.command()
    async def pause(self, ctx):

        if ctx.voice_client.is_playing():

            ctx.voice_client.pause()
            await ctx.message.delete()
            return

        else:

            embed = discord.Embed(
                title='Fehler!',
                colour=discord.Colour.red(),
                description='Es spielt keine Musik!'
            )

            return await ctx.send(embed=embed)

    @commands.command()
    async def resume(self, ctx):

        if ctx.voice_client.is_paused():

            ctx.voice_client.resume()
            await ctx.message.delete()
            return

        else:

            embed = discord.Embed(
                title='Fehler!',
                colour=discord.Colour.red(),
                description='Es wurde keine Musik pausiert, darum kann ich auch nichts fortsetzen!'
            )

            return await ctx.send(embed=embed)

    @resume.before_invoke
    @play.before_invoke
    async def ensure_voice(self, ctx):
        if ctx.voice_client is None:
            if ctx.author.voice:
                try:

                    await ctx.author.voice.channel.connect()

                except commands.CommandError:
                    embed = discord.Embed(
                        title='Fehler!',
                        colour=discord.Colour.red(),
                        description='Du bist nicht mit einem Sprachkanal verbunden!'
                    )

                    await ctx.send(embed=embed)

        elif ctx.voice_client.is_playing():
            ctx.voice_client.stop()


# COG_SETUP(END)


def setup(client):
    client.add_cog(Music(client))