
Recherche avancée
Autres articles (43)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
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 (9076)
-
NodeJS fluent-ffmpeg error : Output stream closed
30 décembre 2020, par Japser36We are running a NodeJS server that does some audio processing. Specifically, we have audio data returned by google's text to speech API, which we have in the form of a Buffer.


In our application, we have to send this audio data through FFMPEG to format it and extract audio duration. We do this by first converting it into a stream, piping it into ffmpeg, and then storing the data in an output buffer :


const toWav = function (input: Buffer): Promise<buffer> {
 return new Promise((res, rej): void => {
 const bufs = [];
 const myReadable = new Readable();
 myReadable._read = (): void => {}; // we already have all data in memory, so no-op this function;
 myReadable.push(input); // stream all data in the buffer to the stream
 myReadable.push(null); // end the stream
 const output = ffmpeg(myReadable)
 .inputFormat('mp3')
 .toFormat('wav')
 .on('start', function (commandLine) {
 console.log('SPAWNED ARG: ' + commandLine);
 })
 .on('error', (err: object): void => {
 console.error('FFMPEG error on wav transform');
 rej(err);
 })
 .on('end', (): void => {
 console.debug('FFMPEG finished wav transform');
 res(Buffer.concat(bufs));
 })
 .pipe();
 output.on('data', (d: object): void => {
 bufs.push(d);
 });
 });
};
</buffer>


This code is one of our functions that does the formatting, that our data gets passed through. Most of the time, this code works fine, but sometimes an error is thrown :


Looking up this error on google, I found an issue on the FFMPEG library we use, that seems to suggest that using an input and output stream just isn't recommended and doesn't work. Rather, one of the two needs to be a file resource.


Some more about this error, it seems to happen consistently when it does happen, but it doesn't happen consistently overall. For me, I got this error every time the code ran, I went and took lunch, and when I came back it was gone.


For us it is important that this error won't pop up randomly in production, so the question is, does anyone have any suggestions on how we can be the most certain this error won't happen ?


For completeness in how this function is being invoked to result in the error in the screenshot, the structure of the code where the error is caught is like so :


await Promise.all(
 myArray.map(async (item, idx) => {
 // ...
 const wavBuffer = await toWav(myBuffer); // toWav is invoked at this level
 })
)
.then(() => {/* ... */})
.catch((e) => {
 // ...
 logger.error('[LOOP CRASH] Error at main promise:', e);
 // ...
});



Any help would be appreciated, thank you ! Please let me know if I can provide more details, though I cannot share a repo or full source code or anything since this is a private repo.


-
Convert video to mp3 audio using ffmpeg
24 mai 2021, par Abdull Rahman AdnanI am developing an app for Android that converts video to mp3 audio using ffmpeg.
Found too many commands to convert.
The problem is that all commands work slowly on long videos.
That is 40 minutes in length.



What I want is commands that converts video to mp3 quickly.


-
Is there a way to use the CPU of a remote machine to convert in ffmpeg ?
15 août 2017, par user15063My site is built in PHP. I have a WWW server, where all the uploads end up for processing, and then they get rsynced to one of the 4 media servers. If there is a slow and steady stream of uploads, the WWW server converts them all reasonably quickly, but if a bunch of people upload something at the same time, they queue up, and it may take several hours for a file to be processed.
The media servers are typically idle, since serving files off SSD drives results in no iowait, so the CPU is just sitting there, and I wanted to utilize it for conversions.
What would be a good (simple) way to do that ?