
Recherche avancée
Autres articles (50)
-
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 -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras. -
Possibilité de déploiement en ferme
12 avril 2011, parMediaSPIP peut être installé comme une ferme, avec un seul "noyau" hébergé sur un serveur dédié et utilisé par une multitude de sites différents.
Cela permet, par exemple : de pouvoir partager les frais de mise en œuvre entre plusieurs projets / individus ; de pouvoir déployer rapidement une multitude de sites uniques ; d’éviter d’avoir à mettre l’ensemble des créations dans un fourre-tout numérique comme c’est le cas pour les grandes plate-formes tout public disséminées sur le (...)
Sur d’autres sites (10032)
-
ffplay : added option always on top for video window
13 mai 2019, par Daniel Kucera -
Promise chaining and resolution
23 janvier 2019, par Shourya SharmaI am trying to convert videos one by one with the help of promises. i am using ffmpeg for conversion and multer for uploading multiple files.
multer uploads multiple files at once after which i have to chain the conversions one by one. as of now it just converts the 1st file.
i thought chaining of promises ..like in an array should work but i am confused if i can define new promises in an array as ffmpeg also returns a promise
My router :
const router = require('express').Router();
const multer = require('multer');
const ffmpeg = require('ffmpeg');
let str;
const storage = multer.diskStorage({
destination: (req, file, cb) => {
cb(null, './uploads');
},
filename: (req, file, cb) => {
str = file.originalname.replace(/\.[^/.]+$/, "");
str = str.replace(/[^a-z0-9+]+/gi, '_') + '.' + file.originalname.replace(/^.*\./, '');
cb(null, str);
}
});
const upload = multer({ storage: storage }).array('files', 12);
router.post('/upload', (req, res, next) => {
// req.files is an array of files
// req.body will contain the text fields, if there were any
function uploadFile() {
return new Promise((resolve, reject) => {
upload(req, res, (err) => {
if (err) {
res.send(err) // Pass errors to Express.
reject(`Error: Something went wrong!`);
} else if (req.files == undefined) {
res.send(`No File selected.`);
resolve();
} else if (!err && req.files.length > 0) {
res.status(201).send(`${req.files.length} File(s): ${req.files} uploaded successfully.`);
console.log('uploaded');
resolve();
}
});
});
}
uploadFile().then(() => {
try {
var process = new ffmpeg('./uploads/' + str);
process.then(function (video) {
console.log('The video is ready to be processed');
video.addCommand('-hide_banner', '');
video.addCommand('-y', '');
video.addCommand('-c:a', 'aac');
video.addCommand('-ar', '48000');
video.addCommand('-c:v', 'h264');
video.addCommand('-profile:v', 'main');
video.addCommand('-crf', '20');
video.addCommand('-sc_threshold', '0');
video.addCommand('-g', '50');
video.addCommand('-keyint_min', '50');
video.addCommand('-hls_time', '4');
video.addCommand('-hls_playlist_type', 'vod');
video.addCommand('-vf', 'scale=-2:720');
video.addCommand('-b:v', '1400k');
video.addCommand('-maxrate', '1498k');
video.addCommand('-bufsize', '2100k');
video.addCommand('-b:a', '128k');
video.save('./converted/' + str, function (error, file) {
if (!error)
console.log('Video file: ' + file);
});
}, function (err) {
console.log('Error: ' + err);
});
} catch (e) {
console.log(e.code);
console.log(e.msg);
}
}).catch((err) => {
console.log(Error, err);
});
});
module.exports = router; -
Discord bot not playing any audio
7 mars 2023, par MarkixI'm making a discord music bot with Discord.js v14,
@discordjs/voice
, and Typescript and I have this play command but it doesn't seem to be working. It successfully joins, throws no exceptions but... no audio.

This is my code :


import { CommandInteraction, SlashCommandBuilder } from "discord.js";
import { joinVoiceChannel, createAudioPlayer, getVoiceConnections, StreamType, AudioPlayerStatus } from "@discordjs/voice";
import { createAudioResource } from "@discordjs/voice";
import ytdl from 'ytdl-core';

module.exports = {
 data: new SlashCommandBuilder()
 .setName('play')
 .setDescription('Play příkaz')
 .addStringOption(option => 
 option
 .setName("link")
 .setDescription("Youtube link!")
 .setRequired(false)
 ),

async execute(interaction: CommandInteraction) {
 const link = interaction.options.get('link')?.value?.toString();
 const player = createAudioPlayer();
 const resource = createAudioResource(ytdl(`${link}`, { filter: "audioonly" }), { inlineVolume: 1.0, inputType: StreamType.WebmOpus });

 player.play(resource);

 const connection = joinVoiceChannel({
 channelId: "775815628619251743",
 guildId: "775761665786511370",
 adapterCreator: interaction.guild?.voiceAdapterCreator,
 selfMute?: false,
 selfDeaf: false
 });

 const subscription = connection.subscribe(player);
 interaction.reply("Now playing: .-.");
}



This is
"dependencies"
in my package.json

"dependencies": {
 "@discordjs/builders": "^1.2.0",
 "@discordjs/rest": "^1.5.0",
 "@discordjs/voice": "^0.14.0",
 "@types/express": "^4.17.14",
 "discord.js": "^14.4.0",
 "dotenv": "^16.0.2",
 "express": "^4.18.1",
 "ffmpeg": "^0.0.4",
 "ffmpeg-static": "^5.1.0",
 "libsodium-wrappers": "^0.7.11",
 "opusscript": "^0.0.8",
 "sequelize": "^6.23.2",
 "sqlite3": "^5.1.2",
 "ts-node": "^10.9.1",
 "ytdl-core": "^4.11.2"
 }



(And yes I also have ffmpeg installed globally)


markix@pop-os-lenovo-laptop:~$ apt list --installed | grep -i ffmpeg 

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

chromium-codecs-ffmpeg-extra/jammy,now 1:85.0.4183.83-0ubuntu2 amd64 [installed,upgradable to: 1:85.0.4183.83-0ubuntu2.22.04.1]
ffmpeg/jammy-security,jammy-updates,now 7:4.4.2-0ubuntu0.22.04.1 amd64 [installed,automatic]



What am I doing wrong ?