Recherche avancée

Médias (1)

Mot : - Tags -/biographie

Autres articles (81)

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

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (10235)

  • Converting ffmpeg CLI command to ffmpeg-python to get bytes of a MPEG Transport Stream data stream ?

    28 août 2023, par kdeckerr

    I have the following code to get the bytes representing the data stream of a .ts video :

    


    def get_datastream_bytes(mpeg_ts_filepath):
    ffmpeg_command = [
        'ffmpeg', '-hide_banner', '-loglevel', 'quiet',
        '-i', mpeg_ts_filepath,
        '-map', '0:d',
        '-c', 'copy',
        '-copy_unknown',
        '-f', 'data',
        'pipe:1'
    ]

    try:
        output_bytes = subprocess.check_output(ffmpeg_command, stderr=subprocess.STDOUT)
        print("Output bytes length:", len(output_bytes))
        return output_bytes
    except subprocess.CalledProcessError as e:
        print("Error:", e.output)


    


    I can then wrap the returned value in io.BytesIO and parse the resulting bytes using another library (klvdata).

    


    This code was fashioned upon a ffmpeg CLI command I adapted from this SO Answer.

    


    ffmpeg -i "C:\inputfile.ts" -map 0:d -c copy -copy_unknown -f:d data pipe:1


    



    


    What I would really like to do is utilize the Python ffmpeg bindings in ffmpeg-python so that users do not have to install ffmpeg locally. Thus, I have attempted to get a bytes stream from an ffmpeg call like so :

    


    bytestream = (
    ffmpeg.input(input_file)
        .output("pipe:", format="data", codec="copy", copy_unknown=True)
        .run(capture_stdout=True)
)


    


    Though, this and many other, attempts at utilizing ffmpeg-python generally end with the same error :

    


    


    Output #0, data, to 'True' :
[out#0/data @ 00000...] Output file does not contain any stream
Error opening output file True.
Error opening output files : Invalid argument
Traceback (most recent call last) :
...
raise Error('ffmpeg', out, err)
ffmpeg._run.Error : ffmpeg error (see stderr output for detail)

    


    



    


    How do I convert the ffmpeg CLI command

    


    ffmpeg -i "C:\inputfile.ts" -map 0:d -c copy -copy_unknown -f:d data pipe:1


    


    To an ffmpeg-python call ?

    


  • C# How do I set the volume of sound bytes[]

    23 juillet 2016, par McLucario

    Im trying to change the volume of sound bytes[] in C#. Im reading a sound file with FFMPEG and and wanna change the volume on the fly. I found some examples and but I didnt understand them.

    public void SendAudio(string pathOrUrl)
    {
       cancelVid = false;
       isPlaying = true;

       mProcess = Process.Start(new ProcessStartInfo
       { // FFmpeg requireqs us to spawn a process and hook into its stdout, so we will create a Process
           FileName = "ffmpeg",
           Arguments = "-i " + (char)34 + pathOrUrl + (char)34 + // Here we provide a list of arguments to feed into FFmpeg. -i means the location of the file/URL it will read from
           " -f s16le -ar 48000 -ac 2 pipe:1", // Next, we tell it to output 16-bit 48000Hz PCM, over 2 channels, to stdout.
           UseShellExecute = false,
           RedirectStandardOutput = true, // Capture the stdout of the process
           Verb = "runas"
       });

       while (!isRunning(mProcess)) { Task.Delay(1000); }

       int blockSize = 3840; // The size of bytes to read per frame; 1920 for mono
       byte[] buffer = new byte[blockSize];
       byte[] gainBuffer = new byte[blockSize];
       int byteCount;

       while (true && !cancelVid) // Loop forever, so data will always be read
       {
           byteCount = mProcess.StandardOutput.BaseStream // Access the underlying MemoryStream from the stdout of FFmpeg
           .Read(buffer, 0, blockSize); // Read stdout into the buffer

           if (byteCount == 0) // FFmpeg did not output anything
               break; // Break out of the while(true) loop, since there was nothing to read.

           if (cancelVid)
               break;

           disAudioClient.Send(buffer, 0, byteCount); // Send our data to Discord
       }
       disAudioClient.Wait(); // Wait for the Voice Client to finish sending data, as ffMPEG may have already finished buffering out a song, and it is unsafe to return now.
       isPlaying = false;
       Console.Clear();
       Console.WriteLine("Done Playing!");
  • How do I add a queue to my music bot using Discrod.py FFmpeg and youtube_dl ?

    28 septembre 2022, par Виктор Лисичкин

    I'm writing my bot for discord, I can't figure out how to track the end of a song to lose the next one. I sort of figured out the piece of music, but I don't fully understand what to do next. Here is my code for main.py

    


    from discord.ext import commands, tasks
from config import settings
from music_cog import music_cog
bot = commands.Bot(command_prefix='!',intents = discord.Intents.all())

@bot.event
async def on_ready():
    print(f'We have logged in as {bot.user}')
    await bot.add_cog(music_cog(bot))

bot.run(settings['token'])


    


    and And this is for cog with music

    


    from discord.ext import commands
from youtube_dl import YoutubeDL
YDL_OPTIONS = {'format': 'worstaudio/best', 'noplaylist': 'False', 'simulate': 'True',
               'preferredquality': '192', 'preferredcodec': 'mp3', 'key': 'FFmpegExtractAudio'}
FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
queue = []
class music_cog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
    @commands.command(pass_context=True)
    async def play(self,ctx, *, arg):
        global queue
        queue.append(arg)
        def playing():
            for song in queue:
                with YoutubeDL(YDL_OPTIONS) as ydl:
                    if 'https://' in song:
                        info = ydl.extract_info(song, download=False)
                    else:
                        info = ydl.extract_info(f"ytsearch:{song}", download=False)['entries'][0]

                    url = info['formats'][0]['url']
                    queue.pop(0)
                    vc.play(discord.FFmpegPCMAudio(executable="ffmpeg", source=url, **FFMPEG_OPTIONS))
        voice_client = discord.utils.get(self.bot.voice_clients, guild=ctx.guild)
        if not ctx.message.author.voice:
            await ctx.send("You are not connected to voice chanel")
        elif voice_client:
            queue.append(arg)
        else:
            vc = await ctx.message.author.voice.channel.connect()
            playing()
    @commands.command(pass_context = True)
    async def disconect(self, ctx):
        server = ctx.message.guild.voice_client
        if ctx.message.guild.voice_client:
            await server.disconnect()
        else:
            await ctx.send("I am not connected")

    @commands.command(pass_context=True)
    async def stop(self, ctx):
        server = ctx.message.guild
        voice_channel = server.voice_client
        voice_channel.pause()

    @commands.command(pass_context=True)
    async def resumue(self, ctx):
        server = ctx.message.guild
        voice_channel = server.voice_client
        voice_channel.resume()