Recherche avancée

Médias (0)

Mot : - Tags -/performance

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

Autres articles (78)

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

  • Qu’est ce qu’un masque de formulaire

    13 juin 2013, par

    Un masque de formulaire consiste en la personnalisation du formulaire de mise en ligne des médias, rubriques, actualités, éditoriaux et liens vers des sites.
    Chaque formulaire de publication d’objet peut donc être personnalisé.
    Pour accéder à la personnalisation des champs de formulaires, il est nécessaire d’aller dans l’administration de votre MediaSPIP puis de sélectionner "Configuration des masques de formulaires".
    Sélectionnez ensuite le formulaire à modifier en cliquant sur sont type d’objet. (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (13299)

  • youtube_dl, ffmpeg, discord.py is not playing songs even w/o streaming

    27 août 2021, par BlueFire02

    I have tried many times to make a basic queue system, I tested the play command to see if it worked back then and it did, unfortunately during this construction I have been having a lot of problems just playing the song. I did try to implement a queueing system but all that comes out is this specific error :

    


    [tls @ 0x7f8244705240] IO Error: -9806 [https @ 0x7f824480b000] Will reconnect at 835584 in 0 second(s), error=Input/output error.


    


    Additional Info : I also installed ffmpeg onto my mac, I only put the 1 file called ffmpeg in my path if that helps but I am pretty sure it has to do something with youtube_dl.

    


    Code : (Make sure to put your guild_id in the guild_id spot, another thing is when you invite the bot make sure in the 2auth section click 'bot' and 'application.commands')

    


    import discord
from discord.ext import commands
import youtube_dl
from discord_slash import cog_ext, SlashContext
from youtube_search import YoutubeSearch
import asyncio
import os


guild_ids = [GUILD ID GOES HERE]
queue = []
global is_playing
is_playing = False
time_video = 0 

class music(commands.Cog):
  def __init__(self, client):
    self.client = client
  
  @cog_ext.cog_slash(name="ping", guild_ids=guild_ids)
  async def ping(self, ctx):
    await ctx.send(content="Pong!")
  
  @cog_ext.cog_slash(name="join", guild_ids=guild_ids)
  async def join(self, ctx):
    if ctx.author.voice is None:
      return await ctx.send ("You are not in a voice channel!")
    voice_channel = ctx.author.voice.channel
    await voice_channel.connect()
    await ctx.guild.change_voice_state(channel=ctx.author.voice.channel, self_mute=True, self_deaf=True)
    await ctx.send("I joined the party :tada:")
  
  @cog_ext.cog_slash(name="disconnect", guild_ids=guild_ids)
  async def disconnect(self, ctx):
    await ctx.voice_client.disconnect()
  
  @cog_ext.cog_slash(name="play", guild_ids=guild_ids)
  async def play(self, ctx, input):
    if 'https://www.youtube.com/watch?' in input or 'https://youtu.be/' in input:
      YTDL_OPTIONS = {'format':"bestaudio"}
      with youtube_dl.YoutubeDL(YTDL_OPTIONS) as ydl:
        info_dict = ydl.extract_info(input, download=False)
        video_title = info_dict.get('title', None)

        results = YoutubeSearch(video_title, max_results=1).to_json()
        print(results)
        url_suffix_int = results.find('url_suffix') + 14


        results2 = "".join(['https://www.youtube.com', str(results[url_suffix_int:-3])])

        title_int = results.find('title') + 9
        title_int2 = results.find('long_desc') - 4
        title_string = str(results[title_int:title_int2])

        thumbnail_int = results.find('thumbnail') + 15
        title_split = results.find('title') - 5
        splitboth = str(results[thumbnail_int:title_split])
        final_result = splitboth.split('", "', 1)[0]

        channel_int = results.find('channel') + 11
        channel_int2 = results.find('duration') - 4
        channel_string = str(results[channel_int:channel_int2])

        duration_int = results.find('duration') + 12
        duration_int2 = results.find('views') - 4
        duration_string = str(results[duration_int:duration_int2])

        views_int = results.find('views') + 9
        views_int2 = results.find('publish_time') - 4
        views_string = str(results[views_int:views_int2])

        embed = discord.Embed(title=title_string, colour=discord.Colour(0x1), url=results2)

        embed.set_thumbnail(url=final_result)
        embed.set_author(name="Added to queue", icon_url=self.client.user.avatar_url)

        embed.add_field(name="Channel", value=channel_string, inline=True)
        embed.add_field(name="Song Duration", value=duration_string, inline=True)
        embed.add_field(name="Views", value=views_string, inline=True)

        await ctx.send(embed=embed)

        queue.append(input)
        await start_queue(self, ctx)

    else:
      results = YoutubeSearch(input, max_results=1).to_json()
      print(results)
      url_suffix_int = results.find('url_suffix') + 14


      results2 = "".join(['https://www.youtube.com', str(results[url_suffix_int:-3])])

      title_int = results.find('title') + 9
      title_int2 = results.find('long_desc') - 4
      title_string = str(results[title_int:title_int2])

      thumbnail_int = results.find('thumbnail') + 15
      title_split = results.find('title') - 5
      splitboth = str(results[thumbnail_int:title_split])
      final_result = splitboth.split('", "', 1)[0]

      channel_int = results.find('channel') + 11
      channel_int2 = results.find('duration') - 4
      channel_string = str(results[channel_int:channel_int2])

      duration_int = results.find('duration') + 12
      duration_int2 = results.find('views') - 4
      duration_string = str(results[duration_int:duration_int2])

      views_int = results.find('views') + 9
      views_int2 = results.find('publish_time') - 4
      views_string = str(results[views_int:views_int2])

      embed = discord.Embed(title=title_string, colour=discord.Colour(0x1), url=results2)

      embed.set_thumbnail(url=final_result)
      embed.set_author(name="Added to queue", icon_url=self.client.user.avatar_url)

      embed.add_field(name="Channel", value=channel_string, inline=True)
      embed.add_field(name="Song Duration", value=duration_string, inline=True)
      embed.add_field(name="Views", value=views_string, inline=True)

      await ctx.send(embed=embed)

      queue.append(results2)
      await start_queue(self, ctx)
    

  @cog_ext.cog_slash(name="pause", guild_ids=guild_ids)
  async def pause(self, ctx):
    ctx.voice_client.pause()
  
  
  @cog_ext.cog_slash(name="resume", guild_ids=guild_ids)
  async def resume(self, ctx):
    ctx.voice_client.resume()

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

async def start_queue(self, ctx):
    print(is_playing)
    if len(queue) <= 0:
      await ctx.voice_client.disconnect()
    while(len(queue) > 0):
      if(is_playing == False):
        await start(self, ctx, queue[0])

    

async def start(self, ctx, link_yt):
      global is_playing
      is_playing = True
      FFMPEG_OPTIONS = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
      YTDL_OPTIONS = {'format':"bestaudio"}
      vc = ctx.voice_client
      with youtube_dl.YoutubeDL(YTDL_OPTIONS) as ydl:
        info = ydl.extract_info(link_yt, download=False)
        url2 = info['formats'][0]['url']
        source = await discord.FFmpegOpusAudio.from_probe(url2, **FFMPEG_OPTIONS)
        vc.play(source)
        await asyncio.sleep(info['duration'] + 1)
        print("Done")
        del queue[0]
        is_playing = False


    


    Final Note : I did try to download and play the song but in the end it gave me the following error :

    


    Options reconnect not found.


    


  • FFmpeg doesn't play audio, yet no error shown

    4 août 2023, par Kristupas

    So i'm learning Python and don't know much about FFmpeg. I am following a tutorial, which explains everything very clearly. Everything is working, with one exception. Whenever I try to get it to play a sound, it won't.. Here's what it is saying :

    


    INFO     discord.player ffmpeg process 2540 successfully terminated with return code of 1.

    


    And here's my code (forgive me for all of the childish things in there, i'm just trying out different features) :

    


    
