
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (72)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
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 -
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...)
Sur d’autres sites (8230)
-
"Cannot read property 'url' of undefined" even though it's already defined
28 novembre 2020, par Levi StanczI'm making a Discord music Bot and I'm having trouble with an error saying


TypeError: Cannot read property 'url' of undefined



I tried console logging it and it showed me the
url
, so I don't understand what is the problem with my code.

Here's my code :


//musicBOT
const Discord = require('discord.js');
const client = new Discord.Client();
const ytdl = require('ytdl-core');
const mcPrefix = '.';

const queue = new Map();

client.on('ready', () => console.log('Music bot ready!'));

client.on('message', async message => {
 if(message.author.bot) return;
 if(!message.content.startsWith(mcPrefix)) return;

 const args = message.content.substring(mcPrefix.length).split(" ");
 const serverQueue = queue.get(message.guild.id);

 if(message.content.startsWith(`${mcPrefix}play`)) {

 const voiceChannel = message.member.voice.channel;
 if(!voiceChannel) return message.channel.send("Hang-szobában kell lenned zenelejátszáshoz.");
 const permissions = voiceChannel.permissionsFor(message.client.user);
 if(!permissions.has('CONNECT')) return message.channel.send("Nincs jogosultságom csatlakozni a hangszobához.");
 if(!permissions.has('SPEAK')) return message.channel.send("Nincs jogosultságom megszólalni ebben a hangszobában.");

 const songInfo = await ytdl.getInfo(args[1])
 const song = {
 title: songInfo.title,
 url: songInfo.videoDetails.video_url
 }

 if(!serverQueue) {
 const queueConstruct = {
 textChannel: message.channel,
 voiceChannel: voiceChannel,
 connection: null,
 songs: [],
 volume: 5,
 playing: true
 }
 queue.set(message.guild.id, queueConstruct)

 queueConstruct.songs.push(song)

 try{
 var connection = await voiceChannel.join();
 message.channel.send(`${song.title} lejátszása.`)
 queueConstruct.connection = connection
 play(message.guild, queueConstruct.songs[0])
 }catch(e){
 console.log(`Hiba csatlakozás közben itt: ${e}`);
 queue.delete(message.guild.id)
 return message.channel.send(`Hiba volt a csatlakozás közben itt: ${e}`)
 }
 } else{
 serverQueue.songs.push(song)
 return message.channel.send(`**${song.title}** hozzáadva a lejátszási listához.`)
 }
 return undefined
 

 
 }else if (message.content.startsWith(`${mcPrefix}stop`)) {
 if(!message.member.voice.channel) return message.channel.send("Hang-szobában kell lenned ahhoz, hogy leállítsd a zenét.")
 if(!serverQueue) return message.channel.send("There is nothing playing")
 serverQueue.songs= []
 serverQueue.connection.dispatcher.end()
 message.channel.send("Sikeresen megálltottad a zenét.")
 return undefined
 }else if(message.content.startsWith(`${mcPrefix}skip`)){
 if(!message.member.voice.channel) return message.channel.send("Hang-szobában kell lenned a skip parancshoz.")
 if(!serverQueue) return message.channel.send("There is nothing playing")
 serverQueue.connection.dispatcher.end()
 message.channel.send("Zene továbbléptetve.")
 message.channel.send(`${song.title} játszása.`)
 
 return undefined
 }

 function play(guild, song) {
 const serverQueue = queue.get(guild.id)
 
 if(!serverQueue.songs){
 serverQueue.voiceChannel.leave()
 queue.delete(guild.id)
 return
 }
 
 const dispatcher = serverQueue.connection.play(ytdl(song.url))
 .on('finish', () => {
 serverQueue.songs.shift()
 play(guild, serverQueue.songs[0])
 })
 .on('error', error => {
 console.log(error)
 })
 dispatcher.setVolumeLogarithmic(serverQueue.volume / 5)
 }

})
//musicBOT



and here is the full error :


const dispatcher = serverQueue.connection.play(ytdl(songInfo.url))
 ^
TypeError: Cannot read property 'url' of undefined
 at play (C:\Users\Levi\Desktop\Discord BOT Javascript\bot.js:97:70)
 at StreamDispatcher.<anonymous> (C:\Users\Levi\Desktop\Discord BOT Javascript\bot.js:100:17)
 at StreamDispatcher.emit (node:events:388:22)
 at finish (node:internal/streams/writable:734:10)
 at processTicksAndRejections (node:internal/process/task_queues:80:21)
</anonymous>


I started searching on the internet but found nothing about it, I guess my basic javascript knowledge is just not enough.


-
ffmpeg hangs when muxing longer videos
11 août 2020, par 492357816I am using ffmpeg with Janus WebRTC server for muxing video conference recordings. For video conferences under approximaately 5 minutes duration, existing code works well. If the source files are longer than that the process appears to hang without returning either an error or a completed file.
Any advice/suggestions would be most welcome.


