
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (69)
-
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...) -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...) -
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)
Sur d’autres sites (1860)
-
is there a way to change dynamic the water mark text color when using ffmpeg depending on the background color when recording a vieo file ?
11 juillet 2023, par Shelly RonThis command in the command prompt window is working fine and recording the entire screen :


ffmpeg -f gdigrab -framerate 24 -i desktop -preset ultrafast -pix_fmt yuv420p out.mp4



this command prompt add a water mark text in the middle of the screen in white color :


ffmpeg -f gdigrab -framerate 24 -i desktop -vf "drawtext=fontfile=path/to/arial.ttf:text='All rights reserved to ...':fontsize=24:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2" -preset ultrafast -pix_fmt yuv420p out.mp4



the problem is that the water mark text is in white and i can see it only when the background window color is black for example when i bring to the front the ffmpeg console window :




but when it's recording some window with white background, because the text is white it can't be seen.


I want to update the command prompt of the ffmpeg to make somehow dynamic so if the background window is black show the water mark text in white and then if I'm bringing up a window with background white change the water mark text automatic to black.


this is the command i tried for the dynamic effect but it didn't work i got errors and then i tried so many versions of the command line, but nothing helped or worked.


ffmpeg -f gdigrab -framerate 24 -i desktop -filter_complex "[0:v]drawtext=text='Watermark Text':x=(w-text_w)/2:y=(h-text_h)/2:fontfile=arial.ttf:fontsize=24,format=rgba [txt];[txt]split=2 [bw][wc];[bw]lut=r=val*2 [b];[wc]lut=r=val*0.5+0.5:g=val*0.5+0.5:b=val*0.5+0.5 [wc];[wc][b]alphamerge [wm];[wm][0:v]overlay=10:10[outv]" -c:v libx264 -preset ultrafast -map "[outv]" out.mp4



and also tried this


ffmpeg -f gdigrab -framerate 24 -i desktop -filter_complex "[0:v]drawtext=text='Watermark Text':x=(w-text_w)/2:y=(h-text_h)/2:fontfile=Arial.ttf:fontsize=24,format=rgba [txt];[txt]split=2 [bw][wm];[bw][1:v]split=3 [b][g][r];[b]geq=r=0:g=0.5:b=0 [b];[g]geq=r=0:g=0:b=0.5 [g];[r]geq=r=0.5:g=0:b=0 [r];[wm][b][g][r]merge=3,format=rgba [watermark];[0:v][watermark]overlay=x=(W-w)/2:y=(H-h)/2" -map "[watermark]" -map 0:a? -c:v libx264 -c:a copy -preset ultrafast out.mp4



-
JavaFXFrameConverter consuming insane amounts of memory
17 juillet 2023, par iexavThe JavaFXFrameConverter (from the wrapper of the ffmpeg C library in java) convert() method is consuming an outrageous amount of memory. To elaborate a bit more, it does not happen usually. If I just make an instance of the class in my main method, grab a frame via FFMpegFrameGrabber and give it to the convert() method the memory usage is pretty much none. However, when I attempt to do pretty much the exact same in a class I made using an ExecutorService my memory usage jumps up to 8 gigabytes when convert is called. The converter and executor service are declared as member variables of my class. Namely :


final JavaFXFrameConverter converter = new JavaFXFrameConverter();
 private ExecutorService videoExecutor;



(the videoExecutor is instantiated in the constructor of the class :


videoExecutor=Executors.newSingleThreadExecutor();



Now, the method I am using for processing of the video frames is this :


private void processVideo(){
 videoExecutor.submit(() -> {
 processingVideo.set(true);
 try{

 while(processingVideo.get() && (videoQueue.peek())!=null){

 final Frame cloneFrame = videoQueue.poll();
 final Image image = converter.convert(cloneFrame);
 final long timeStampDeltaMicros = cloneFrame.timestamp - timer.elapsedMicros();
 if (timeStampDeltaMicros > 0) {
 final long delayMillis = timeStampDeltaMicros / 1000L;
 try {
 Thread.sleep(delayMillis);
 } catch (InterruptedException e) {
 Thread.currentThread().interrupt();
 }
 }

 cloneFrame.close();
 System.out.println("submitted image");
 videoListener.submitData(image);
 }
 }catch (NullPointerException e){
 NullPointerException ex = new NullPointerException("Error while processing video frames.");
 videoListener.notifyFailure(ex);
 }

 processingVideo.set(false);

 });
 }



I sent the whole method for a bit more context but realistically speaking the only part that is of real significance is the converter.conver(cloneFrame) ; I used the intelliJ profiler and also the debugger and this is exactly where the problem occurs. When convert is called after doing some stuff it eventually ends up in this method :


public <t extends="extends" buffer="buffer"> void getPixels(int x, int y, int w, int h, WritablePixelFormat<t> pixelformat, T buffer, int scanlineStride) {
 int fss = this.frame.imageStride;
 if (this.frame.imageChannels != 3) {
 throw new UnsupportedOperationException("We only support frames with imageChannels = 3 (BGR)");
 } else if (!(buffer instanceof ByteBuffer)) {
 throw new UnsupportedOperationException("We only support bytebuffers at the moment");
 } else {
 ByteBuffer bb = (ByteBuffer)buffer;
 ByteBuffer b = (ByteBuffer)this.frame.image[0];

 for(int i = y; i < y + h; ++i) {
 for(int j = x; j < x + w; ++j) {
 int base = 3 * j;
 bb.put(b.get(fss * i + base));
 bb.put(b.get(fss * i + base + 1));
 bb.put(b.get(fss * i + base + 2));
 bb.put((byte)-1);
 }
 }

 }
 }
</t></t>


Now, everything up until this point is fine. The memory usage is at around 130mb but alas, when execution enters in these 2 for loops that's where the downright stupid memory usage occurs. Every single one of these bb.put calls is netting me around 3 more megabytes of memory usage. By the end of it you can probably guess what happens. Also all of these memory allocations do happen on the stack so I'm assuming that's why my memory usage stops at around 8-8.5 gigabytes otherwise the program would crash (that has also happened, out of memory exception thrown, but it doesn't usually happen, it kind of just lingers at those 8 gigabytes.) Frankly speaking I'm at a bit of a loss. I haven't seen virtually anyone anywhere mention this ever and I ran out of things to try to fix this so I am making this post.


