Recherche avancée

Médias (1)

Mot : - Tags -/biographie

Autres articles (85)

  • Modifier la date de publication

    21 juin 2013, par

    Comment changer la date de publication d’un média ?
    Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
    Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
    Dans la rubrique "Champs à ajouter, cocher "Date de publication "
    Cliquer en bas de la page sur Enregistrer

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (10046)

  • How to make FFMPEG faster in general ? [closed]

    26 mars 2021, par GitM

    I convert regulary my video files to current codecs, to keep them available for most of the (currently used) devices.

    


    I use this to convert video files for apple tv :
ffmpeg -i video_file.abc -c:v libx265 -crf 27 -c:a aac -b:a 128k -tag:v hvc1 video_file_updatedt.mp4

    


    ... and this to convert audio files to ogg :
ffmpeg -i audio_file.abc -c:a libvorbis -q:a 4 audio_file_updated.ogg

    


    but it consumes 100% of my six core CPU (max. 3.4GHz) an took hours.

    


    Is there a smart way to speed this up and reduce CPU usage at the same time ?
Should i switch to another OS like Linux, one with better usage of my CPU ?

    


  • Error for command not found, Discord bot in Python

    12 mars 2024, par Skely

    I followed a tutorial for making a discord bot and every time I type in a command I get the error message :

    


    discord.ext.commands.errors.CommandNotFound: Command "play" is not found

    


    It runs and shows to be online in my Discord server, I have given it every permission know to man, and checked through multiple times in my code to see if I find something wrong. But I don't see anything that can be changed or something that can fix it. I am in desperate need for help.
Thanks alot in advance !!

    


    This is my files and code :

    


    main.py

    


    import discord
from discord.ext import commands
import os

from help_cog import help_cog
from music_cog import music_cog

bot = commands.Bot(command_prefix="?", intents=discord.Intents.all())

bot.remove_command("help")

bot.add_cog(help_cog(bot))
bot.add_cog(music_cog(bot))

bot.run(os.getenv("TOKEN"))



    


    music_cog.py

    


    import discord
from discord.ext import commands

from yt_dlp import YoutubeDL

import yt_dlp as youtube_dl

class music_cog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

        self.is_playing = False
        self.is_paused = False

        self.music_queue = []
        self.YDL_OPTIONS = {"format": "bestaudio", "postprocessors": [{"key": "FFmpegExtractAudio", "preferredcodec": "mp3", "preferredquality": "192",}]}
        self.FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn"}

        self.vc = None
        print("Success")

    def search_yt(self, item):
        with YoutubeDL(self.YDL_OPTIONS) as ydl:
            try:
                info = ydl.extract_info(f"ytsearch:{item}", download=False)["entries"][0]
            except Exception:
                return False
        return {"source": info["url"], "title": info["title"]}

    def play_next(self):
        if len(self.music_queue) > 0:
            self.is_playing = True

            m_url = self.music_queue[0][0]["source"]

            self.music_queue.pop(0)

            self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
        else:
            self.is_playing = False

    async def play_music(self, ctx):
        if len(self.music_queue) > 0:
            self.is_playing = True
            m_url = self.music_queue[0][0]["source"]

            if self.vc == None or not self.vc.is_connected():
                self.vc = await self.music_queue[0][1].connect()

                if self.vc == None:
                    await ctx.send("Could not connect to the voice channel")
                    return
            else:
                await self.vc.move_to(self.music_queue[0][1])
            
            self.music_queue.pop(0)

            self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())

        else:
            self.is_playing = False

    @commands.command(name="play", aliases=["p", "playing"], help="Play the selected song from YouTube")
    async def play(self, ctx, *args):
        query = " ".join(args)

        voice_channel = ctx.author.voice.channel
        if voice_channel is None:
            await ctx.send("Connect to a voice channel!")
        elif self.is_paused:
            self.vc.resume()
        else:
            song = self.search_yt(query)
            if type(song) == type(True):
                await ctx.send("Could not download the song. Incorrect format, try a different keyword")
            else:
                await ctx.send("Song added to queue")
                self.music_queue.append([song, voice_channel])

                if self.is_playing == False:
                    await self.play_music(ctx)
    
    @commands.command(name="pause", help="Pauses the current song being played")
    async def pause(self, ctx, *args):
        if self.is_playing:
            self.is_playing = False
            self.is_paused = True
            self.vc.pause()
        elif self.is_paused:
            self.is_playing = True
            self.is_paused = False
            self.vc.resume()

    @commands.command(name="resume", aliases=["r"], help="Resumes playing the current song")
    async def resume(self, ctx, *args):
        if self.is_paused:
            self.is_playing = True
            self.is_paused = False
            self.vc.resume()
        
    @commands.command(name="skip", aliases=["s"], help="Skips the currently played song")
    async def skip(self, ctx, *args):
        if self.vc != None and self.vc:
            self.vc.stop()
            await self.play_music(ctx)

    @commands.command(name="queue", aliases=["q"], help="Displays all the songs currently in queue")
    async def queue(self, ctx):
        retval = ""

        for i in range(0, len(self.music_queue)):
            if i > 4: break
            retval += self.music_queue[i][0]["title"] + "\n"

        if retval != "":
            await ctx.send(retval)
        else:
            await ctx.send("No music in the current queue")
    
    @commands.command(name="clear", aliases=["c", "bin"], help="Stops the current song and clears the queue")
    async def clear(self, ctx, *args):
        if self.vc != None and self.is_playing:
            self.vc.stop()
        self.music_queue = []
        await ctx.send("Music queue cleared")

    @commands.command(name="leave", aliases=["disconnect", "l", "d"], help="Kick the bot from the voice channel")
    async def leave(self, ctx):
        self.is_playing = False
        self.is_paused = False
        await self.vc.disconnect()



    


    help_cog.py

    


    import discord
