
Recherche avancée
Médias (1)
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (65)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
Participer à sa traduction
10 avril 2011Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
Actuellement MediaSPIP n’est disponible qu’en français et (...) -
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)
Sur d’autres sites (12237)
-
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()



-
TypeError : 'FFmpegOpusAudio' object is not subscriptable
12 octobre 2022, par Virat ChauhanI am getting this error whenever I try to get the bot to play a song in vc :


await ctx.send('Now playing ' + '**' + str(queues[ctx.message.guild.id]['title'][0]) + '**')
TypeError: 'FFmpegOpusAudio' object is not subscriptable



Here is the relevant code :


async def playSong(self, ctx, url):
 queues[ctx.message.guild.id]['title'] = []
 with youtube_dl.YoutubeDL(self.YDL_OPTIONS) as ydl:
 info = ydl.extract_info(url, download=False)
 if 'entries' in info: # if no url is input
 url2 = info['entries'][0]['formats'][0]['url']
 queues[ctx.message.guild.id]['title'].append(info['entries'][0]['title'])
 elif 'formats' in info: # if url is passed
 url2 = info['formats'][0]['url']
 queues[ctx.message.guild.id]['title'].append(info['title'])
 #print(queues[ctx.message.guild.id]['title'][0])
 stream = await discord.FFmpegOpusAudio.from_probe(url2, **self.FFMPEG_OPTIONS)
 return stream
 
 @commands.command(name='play', help="Plays any song", aliases=['p'])
 async def play(self, ctx, *, url):
 vc = ctx.guild.voice_client
 if not vc.is_playing():
 guild = ctx.message.guild
 
 queues[guild.id] = {}
 stream = await self.playSong(ctx, url)
 queues[guild.id] = stream
 vc.play(stream, after=lambda e: self.queueCheck(guild.id, vc))
 await ctx.send('Now playing ' + '**' + str(queues[ctx.message.guild.id]['title'][0]) + '**')



I am aware that this can be solved with having two dictionaries but I wish to contain all data inside a single structure.


-
FFMPEG : Reducing bandwidth usage while trimming youtube audio
24 octobre 2022, par nashI have created a python script which creates audio trims of youtube videos using ffmpeg.


The script works fine for small videos of about <20m, however my intention is to use this for large videos most of which are several hours long.
It appears ffmpeg may be streaming the entire audio while seeking the trim points, not only is this slow but it adds a lot of unnecessary network overhead, especially since the trims I'm making are barely a minute long.


Here is the script :


from yt_dlp import YoutubeDL as ydl
import ffmpeg, sys, getopt


default_url = "https://youtu.be/FtutLA63Cp8"
default_start = "6"
default_end = "36"


def get_secs(time_str) -> int:

 h = "0"
 m = "0"
 s = "0"

 time_hms = time_str.split(":")

 if len(time_hms) == 1:
 s = time_hms[0]
 elif len(time_hms) == 2:
 m, s = time_hms
 elif len(time_hms) == 3:
 h, m, s = time_hms

 secs = (int(h) * 3600) + (int(m) * 60) + int(s)
 return secs


# Extract Url
def get_url(url):

 ydl_opts = {}
 info = ydl(ydl_opts).extract_info(url, download=False) # dict of lists
 # info = ydl.sanitize_info(info)

 title = info["title"].strip() + ".mp4"

 formats = info["formats"] # list of dicts
 audio_direct_url = ""
 for format in formats:
 if format["audio_ext"] != "none":
 audio_direct_url = format["url"]
 break

 # return r["formats"][-1]["url"]
 return audio_direct_url, title


def snip_url(url, title, start, end):
 input = ffmpeg.input(url)
 pts = "PTS-STARTPTS"
 audio = input.filter_("atrim", start=start, end=end).filter_("asetpts", pts)
 out = ffmpeg.output(audio, ("out/" + title))

 return ffmpeg.run(out)


def mince():
 pass


def main(argv):
 usage_str = "main.py -u <url> -o <outputfile> -s <starttime> -t <stoptime>"
 target_url = ""
 out_filename = ""
 start_time = default_start
 stop_time = default_end

 try:
 opts, args = getopt.getopt(
 argv, "hu:o:s:t:", ["url=", "ofile=", "start=", "terminate="]
 )

 except getopt.GetoptError:
 print(usage_str)
 sys.exit(2)

 for opt, arg in opts:
 if opt == "-h":
 print(usage_str)
 sys.exit()
 elif opt in ("-u", "--url"):
 target_url = arg
 elif opt in ("-o", "--ofile"):
 out_filename = arg
 elif opt in ("-s", "--start"):
 start_time = arg
 elif opt in ("-t", "--terminate"):
 stop_time = arg

 if target_url == "":
 print(usage_str)
 sys.exit(2)

 # URLs may have seperators, remove them
 target_url = target_url.rsplit("?")[0]

 stream_url, title = get_url(target_url)
 if out_filename != "":
 title = out_filename
 start_time = get_secs(start_time)
 stop_time = get_secs(stop_time)
 snip_url(stream_url, title, start_time, stop_time)


if __name__ == "__main__":

 main(sys.argv[1:])
</stoptime></starttime></outputfile></url>


There is a similar question on this site, however this involves grabbing still frames and not audio sections.


I have also looked through both the
ffmpeg-python
and regular ffmpeg documentation and not found anything relevant.

Is there a way to get ffmpeg to 'skip' to the desired trim position without streaming the entire audio ? Preferrably using the
ffmpeg-python
library.

If not, are there ways I can reduce the bandwidth overhead and/or speed up this process.


I am also open to using other software (preferrably python libraries) similar to ffmpeg that can achieve the same task.