Recherche avancée

Médias (91)

Autres articles (69)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Diogene : création de masques spécifiques de formulaires d’édition de contenus

    26 octobre 2010, par

    Diogene est un des plugins ? SPIP activé par défaut (extension) lors de l’initialisation de MediaSPIP.
    A quoi sert ce plugin
    Création de masques de formulaires
    Le plugin Diogène permet de créer des masques de formulaires spécifiques par secteur sur les trois objets spécifiques SPIP que sont : les articles ; les rubriques ; les sites
    Il permet ainsi de définir en fonction d’un secteur particulier, un masque de formulaire par objet, ajoutant ou enlevant ainsi des champs afin de rendre le formulaire (...)

Sur d’autres sites (10054)

  • Why does my nginx endpoint streaming audio via ffmpeg fail with "An unexpected TLS packet was received"

    6 décembre 2020, par rajaman0

    I'm using nginx to proxy requests to a flask/gunicorn API. For most of my endpoints, it works perfectly - however, I have one endpoint which serves an audio response (through ffmpeg) which doesn't seem to work no matter what I try. Running everything through docker.

    


    Here's my nginx config :

    


    server {
  listen $PORT;
  root /usr/share/nginx/html;
  index index.html index.html;

  access_log /var/log/nginx/reverse-access.log;
  error_log /var/log/nginx/reverse-error.log;

  location / {
    try_files $uri /index.html =404;
  }

  location /api/stream_audio_file {
    proxy_pass          http://backend;
    proxy_http_version  1.1;
    proxy_set_header    Connection "keep-alive";
    proxy_set_header    Host $host;

    proxy_set_header    X-Real-IP $remote_addr;
    proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Host $server_name;
  }


    


    Here's the core of the python code for http://backend/api/stream_audio_file (run through flask, gunicorn)

    


    ffmpeg_options =  ['-i', 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3']
ffmpeg_options += ["-f", "mp3"]
ffmpeg_options += ["-to", '00:00:02.000']
ffmpeg_options += ["-vn"]
ffmpeg_options += ["-ab",  "256k"]
ffmpeg_options += ["-strict", "-2"]
ffmpeg_options += ["-loglevel", "trace"]
p = Popen(["ffmpeg"] + ffmpeg_options + ["-"],
                      stdout=PIPE)
max_bytes = 256000
output = p.stdout.read(max_bytes)
return Response(output, headers={
     "Content-Type": "audio/mp3",
     "icy-name": yt_info['title'].encode('latin-1', 'ignore'),
     "icy-bitrate": "256",
     "ice-audio-info": "bitrate=256",
     "Cache-Control": "no-cache"
})


    


    When I test out this endpoint, I've pasted the full ffmpeg logs here : https://pastebin.com/wMMpmL6M
Of import, it seems to fetch the mp3 url appropriately but fails with error :

    


    [tls @ 0x555bf3011a80] An unexpected TLS packet was received.
https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3: I/O error
[out_0_0 @ 0x555bf302ab00] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.


    


    I've tried quite a few things :

    


      

    1. This endpoint works without nginx. I tried querying just the endpoint running w/ just gunicorn, and responses are streamed back correctly. Thus the error HAS to be nginx related ?
    2. 


    3. The error being TLS related is confusing - I've tried setting up nginx w/ ssl on and adding certs, but that doesn't help / change the error in any way.
    4. 


    5. I've tried playing around with headers in both nginx and on the python side, following some of the examples here : https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/. Doesn't work.
    6. 


    7. Response(stream_with_context(..) in flask doesn't work either.
    8. 


    9. Don't know much about nginx, but tried some other suggestions e.g. buffering / no buffering through nginx, etc, nothing seems to work :(.
    10. 


    11. When I ssh into my docker container, and run the same ffmpeg command ffmpeg -i https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3 -f mp3 -to 00:00:02.000 -vn -ab 256k -strict -2 -loglevel trace outside of the request context, it works !
    12. 


    13. Tried compiling ffmpeg with both openssl and gnutls, neither works. However : the openssl version fails w/
tls @ error:1408F1BB:SSL routines:ssl3_get_record:bad record type instead.
    14. 


    


    Please let me know what other debugging info would be helpful / if anyone has any hypothesis I can test out.

    


  • "Cannot read property 'url' of undefined" even though it's already defined

    28 novembre 2020, par Levi Stancz

    I'm making a Discord music Bot and I'm having trouble with an error saying

    


    TypeError: Cannot read property 'url' of undefined


    


    I tried console logging it and it showed me the url, so I don't understand what is the problem with my code.

    


    Here's my code :

    


    //musicBOT
const Discord = require('discord.js');
const client = new Discord.Client();
const ytdl = require('ytdl-core');
const mcPrefix = '.';

const queue = new Map();

client.on('ready', () => console.log('Music bot ready!'));

client.on('message', async message => {
    if(message.author.bot) return;
    if(!message.content.startsWith(mcPrefix)) return;

    const args = message.content.substring(mcPrefix.length).split(" ");
    const serverQueue = queue.get(message.guild.id);

    if(message.content.startsWith(`${mcPrefix}play`)) {

        const voiceChannel = message.member.voice.channel;
        if(!voiceChannel) return message.channel.send("Hang-szobában kell lenned zenelejátszáshoz.");
        const permissions = voiceChannel.permissionsFor(message.client.user);
        if(!permissions.has('CONNECT')) return message.channel.send("Nincs jogosultságom csatlakozni a hangszobához.");
        if(!permissions.has('SPEAK')) return message.channel.send("Nincs jogosultságom megszólalni ebben a hangszobában.");

        const songInfo = await ytdl.getInfo(args[1])
        const song = {
            title: songInfo.title,
            url: songInfo.videoDetails.video_url
        }

        if(!serverQueue) {
            const queueConstruct = {
                textChannel: message.channel,
                voiceChannel: voiceChannel,
                connection: null,
                songs: [],
                volume: 5,
                playing: true
            }
            queue.set(message.guild.id, queueConstruct)

            queueConstruct.songs.push(song)

            try{
                var connection = await voiceChannel.join();
                message.channel.send(`${song.title} lejátszása.`)
                queueConstruct.connection = connection
                play(message.guild, queueConstruct.songs[0])
            }catch(e){
                console.log(`Hiba csatlakozás közben itt: ${e}`);
                queue.delete(message.guild.id)
                return message.channel.send(`Hiba volt a csatlakozás közben itt: ${e}`)
            }
        } else{
            serverQueue.songs.push(song)
            return message.channel.send(`**${song.title}** hozzáadva a lejátszási listához.`)
        }
        return undefined
        

        
    }else if (message.content.startsWith(`${mcPrefix}stop`)) {
        if(!message.member.voice.channel) return message.channel.send("Hang-szobában kell lenned ahhoz, hogy leállítsd a zenét.")
        if(!serverQueue) return message.channel.send("There is nothing playing")
        serverQueue.songs= []
        serverQueue.connection.dispatcher.end()
        message.channel.send("Sikeresen megálltottad a zenét.")
        return undefined
    }else if(message.content.startsWith(`${mcPrefix}skip`)){
        if(!message.member.voice.channel) return message.channel.send("Hang-szobában kell lenned a skip parancshoz.")
        if(!serverQueue) return message.channel.send("There is nothing playing")
        serverQueue.connection.dispatcher.end()
        message.channel.send("Zene továbbléptetve.")
        message.channel.send(`${song.title} játszása.`)
        
        return undefined
    }

    function play(guild, song) {
        const serverQueue = queue.get(guild.id)
    
        if(!serverQueue.songs){
            serverQueue.voiceChannel.leave()
            queue.delete(guild.id)
            return
        }
    
        const dispatcher = serverQueue.connection.play(ytdl(song.url))
            .on('finish', () => {
                serverQueue.songs.shift()
                play(guild, serverQueue.songs[0])
            })
            .on('error', error => {
                console.log(error)
            })
            dispatcher.setVolumeLogarithmic(serverQueue.volume / 5)
    }

})
//musicBOT


    


    and here is the full error :

    


    const dispatcher = serverQueue.connection.play(ytdl(songInfo.url))&#xA;                                                                     ^&#xA;TypeError: Cannot read property &#x27;url&#x27; of undefined&#xA;    at play (C:\Users\Levi\Desktop\Discord BOT Javascript\bot.js:97:70)&#xA;    at StreamDispatcher.<anonymous> (C:\Users\Levi\Desktop\Discord BOT Javascript\bot.js:100:17)&#xA;    at StreamDispatcher.emit (node:events:388:22)&#xA;    at finish (node:internal/streams/writable:734:10)&#xA;    at processTicksAndRejections (node:internal/process/task_queues:80:21)&#xA;</anonymous>

    &#xA;

    I started searching on the internet but found nothing about it, I guess my basic javascript knowledge is just not enough.

    &#xA;

  • Getting "OSError : [Errno 32] Broken pipe" while saving a numpy array using imageio.mimwrite into io.BytesIO() object

    10 novembre 2020, par green_hunter434

    I am trying to save a numpy array (array of frames) as a video using imageio.mimwrite .

    &#xA;

    Operation like this works fine -

    &#xA;

    imageio.mimwrite(&#x27;./temp4.mp4&#x27;, frames, fps=fps, format=&#x27;.mp4&#x27;)&#xA;

    &#xA;

    But, when I try something like this -

    &#xA;

    fo = io.BytesIO()&#xA;imageio.mimwrite(fo, frames, fps=fps, format=&#x27;.mp4&#x27;)&#xA;

    &#xA;

    OR

    &#xA;

    writer = imageio.get_writer(fo, fps=fps, format=&#x27;.mp4&#x27;)&#xA;&#xA;for im in frames:&#xA;    writer.append_data(imageio.imread(im))&#xA;writer.close()&#xA;

    &#xA;

    I get the following error -

    &#xA;

    ---------------------------------------------------------------------------&#xA;BrokenPipeError                           Traceback (most recent call last)&#xA;c:\program files (x86)\python38-32\lib\site-packages\imageio_ffmpeg\_io.py in write_frames(path, size, pix_fmt_in, pix_fmt_out, fps, quality, bitrate, codec, macro_block_size, ffmpeg_log_level, ffmpeg_timeout, input_params, output_params)&#xA;    478             try:&#xA;--> 479                 p.stdin.write(bb)&#xA;    480             except Exception as err:&#xA;&#xA;BrokenPipeError: [Errno 32] Broken pipe&#xA;&#xA;During handling of the above exception, another exception occurred:&#xA;&#xA;OSError                                   Traceback (most recent call last)&#xA; in <module>&#xA;      1 for im in ret3:&#xA;----> 2     writer.append_data(im)&#xA;      3 writer.close()&#xA;&#xA;c:\program files (x86)\python38-32\lib\site-packages\imageio\core\format.py in append_data(self, im, meta)&#xA;    500             im = asarray(im)&#xA;    501             # Call&#xA;--> 502             return self._append_data(im, total_meta)&#xA;    503 &#xA;    504         def set_meta_data(self, meta):&#xA;&#xA;c:\program files (x86)\python38-32\lib\site-packages\imageio\plugins\ffmpeg.py in _append_data(self, im, meta)&#xA;    572 &#xA;    573             # Write. Yes, we can send the data in as a numpy array&#xA;--> 574             self._write_gen.send(im)&#xA;    575 &#xA;    576         def set_meta_data(self, meta):&#xA;&#xA;c:\program files (x86)\python38-32\lib\site-packages\imageio_ffmpeg\_io.py in write_frames(path, size, pix_fmt_in, pix_fmt_out, fps, quality, bitrate, codec, macro_block_size, ffmpeg_log_level, ffmpeg_timeout, input_params, output_params)&#xA;    484                     "OUTPUT:\n".format(err, cmd_str)&#xA;    485                 )&#xA;--> 486                 raise IOError(msg)&#xA;    487 &#xA;    488             nframes &#x2B;= 1&#xA;&#xA;OSError: [Errno 32] Broken pipe&#xA;&#xA;FFMPEG COMMAND:&#xA;c:\program files (x86)\python38-32\lib\site-packages\imageio_ffmpeg\binaries\ffmpeg-win32-v4.2.2.exe -y -f rawvideo -vcodec rawvideo -s 256x256 -pix_fmt rgb24 -r 29.97 -i - -an -vcodec libx264 -pix_fmt yuv420p -crf 25 -v warning C:\Users\pramu\AppData\Local\Temp\imageio_fh1fqkgc&#xA;&#xA;FFMPEG STDERR OUTPUT:&#xA;</module>

    &#xA;

    I get the same error using anaconda ffmpeg and non-anaconda ffmpeg.

    &#xA;

    Is there a way to fix this error ?

    &#xA;

    Also, is there a better way to convert list of frames into .mp4 or serializing it for sending through an API ?.

    &#xA;

    Thank you !

    &#xA;