var recordingsPath = exports.recordingsPath;
 var videoRecordingPath = `${recordingsPath}/${filename}-video.mjr`;
 var audioRecordingPath = `${recordingsPath}/${filename}-audio.mjr`;
 var videoOutputPath = `${recordingsPath}/${filename}-output1.mp4`;
 var audioOutputPath = `${recordingsPath}/${filename}-output1.wav`;
 var finalOutputPath = `${recordingsPath}/${filename}-final.mp4`;
 var rawConverterPath = "/opt/janus/bin/janus-pp-rec";
 var audioRecordingByteSize = exports.getFileSizeInBytes(audioRecordingPath);
 var audioIsValid = audioRecordingByteSize > 8;

 if (audioIsValid) {
 //turn audio and video mjr files into .wav and mp4 respectively
 exports.runBashSync([ rawConverterPath, videoRecordingPath, videoOutputPath]);
 exports.runBashSync([ rawConverterPath, audioRecordingPath, audioOutputPath]);
 return exports.mergeMp4AndWav(
 audioOutputPath, videoOutputPath, finalOutputPath
 ).then(function(result) {
 // remove source data for audio & video
 exports.runBashSync([ "rm", audioOutputPath]);
 exports.runBashSync([ "rm", videoOutputPath]);
 exports.runBashSync([ "rm", audioRecordingPath]);
 exports.runBashSync([ "rm", videoRecordingPath]);
 });
 } else {
 // handle cases where audio is not available
 feedback("no audio");
 return new Promise(function(resolve) {
 exports.runBashSync([ rawConverterPath, videoRecordingPath, finalOutputPath], true);
 if (Number.isInteger(audioRecordingByteSize)) {
 exports.runBashSync([ "rm", audioRecordingPath]);
 }
 exports.runBashSync([ "rm", videoRecordingPath]);
 resolve(true);
 });
 }
};

exports.joinMp4s = function(mp4Filenames, outputPath) {
 feedback("joining mp4s");
 if (mp4Filenames.length === 1) {
 feedback("single-stream case");
 exports.runBashSync(["mv", mp4Filenames[0], outputPath]);
 return new Promise(function(resolve) { resolve(true); });
 }
 feedback("multi-stream case");
 var joinCmd = ["ffmpeg"];
 mp4Filenames.forEach(function(filename) {
 joinCmd.push(`-i ${filename}`);
 });
 joinCmd.push("-strict -2");
 var totalHeight = 960;
 var totalWidth = 1280;

 joinCmd.push(`-filter_complex "color=size=${totalWidth}x${totalHeight}:c=Black [base];`);

 // var numStrms = mp4Filenames.length;
 var streamsPattern = exports.setStreamsPattern(mp4Filenames);
 var strmHeight = streamsPattern.height;
 var strmWidth = streamsPattern.width;
 var strmDmns = `${strmWidth}x${strmHeight}`;
 feedback("streamDimensions: " + strmDmns);

 var i;
 for (i = 0; i < mp4Filenames.length; i++) {
 joinCmd.push(`[${i}:v] setpts=PTS-STARTPTS, scale=${strmDmns} [temp${i}];`);
 }
 for (i = 0; i < mp4Filenames.length; i++) {
 var xCoord;
 var yCoord;
 if (i === 0) {
 xCoord = streamsPattern.coords[i].xCoord;
 yCoord = streamsPattern.coords[i].yCoord;
 joinCmd.push(`[base][temp${i}] overlay=shortest=1:x=${xCoord}:y=${yCoord} [tmp${i + 1}];`);
 // joinCmd.push(`[base][temp${i}] overlay=shortest=1 [tmp${i + 1}];`);
 } else {
 var cmd = `[tmp${i}][temp${i}] overlay=shortest=1`;
 xCoord = streamsPattern.coords[i].xCoord;
 yCoord = streamsPattern.coords[i].yCoord;

 if (xCoord) { cmd += ":x=" + xCoord; }
 if (yCoord) { cmd += ":y=" + yCoord; }

 if (i + 1 !== mp4Filenames.length) { cmd += ` [tmp${i + 1}];`; }
 joinCmd.push(cmd);
 }
 }

 joinCmd.push(`" ${outputPath}`);
 feedback("join command: " + joinCmd);
 return exports.runBashAsync(joinCmd).then(function(result) {

 mp4Filenames.forEach(function(filename) {
 feedback("removing: " + filename);
 exports.runBashSync(`rm ${filename}`);
 });
 });
};




-
(Folderwide) Bulk conversion in ffmpeg to a H264 codec
5 mars 2021, par HabbomanSo I was trying to get a hang of ffmpeg but I am not very good at it. I am trying to get all .mkv files converted to .m4v with a H264 codec. From another project I know that the h264_cuvid decoder worked perfectly well for my needs. I also checked via
ffmpeg -decoders
that I wrote it correctly. So the windows-batchfile (I frankenstein-ed together from other forums) looks like this :

for %%a in ("*.mkv") do ffmpeg -i "%%a" -c:v h264_cuvid -preset fast -crf 20 -b:v 128k "newfiles\%%~na.m4v"
pause



What I get is sadly only :




unknown encoder 'h264_cuvid'




How do I solve this ?


If it is easier to start from scratch following is what I am trying to achieve


I am pretty new to this whole conversion/coding thing. I got a raspberry pi as a homeserver for my video files. Sadly it can only direct stream correctly encoded files (H.264), otherwise the Pi is trying to encode the videos itself (what causes buffering). So I am trying to find a solution to throw my whole library into a folder and convert it to a usable format.