import discord
import discord.ext
from discord import FFmpegPCMAudio
from discord.ext import commands
import random


Token = "No token for you :)"
client = commands.Bot(command_prefix = '!', intents=discord.Intents.all())


@client.event
async def on_ready():
    print(f"we're rolling as {client.user} \n")
    channel = client.get_channel(1022535885851459727)
    await channel.send("Tremble before my might hoomans😤😤")

#Member events:

@client.event
async def on_member_join(member):
    await member.send("Ok comrade, welcome to bot lab, pls not leave. Anways here rules \n1. No swearing \n2. No cursing \n3. No bullying, the owner is a crybaby \n4. No following the rules (u get banned if this one is broken)")
    channel = client.get_channel(1136658873688801302)
    jokes = [f"A failure known as {member} has joined this chat!", 
             f"Another {member} has joined the channel", 
             f"A {member} spawned", 
             f'cout << "{member} has joined teh chat" << endl;', 
             f"OUR great {member} has come to save us" ]
    await channel.send(jokes[random.randint(0,len(jokes))])

@client.event 
async def on_member_remove(member):
    await member.send("Bye our dear comrade")
    channel = client.get_channel(1136663317738442752)
    await channel.send(f"{member} has left the chat :(.)")

#Client commands:
    
@client.command()
async def hello(ctx):
    await ctx.send("Hello, I am pro bot")