By the way another thing I tried is make the ExecutorService in the same class as the main method and when I submitted there I also didn't have these memory problems.


-
Discord slash command music bot stops playing unexpectedly
29 juillet 2023, par ShelbyThis is a bot I am using to play music and it worked just fine for a while until it didn't. Simply loaded the bot and played for about a minute and quits. From what I see it destroys the entire queue of songs, no matter how many are there. And after that it won't respond to any command and it needs to be reloaded. I don't get any error in the terminal and all the other commands seem to work just fine. Also, this happens to whatever query I use, whether it's 'search', 'url' or 'playlist'.


const { SlashCommandBuilder } = require("@discordjs/builders")
const { EmbedBuilder } = require("discord.js")
const { QueryType } = require("discord-player")

module.exports = {
 data: new SlashCommandBuilder()
 .setName("play")
 .setDescription("Asculta muzica")
 .addSubcommand((subcommand)=>
 subcommand
 .setName("song")
 .setDescription("Incarca o singura melodie printr-un url")
 .addStringOption((option) => option.setName("url").setDescription("url-ul melodiei").setRequired(true)))
 .addSubcommand((subcommand) =>
 subcommand
 .setName("playlist")
 .setDescription("Incarca un playlist printr-un url")
 .addStringOption((option) => option.setName("url").setDescription("url-ul playlist-ului").setRequired(true)))
 .addSubcommand((subcommand) =>
 subcommand
 .setName("search")
 .setDescription("Cauta o melodie pe baza cuvintelor-cheie")
 .addStringOption((option) => 
 option.setName("cautare").setDescription("cauta dupa titlu si autor").setRequired(true))),
 
 run: async ({ client, interaction }) => {
 if (!interaction.member.voice.channel)
 return interaction.editReply("Trebuie sa fii pe un voice channel pentru a folosi aceasta comanda!")

 const queue = await client.player.createQueue(interaction.guild)
 if (!queue.connection) await queue.connect(interaction.member.voice.channel)

 let embed = new EmbedBuilder()

 if (interaction.options.getSubcommand() === "song"){
 let url = interaction.options.getString("url")
 const result = await client.player.search(url, {
 requestedBy: interaction.user,
 searchEngine: QueryType.YOUTUBE_VIDEO
 })

 if (result.tracks.length === 0)
 return interaction.editReply("Niciun rezultat")

 const song = result.tracks[0]
 await queue.addTrack(song)
 embed
 .setColor(0xF07459)
 .setDescription(`**[${song.title}](${song.url})** a fost adaugata`)
 .setThumbnail(song.thumbnail)
 .setFooter({ text: `Durata: ${song.duration}`})

 } else if (interaction.options.getSubcommand() === "playlist"){
 let url = interaction.options.getString("url")
 const result = await client.player.search(url, {
 requestedBy: interaction.user,
 searchEngine: QueryType.YOUTUBE_PLAYLIST
 })

 if (result.tracks.length === 0)
 return interaction.editReply("Niciun rezultat")

 const playlist = result.playlist
 await queue.addTracks(result.tracks)
 embed
 .setColor(0xF07459)
 .setDescription(`**${result.tracks.length} melodii din [${playlist.title}](${playlist.url})** au fost adaugate`)

 } else if (interaction.options.getSubcommand() === "search"){
 let url = interaction.options.getString("cautare")
 const result = await client.player.search(url, {
 requestedBy: interaction.user,
 searchEngine: QueryType.AUTO
 })

 if (result.tracks.length === 0)
 return interaction.editReply("Niciun rezultat")

 const song = result.tracks[0]
 await queue.addTrack(song)
 embed
 .setColor(0xF07459)
 .setDescription(`**[${song.title}](${song.url})** a fost adaugata`)
 .setThumbnail(song.thumbnail)
 .setFooter({ text: `Durata: ${song.duration}`})
 }
 if (!queue.playing) await queue.play()
 await interaction.editReply({
 embeds: [embed]
 })
 
 }
}



This is the code for the [play] command. No change was done since it worked perfectly.


After some research I found out that there might be a problem with the ffmpeg or the ytdl. I tried updating or reinstalling them, but the problem still remains. I would like to know if I'll need to rework the bot to find an alternative to these two.