
Recherche avancée
Autres articles (78)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
Participer à sa traduction
10 avril 2011Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
Actuellement MediaSPIP n’est disponible qu’en français et (...) -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)
Sur d’autres sites (18550)
-
How to send loading data before sending a file in Express Get Request
2 octobre 2023, par TheHangelI have an express Node.js server.


The objective of this server is make a process with ffmpeg and to send the file as result.


I manage to know the percentage of the process. But I don't know how to make the client aware of the percentage before it sends the file.


So here is my server-side code :
(I omitted some part of the ffmpeg process because, this is not very important, the important thing is to send the variable 'percent').


const ffmpeg = require('fluent-ffmpeg');

app.get('/download', (req,res) => {
 const video = new ffmpeg('myaudio.mp3');
 let total;
 video
 .format('mp3')
 .on('codecData', (data) => {
 total = parseInt(data.duration.replace(/:/g, ''));
 })
 .on('progress', (progress) => {
 const time = parseInt(progress.timemark.replace(/:/g, ''));
 const percent = (time / total) * 100;
 console.log(percent); // I want to send 'percent' to the client instead of console.log
 })
 .on('end', () => {
 res.status(200).sendFile(output); // then it sends the file to client
 })
 .save(output);
});



if you have a solution, can you show the client-side example, (axios or fetch) please ?


-
Fluent-ffmpeg Invalid data found when processing input error only when the second request is received
31 décembre 2022, par koji tanakaI am using Node.js for backend to use ffmpeg. To use ffmpeg, I adopted fluent-ffmpeg. This is working perfectly except for one problem. That is when I send video from client side SPA(single page application) to the server-side for the "second" time, node application crashes.


What I did is saving the received video in the backend folder, which is made in the process, and taking a snapshot of the video.
This code actually works everytime after restarting the server, but once I used this route and try another time, the error message "Invalid data found when processing input video
./received/${receivedName}
" comes up.

app.post("/convert", fileUpload({ createParentPath: true }), async function (req, res) {
 makeDir(receivedVideoDirectory);
 const receivedName = Object.keys(req.files)[0];
 const directoryName = receivedName.substring(0, receivedName.indexOf("."));

 const receivedFile = req.files[receivedName];
 transcodedSegFolder = `./public/transcoded/${dirName}`;
 console.log("transcoded segment file folder is here", transcodedSegFolder);
 makeDir(transcodedSegFolder);

 fs.open(`./received/${receivedName}`, 'w', (err, fd) => {
 if (err) throw err;
 fs.writeFile(fd, receivedFile["data"], function (err) {
 if (err) {
 return console.log("Err in write file ", err);
 }
 console.log("The file was saved!", receivedName);
 fs.close(fd, (err) => {
 if (err) throw err;
 });
 });
 });

 ffmpeg(`./received/${receivedName}`)
 .takeScreenshots(
 {
 count: 1,
 timemarks: ['00:00:01.000'],
 folder: './public/thumbnails',
 filename: dirName
 }).on('error', function(err) {
 console.log('screenshot error happened: ' + err.message);
 }).on('end', function(err) {
 console.log('Screenshot process finished: ');
 });



Probably some program keeps working, but I cannot find it. Any help is appreciated. Thank you.


-
Connection randomly closes wihtout data while running a FFMPEG PHP script
23 octobre 2022, par Victor MarinovI'm building a simple back-end solution for a client that allows them to upload any video in mo4 or mov format of up to about 500MB in size to a PHP back-end, which then takes the material, downsizes and compresses the it using the PHP library FFMPEG available here https://github.com/PHP-FFMpeg/PHP-FFMpeg.


While the video is being processed the connection to the front-end stays open, awaiting the compression result.


This may normally take up to 3-5 minutes depending on the size and duration of the video.


Overall it functions as intended, but with some videos I get random resets of the connection while the video is being processed.


I've added numerous error_log() lines in my script which show that the script continues running even after the connection is reset and the actual processing and compression of the video completes correctly and the file is saved in the DB and in storage.


Below is a small excerpt from the code in question :


//THEN COMPRESS VIDEO THUMBNAIL
 $format = new FFMpeg\Format\Video\X264();
 $format->setKiloBitrate(3200);
 error_log("BEFORE COMPRESS! ", 0);

 //PREVENT ANY ECHO's
 ob_start();
 error_log("DURING COMPRESS... ", 0);
 $video->save($format, $export_path);
 error_log("JUST AFTER... ", 0);
 $compress_output = ob_get_clean();

 $resp['video_compression_result'] = 'success';
 error_log("COMPRESS SUCCESS! ", 0);



I would just like to know if any of you would have an idea why the connection might be reset on some files and not on others ? I've even tried wrapping the the $video->save() function in an output buffer to prevent any possible output which might trigger an premature output.


I have increased the PHP settings for max_memory to 2G and upload_max_filze and post_max size to 500M.


max_execution_time and max_input_time are both set to 1200 sec. The random reset usually comes at 1.7 or 5.4 minutes into the request and seem to depend on the file selected.


I've successfully processed smaller files from the same source without issues. The only variable here appears to be the duration and size of the video. What is most puzzling to me is that the remaining code continues to run fine even after the connection is reset.


If you have any clues, please let me know as this is driving me crazy for a second day in a row now and spoiling an otherwise perfectly functional solution for the client !