
Recherche avancée
Autres articles (81)
-
Les notifications de la ferme
1er décembre 2010, parAfin d’assurer une gestion correcte de la ferme, il est nécessaire de notifier plusieurs choses lors d’actions spécifiques à la fois à l’utilisateur mais également à l’ensemble des administrateurs de la ferme.
Les notifications de changement de statut
Lors d’un changement de statut d’une instance, l’ensemble des administrateurs de la ferme doivent être notifiés de cette modification ainsi que l’utilisateur administrateur de l’instance.
À la demande d’un canal
Passage au statut "publie"
Passage au (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Publier sur MédiaSpip
13 juin 2013Puis-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
Sur d’autres sites (13172)
-
After merge videos, the duration is too long - ffmpeg
20 février 2017, par Thanh DaoI have file txt with content
file intro.mp4
file video.mp4
file outtro.mp4with duration by
10s
,178s
,13s
.I use ffmpeg to merge 3 files into one with below command :
ffmpeg -f concat -i "file.txt" -vcodec copy -acodec copy "endfile.mp4"
The duration of
endfile.mp4
is longer11
mins (660s
).I have a question that
which params of video affect to merge?
Andwhich common params to merge another videos?
My English really too bad. Sorry for it :)
Good working this week !P/S
Details infor of files :intro.mp4
:ffprobe version N-82885-g6d09d6e Copyright (c) 2007-2016 the FFmpeg developers<br />
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)<br />
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --<br />bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame<br /> --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265<br />
libavutil 55. 43.100 / 55. 43.100<br />
libavcodec 57. 68.100 / 57. 68.100<br />
libavformat 57. 61.100 / 57. 61.100<br />
libavdevice 57. 2.100 / 57. 2.100<br />
libavfilter 6. 68.100 / 6. 68.100<br />
libswscale 4. 3.101 / 4. 3.101<br />
libswresample 2. 4.100 / 2. 4.100<br />
libpostproc 54. 2.100 / 54. 2.100<br />
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/to/intro.mp4':<br />
Metadata:<br />
major_brand : isom<br />
minor_version : 512<br />
compatible_brands: isomiso2avc1mp41<br />
encoder : Lavf56.23.100<br />
Duration: 00:00:10.08, start: -0.013061, bitrate: 701 kb/s<br />
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)<br />
Metadata:<br />
handler_name : SoundHandler<br />
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 853 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)<br />
Metadata:<br />
handler_name : VideoHandler<br />outtro.mp4
:ffprobe version N-82885-g6d09d6e Copyright (c) 2007-2016 the FFmpeg developers<br />
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)<br />
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --<br />bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame<br /> --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265<br />
libavutil 55. 43.100 / 55. 43.100<br />
libavcodec 57. 68.100 / 57. 68.100<br />
libavformat 57. 61.100 / 57. 61.100<br />
libavdevice 57. 2.100 / 57. 2.100<br />
libavfilter 6. 68.100 / 6. 68.100<br />
libswscale 4. 3.101 / 4. 3.101<br />
libswresample 2. 4.100 / 2. 4.100<br />
libpostproc 54. 2.100 / 54. 2.100<br />
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/to/outtro.mp4':<br />
Metadata:<br />
major_brand : isom<br />
minor_version : 512<br />
compatible_brands: isomiso2avc1mp41<br />
encoder : Lavf56.23.100<br />
Duration: 00:00:13.08, start: -0.013061, bitrate: 481 kb/s<br />
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)<br />
Metadata:<br />
handler_name : SoundHandler<br />
Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 392 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)<br />
Metadata:<br />
handler_name : VideoHandler<br />video.mp4
ffprobe version N-82885-g6d09d6e Copyright (c) 2007-2016 the FFmpeg developers<br />
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)<br />
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --<br />bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame<br /> --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265<br />
libavutil 55. 43.100 / 55. 43.100<br /><br />
libavcodec 57. 68.100 / 57. 68.100<br /><br />
libavformat 57. 61.100 / 57. 61.100<br /><br />
libavdevice 57. 2.100 / 57. 2.100<br /><br />
libavfilter 6. 68.100 / 6. 68.100<br /><br />
libswscale 4. 3.101 / 4. 3.101<br /><br />
libswresample 2. 4.100 / 2. 4.100<br /><br />
libpostproc 54. 2.100 / 54. 2.100<br /><br />
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'path/to/video.mp4':<br />
Metadata:<br />
major_brand : isom<br />
minor_version : 512<br />
compatible_brands: isomiso2avc1mp41<br />
encoder : Lavf57.61.100<br />
Duration: 00:02:58.38, start: 0.000000, bitrate: 922 kb/s<br />
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 782 kb/s, 29.97 fps, 29.97 tbr, 30k <br />tbn, 59.94 tbc (default)<br />
Metadata:<br />
handler_name : VideoHandler<br />
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 130 kb/s (default)<br />
Metadata:<br />
handler_name : SoundHandler<br /> -
Discord music bot doesn't play songs
9 octobre 2023, par Gam3rsCZI have made myself a discord bot that also plays music(it's only for my server so strings with messages are in Czech, but code is in English).
Bot worked a while ago but now it stopped, and I don't know where the problem is


I'm getting these errors : HTTP error 403 Forbidden Server returned 403 Forbidden (access denied) and
C :\Users\Me\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\player.py:711 : RuntimeWarning : coroutine 'music_cog.play_next' was never awaited
self.after(error)
RuntimeWarning : Enable tracemalloc to get the object allocation traceback
[2023-10-09 16:23:47] [INFO ] discord.player : ffmpeg process 17496 successfully terminated with return code of 1.
INFO : ffmpeg process 17496 successfully terminated with return code of 1.


My code is :


import discord
from discord.ext import commands
from yt_dlp import YoutubeDL

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

 self.is_playing = False
 self.is_paused = False
 self.current = ""

 self.music_queue = []
 self.YDL_OPTIONS = {"format": "m4a/bestaudio/best", "noplaylist": "True"}
 self.FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn"}

 self.vc = None

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

 async def play_next(self):
 if len(self.music_queue) > 0:
 self.is_playing = True
 self.current = self.music_queue[0][0]["title"]
 m_url = self.music_queue[0][0]["source"]

 self.music_queue.pop(0)

 await 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):
 try:
 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("Nepodařilo se připojit do hlasového kanálu.")
 return
 else:
 await self.vc.move_to(self.music_queue[0][1])

 self.current = self.music_queue[0][0]["title"]
 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

 except:
 print("Something went wrong")
 await ctx.send(content="Něco se pokazilo")

 @commands.command(name="play", help="Plays 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("Připojte se do hlasového kanálu!")
 elif self.is_paused:
 self.vc.resume()
 else:
 song = self.search_yt(query)
 if type(song) == type(True):
 await ctx.send("Písničku se nepodařilo stáhnout. Špatný formát, možná jste se pokusili zadat playlist nebo livestream.")
 else:
 await ctx.send("Písnička přidána do řady.")
 self.music_queue.append([song, voice_channel])

 if self.is_playing == False:
 await self.play_music(ctx)
 self.is_playing = True

 @commands.command(name="pause", aliases=["p"], help="Pauses the BOT")
 async def pause(self, ctx, *args):
 if self.is_playing:
 self.is_playing = False
 self.is_paused = True
 self.vc.pause()
 await ctx.send(content="Písnička byla pozastavena.")
 
 elif self.is_paused:
 self.is_playing = True
 self.is_paused = False
 self.vc.resume()
 await ctx.send(content="Písnička byla obnovena.")

 @commands.command(name="resume", aliases=["r"], help="Resumes playing")
 async def resume(self, ctx, *args):
 if self.is_paused:
 self.is_paused = False
 self.is_playing = True
 self.vc.resume()
 await ctx.send(content="Písnička byla obnovena.")

 @commands.command(name="skip", aliases=["s"], help="Skips current song")
 async def skip(self, ctx, *args):
 if self.vc != None and self.vc:
 self.vc.stop()
 await self.play_next()
 await ctx.send(content="Písnička byla přeskočena.")

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

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

 if retval != "":
 retval += "```"
 await ctx.send(content=("```Aktuální fronta:\n" + retval))
 else:
 await ctx.send("Řada je prázdná.")

 @commands.command(name="clear", help="Clears the queue")
 async def clear(self, ctx):
 if self.vc != None and self.is_playing:
 self.vc.stop()
 self.music_queue = []
 await ctx.send("Řada byla vymazána.")

 @commands.command(name="leave", aliases=["dc", "disconnect"], help="Disconnects the BOT")
 async def leave(self, ctx):
 self.is_playing = False
 self.is_paused = False

 if self.vc != None:
 return await self.vc.disconnect(), await ctx.send(content="BOT byl odpojen.")

 else:
 return await ctx.send("BOT není nikde připojen.")
 
 @commands.command(name="current", help="Displays the current song")
 async def current(self, ctx):
 current = self.current
 retval = f"```Právě hraje:\n {current}```"
 if current != "":
 await ctx.send(retval)
 else:
 await ctx.send("Aktuálně nic nehraje.")



I already tried everything I can think of(which isn't a lot because I suck at programming), and also tried searching for some solution on the internet, but nothing worked.


-
How to use Behavioural Analytics to Improve Website Performance