@client.command()
async def byelol(ctx):
    await ctx.send("Bye, I am pro bot")
@client.command()
async def ping(ctx):
    await ctx.send(f"**pong** {ctx.message.author.mention}")


@client.event
async def on_message(message):
    message.content = message.content.lower()
    await client.process_commands(message)


#voice channel commands:

@client.command(pass_context = True)
async def micup(ctx):
    if (ctx.author.voice):
        await ctx.send(f"Joining on {ctx.message.author}'s command")
        channel = ctx.message.author.voice.channel
        voice = await channel.connect()
        source = FFmpegPCMAudio('Bluetooth.wav')
        player = voice.play(source)
        
        
        
    else:
        await ctx.send("No.")



@client.command(pass_Context = True)
async def leave(ctx):
    if (ctx.voice_client):
        await ctx.send(f"Leaving on {ctx.message.author}'s command")
        await ctx.guild.voice_client.disconnect()
    else:
        await ctx.send("Nyet. Im not in voice chat u stoopid hooman")


@client.command(pass_Context = True)
async def pause(ctx):
    voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
    if voice.is_playing():
        await ctx.send("Pausing..⏸")
        voice.pause()
    else:
        await ctx.send("I don't think I will.")

@client.command(pass_Context = True)
async def resume(ctx):
    voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
    if voice.is_paused():
        await ctx.send("My ears are bleeding")
        voice.resume()
    else:
        await ctx.send("ALREADY BLASTING MUSIC")

@client.command(pass_Context = True)
async def stop(ctx):
    voice = discord.utils.get(client.voice_clients, guild = ctx.guild)
    await ctx.send("You can stop the song, but you can't stop me!")
    voice.stop()

@client.command(pass_Context = True)
async def play(ctx, arg):
    await ctx.send("Playing..")
    voice = ctx.guild.voice_client
    source = FFmpegPCMAudio(arg)
    player = voice.play(source)

