
Recherche avancée
Médias (2)
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
Autres articles (54)
-
Le profil des utilisateurs
12 avril 2011, parChaque 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 (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (4804)
-
Anomaly in raw I420 video generated by GStreamer
16 avril 2024, par LeaSituation


I'm trying to convert RGBA image data to YUV420P in multiple threads, then send this data to a main thread which splits the data it receives from each thread into separate frames and combines them in order to a video. Currently, I'm using FFmpeg for this task but I've found GStreamer to do a quicker job at colorspace conversion than FFmpeg.


Problem


The raw video generated by GStreamer does not match the expectations for YUV 4:2:0 planar video data. To test this, I've made a raw RGBA test video of 3 red 4x4 (16 pixel) frames.


ffmpeg -f lavfi -i color=color=red -t 3 -r 1 -s 4x4 -f rawvideo -pix_fmt rgba ./input.rgba





FFmpeg


Now, first trying to convert it via FFmpeg as I'm doing it currently :


ffmpeg -f rawvideo -pix_fmt rgba -s 4x4 -i input.rgba -f rawvideo -pix_fmt yuv420p ./ffmpeg.yuv420p



This creates a 72 byte file => 1.5 bytes per pixel, 24 bytes per frame : As expected for yuv420p data.


$ hexdump -C ./ffmpeg.yuv420p 
00000000 51 51 51 51 50 50 50 50 50 50 50 50 50 50 50 50 |QQQQPPPPPPPPPPPP|
00000010 5b 5b 5b 5b ee ee ee ee 51 51 51 51 50 50 50 50 |[[[[....QQQQPPPP|
00000020 50 50 50 50 50 50 50 50 5b 5b 5b 5b ee ee ee ee |PPPPPPPP[[[[....|
00000030 51 51 51 51 50 50 50 50 50 50 50 50 50 50 50 50 |QQQQPPPPPPPPPPPP|
00000040 5b 5b 5b 5b ee ee ee ee |[[[[....|



GStreamer


Now trying to do the same via GStreamer, with the
I420
format which corresponds to yuv420p as per their documentation :

gst-launch-1.0 filesrc location=./input.rgba ! rawvideoparse format=rgba width=4 height=4 \
! videoconvert ! video/x-raw,format=I420 ! filesink location=./gstreamer.yuv420p



This creates a 96 byte file => 2 bytes per pixel, 32 bytes per frame (?) : Unusual for yuv420p data. Additionally, none of the sections match the FFmpeg output, ruling out some kind of padding.


$ hexdump -C ./gstreamer.yuv420p 
00000000 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 |PPPPPPPPPPPPPPPP|
00000010 5a 5a 00 00 5a 5a 00 00 ee ee 00 00 ed ed 00 00 |ZZ..ZZ..........|
00000020 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 |PPPPPPPPPPPPPPPP|
00000030 5a 5a 63 6b 5a 5a 77 62 ee ee 78 6d ed ed 2c 20 |ZZckZZwb..xm.., |
00000040 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 |PPPPPPPPPPPPPPPP|
00000050 5a 5a 00 00 5a 5a 00 00 ee ee 00 00 ed ed 00 00 |ZZ..ZZ..........|



This output can also not be interpreted correctly as yuv420p by FFmpeg, leading to corrupted frames when trying to do so :


ffmpeg -f rawvideo -pix_fmt yuv420p -s 4x4 -i gstreamer.yuv420p -f image2 "./%d.png"





Solution ?


For my personal problem I need a way to chop up raw I420 video generated by GStreamer into separate frames to work with. However, I would also like to understand why GStreamer behaves this way and which key piece I'm missing here.


Additional notes


I've ruled out an issue with the input in GStreamer, as piping it to
autovideosink
leads to a normal result. I'm also aware of multifilesink, but I would like to avoid writing to disk and rather work with the data directly in buffers.

-
Need help to create a queue system with a discord.py bot
19 août 2024, par Zamvim trying to create a bot with discord.py, i'll start saying that the bot is for personal use so please don't point out that i shouldn't use ydl in the comments, ty :
Also, im a beginner, so please tell me what I can improve and any errors there are, I will be happy to listen.
That said, i've been stuck on trying to create this queue system for songs for the past 3 days, the bot was working perfectly fine and played some urls before i implemented the play_next function, now it doesn't even play the first song, even if it sends confirmation messages both in the terminal that in the discord channel, i know that the code might be a little confusing, but please i really need to know how to make this work


i wrote two main functions : "play_next" to play the next song in the queue and "play", the main command.
Here is my play_next function :


async def play_next(self,ctx):
 if not ctx.voice_client.is_playing: #(don't know if this is correct as I also check if the bot isn't playing anything in the play function)
 
 if self.song.queue: 
 next_song = self.song_queue.pop(0) #deleting the first element of the queue, so if we have (song_0, song_1 and song_2) the bot should delete (song_0) making in fact song_1 the "next" song_0
 try:
 ctx.voice_client.play(discord.FFmpegPCMAudio(next_song), 
 after=lambda e: self.bot.loop.create_task(self.play_next(ctx))) #Not gonna lie here, i asked chat gpt for this line, it should make the bot automatically play the next song one after another, correct me if I am wrong

#this is not important
 embed = discord.Embed(
 title="Song",
 description=f"Now playing {next_song}",
 color = 0x1DB954
 )
 await ctx.send(embed=embed)
 except Exception as e:
 print(f"Error playing the next song: {e}")

 else:
 await ctx.voice_client.disconnect() # disconnecting from the voice channel if the queue is empty
 print("Disconnected from the voice channel as the queue is empty.")



I think that the main problem of my bot is the play_next function, but here it is my "play" function :


@commands.command(pass_context=True)
 async def play(self, ctx, url: str): 
 if ctx.author.voice: # first checking if the user is in a voice channel
 if not ctx.voice_client: #then checking if the bot is already connected to a voice channel
 channel = ctx.message.author.voice.channel 
 try:
 await channel.connect() #then joining
 print("I joined the voice channel!")
 except Exception as e:
 print(f"Failed to connect to the voice channel: {e}")
 return

 song_path = f"song_{self.song_index}.mp3" #note, im using cogs, i declared self.song_index with the value of 0 
 self.song_index += 1 #i thought that this was the easiest way of creating a new file for each song

 ydl_opts = {
 'format': 'bestaudio/best',
 'postprocesors': [{
 'key': 'FFmpegExtractAudio',
 'preferredcodec': 'mp3',
 'preferredquality': '192',
 }],
 'outtmpl': song_path
 }
 try:
 with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 print("Starting download...")
 ydl.download([url]) #this is where it should download the song provided by the url
 print("Download finished.")
 except Exception as e:
 await ctx.send(f"Failed to download the song: {e}")
 return

#i think that the next two if statements are the main threats
 if os.path.exists(song_path): #if there is atleast 1 song in the queue
 self.song_queue.append(song_path) #append the next one
 embed = discord.Embed(
 title="Added to Queue!",
 description = f"{url} has been added to the queue.",
 color=0x33ff33
 )
 await ctx.send(embed=embed)


 if not ctx.voice_client.is_playing(): #checking if the bot is already playing something, don't know if i should put this if statement here
 print("Starting playback...")
 await self.play_next(ctx) #if nothing is playing, then the bot should play the next song



 else:
 await ctx.send("Failed to download or find the audio file.")

 else:
 embed = discord.Embed(
 title="❌You must be in a voice channel",
 color=0xff6666
 )
 await ctx.send(embed=embed)



thanks in advance, i will try to read and answer any questions as soon as possible


-
Conversion Funnel Optimisation : 10 Ways to Convert More
24 janvier 2024, par Erin