from discord.ext import commands

class help_cog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

        self.help_message = """
        Help message
"""

        self.text_channel_text = []
    
    @commands.Cog.listener()
    async def on_ready(self):
        for guild in self.bot.guilds:
            for channel in guild.text_channels:
                self.text_channel_text.append(channel)

        await self.send_to_all(self.help_message)

    async def send_to_all(self, msg):
        for text_channel in self.text_channel_text:
            await text_channel.send(msg)
        
    @commands.command(name="help", help="Displays all the available commands")
    async def help(self, ctx):
        await ctx.send(self.help_message)



    


  • error on Heroku application log after deployment

    30 juin 2021, par SDB PROGRAM LEARNER

    I had made a discord bot and deploy it to Heroku in this bot I can play youtube songs normally but after deploying on Heroku it gives me errors on application logs when I am trying to play my song

    


    My code :-

    


    import discord,requests, sys, webbrowser, bs4
import youtube_dl
import os
from dotenv import load_dotenv
import ffmpeg
from discord.ext import *
from discord.ext import commands
from discord.ext.commands import Bot
from discord.voice_client import VoiceClient
import asyncio
@client.command(pass_context=True)                      #====================================Join
async def join(ctx):
    channel = ctx.author.voice.channel
    await channel.connect()
@client.command()                                         #==================================Play
async def play(ctx, url:str):
    song_there = os.path.isfile("song.mp3")
    try:
        if song_there:
            os.remove("song.mp3")
            player.clear()
    except PermissionError:
        await ctx.send("Wait for the current playing music end or use the 'stop' command...")
        return
    await ctx.send("Getting everything ready, playing audio soon, depends on your internet speed...")
    print("Someone wants to play music let me get that ready for them...")
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
    ydl_opts = {
        'format': 'bestaudio/best',
            'postprocessors': [{
            'key': 'FFmpegExtractAudio',
            'preferredcodec': 'mp3',
            'preferredquality': '192',
        }],
    }
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download([url])
    for file in os.listdir("./"):
        if file.endswith(".mp3"):
            os.rename(file, 'song.mp3')
    voice.play(discord.FFmpegPCMAudio("song.mp3"))
    
    voice.volume = 100


    


    It works properly on localhost from vscode

    


    but when I trying to use this after deployment on Heroku it gives me the error below

    


    2021-06-30T07:41:09.476383+00:00 app[worker.1]: The above exception was the direct cause of the following exception:
2021-06-30T07:41:09.476384+00:00 app[worker.1]: 
2021-06-30T07:41:09.476384+00:00 app[worker.1]: Traceback (most recent call last):
2021-06-30T07:41:09.476422+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
2021-06-30T07:41:09.476423+00:00 app[worker.1]:     await ctx.command.invoke(ctx)
2021-06-30T07:41:09.476427+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
2021-06-30T07:41:09.476427+00:00 app[worker.1]:     await injected(*ctx.args, **ctx.kwargs)
2021-06-30T07:41:09.476451+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped
2021-06-30T07:41:09.476452+00:00 app[worker.1]:     raise CommandInvokeError(exc) from exc
2021-06-30T07:41:09.476487+00:00 app[worker.1]: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DownloadError: ERROR: ffprobe/avprobe and ffmpeg/avconv not found. Please install one.


    


    Please help me to solve this problem