if '__main__' == __name__:
    client.run(Token)


    


    I tried installing different versions of ffmpeg, still nothing. I tried to run the code outside of my venv, but still nothing (i doubt that it's the problem). I changed the path to it to different folders, still nothing.
The only time it DID work is when i entered a full path, but then when you want to play something, you wouldn't want to say " !play D:_Python\DiscordBot\Bluetooth.wav". From what i've seen, it's possible to play it by just saying " !play Bluetooth.wav".

    


    So long story short : I want to make it so that the path i have to specify is just the file name. And when I do, it doesn't play the sound.
(sorry if this is a dupe question, i just couldn't find anything understandable for my amateur brain)

    


  • Cannot open connection tcp ://localhost:1935 when to set up custom RTMP stream server

    8 janvier 2021, par showkey

    My simple network is as following :

    


    192.168.31.52 is my local pc 
192.168.31.251 is an ip camera.


    


    I can open the stream rtsp://192.168.31.251/cam/realmonitor?channel=1&subtype=0 with SMPlayer.
    
Build my nginx for customizing RTMP stream this way.

    


    sudo apt update
sudo apt install build-essential git
sudo apt install libpcre3-dev libssl-dev zlib1g-dev 
git clone https://github.com/arut/nginx-rtmp-module.git
git clone https://github.com/nginx/nginx.git
cd nginx
./auto/configure --add-module=../nginx-rtmp-module
make
sudo make install


    


    Set config file for nginx :

    


    sudo vim /usr/local/nginx/conf/nginx.conf
rtmp { 
    server { 
        listen 1935; 
        application live { 
            live on; 
            interleave on;
 
            hls on; 
            hls_path /tmp/hls; 
            hls_fragment 15s; 
        } 
    } 
} 


    


    Then set permission for nginx :

    


    mkdir /tmp/hls
sudo chmod -R 755  /tmp/hls
sudo chown -R www-data:www-data  /tmp/hls


    


    Edit index.html in /tmp/hls.

    


    <p>test for nginx</p>&#xA;

    &#xA;

    Both 127.0.0.1/index.html and 192.168.31.52/index.html can open the /tmp/hls/index.html.

    &#xA;

    Now open port 1935 on my network :

    &#xA;

    sudo firewall-cmd --zone=public --add-port=1935/tcp --permanent&#xA;sudo firewall-cmd --reload &#xA;sudo firewall-cmd --list-ports | grep 1935&#xA;1935/tcp&#xA;

    &#xA;

    Start nginx :

    &#xA;

    sudo systemctl start nginx&#xA;

    &#xA;

    Up stream the rtsp stream from ip camera—192.168.31.251 to local pc —192.168.31.52.

    &#xA;

    input="rtsp://192.168.31.251/cam/realmonitor?channel=1&amp;subtype=0"&#xA;output="rtmp://192.168.31.52:1935/live/sample"&#xA;ffmpeg -i $input -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 96k -r 25 -b:v 500k -s 640*480 -f flv $output&#xA;

    &#xA;

    It encounter the following errors :

    &#xA;

    [tcp @ 0x59fb700] Connection to tcp://192.168.31.52:1935 failed: Connection refused&#xA;[rtmp @ 0x59fc5c0] Cannot open connection tcp://192.168.31.52:1935&#xA;rtmp://192.168.31.52:1935/live/sample: Connection refused&#xA;

    &#xA;

    To keep the issue simple,i replace $input with a mp4 file in local pc,same error info.
    &#xA;How can fix it ?
    &#xA;Ping my machine :

    &#xA;

    ping 192.168.31.52&#xA;PING 192.168.31.52 (192.168.31.52): 56 data bytes&#xA;64 bytes from 192.168.31.52: icmp_seq=0 ttl=64 time=0.108 ms&#xA;64 bytes from 192.168.31.52: icmp_seq=1 ttl=64 time=0.107 ms&#xA;64 bytes from 192.168.31.52: icmp_seq=2 ttl=64 time=0.111 ms&#xA;

    &#xA;

    Why the port 1935 not opened,i had restarted nginx after setting ?

    &#xA;

    sudo lsof -i:1935&#xA;#nothing in the output&#xA;netstat -ltn&#xA;Active Internet connections (only servers)&#xA;Proto Recv-Q Send-Q Local Address           Foreign Address         State      &#xA;tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN     &#xA;tcp        0      0 0.0.0.0:51413           0.0.0.0:*               LISTEN     &#xA;tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     &#xA;tcp        0      0 127.0.0.1:1080          0.0.0.0:*               LISTEN     &#xA;tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     &#xA;tcp        0      0 127.0.0.1:8123          0.0.0.0:*               LISTEN     &#xA;tcp        0      0 127.0.0.1:8384          0.0.0.0:*               LISTEN     &#xA;tcp        0      0 0.0.0.0:9091            0.0.0.0:*               LISTEN     &#xA;tcp6       0      0 :::3306                 :::*                    LISTEN     &#xA;tcp6       0      0 :::80                   :::*                    LISTEN     &#xA;tcp6       0      0 :::22000                :::*                    LISTEN     &#xA;tcp6       0      0 :::51413                :::*                    LISTEN     &#xA;tcp6       0      0 :::21                   :::*                    LISTEN     &#xA;tcp6       0      0 :::22                   :::*                    LISTEN     &#xA;tcp6       0      0 ::1:25                  :::*                    LISTEN     &#xA;tcp6       0      0 :::2681                 :::*                    LISTEN  &#xA;

    &#xA;

    Firewall command can't work :

    &#xA;

    sudo firewall-cmd --zone=public --add-port=1935/tcp --permanent&#xA;sudo firewall-cmd --reload &#xA;

    &#xA;

    My nginx version :

    &#xA;

    sudo nginx -v&#xA;nginx version: nginx/1.10.3&#xA;

    &#xA;