
Recherche avancée
Autres articles (63)
-
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 (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Configuration spécifique d’Apache
4 février 2011, parModules spécifiques
Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
Création d’un (...)
Sur d’autres sites (5562)
-
Nginx, ffmpeg HTTPS to RTMP
18 juin 2020, par TomI have a web server that's root page is a continuous changing image from a camera. This I can view across the web in a browser without issue.



What I really want to do however is a Nginx with the RTMP extension to take the HTTP and convert to a RTMP stream. Which I think is something like this...



worker_processes auto;
rtmp_auto_push on;
events {}
rtmp {
 server {
 listen 1935;
 listen [::]:1935 ipv6only=on;

 application live {
 live on;
 record off;
 exec_pull /usr/bin/ffmpeg -f image2 - loop -i https://<domain> -f flv rtmp://localhost/show/stream;
 }
 }
}
</domain>



However that doesn't work, it doesn't do anything, no error, no result. If I point VLC at the expected stream I get not a sausage.



If anyone has any ideas on what is wrong I would be very grateful.



Tom


-
Electron and NodeJS : Execute shell command asyncronously with live stream
28 septembre 2020, par Bruno FreireElectron : get file conversion percent in real-time :


I wanna run the command
ffmpeg -i video.mp4
(example) to convert a video into another format. But I want to get the conversion percent that is streamed in the process output and get it in my Electron App or NodeJS.

I've tried all methods :
spawn
fork
exec
and all of them return me the last line of the process output. I want a LIVE Stream of each line that is been written, to show the percent progress.

I've tried :


Fork


const {fork} = require('child_process')
 const forked = fork('ffmpeg -i video.mp4');
 forked.on('message', (msg) => {
 console.log(msg);
})



Exec Alternative 1


const execFile = require('child_process').execFile;
 execFile('ffmpeg -i video.mp4', [], (e, stdout, stderr) => {
 if (e instanceof Error){
 console.error(e);
 
 }
 console.log('stdout ', stdout)
 console.log('stderr ', stderr);
})



Exec Alternative 2


const exec = require('child_process').exec;
 exec('ffmpeg -i video.mp4', (error, stdout, stderr) => { 
 console.log(stdout); 
});

/*EXEC Alternative 2*/
const exec = require('child_process').exec;
const proccessing = exec('ffmpeg -i video.mp4');
proccessing.stdout.on('data', function(data) {
 console.log(data); 
});
proccessing.stdout.pipe(process.stdout);



Spawn


const spawn = require('child_process').spawn,
const processing = spawn('ffmpeg -i video.mp4');

processing .stdout.on('data', function (data) {
 console.log('stdout: ' + data.toString());
});

processing .stderr.on('data', function (data) {
 console.log('stderr: ' + data.toString());
});

processing .on('exit', function (code) {
 console.log('code ' + code.toString());
});



SUMMARY :


럎
-
How can I spawn many ffmpeg processes that takes screenshots of stream every X seconds without killing my CPU ?
2 novembre 2020, par kinxI'm spawning hundreds of ffmpeg processes that takes RTSP streams and outputs images every X seconds. I can handle up to 300 processes of this with child_process.fork and child_process.spawn.


const imageStream = (streamUrl, streamId) => {
 return new Promise((resolve, reject) => {
 let initialBuffer = true;
 let retries = 0;
 let maxRetries = 10;
 const setOptions = (streamUrl, streamId) => {
 return [
 "-rtsp_transport",
 "tcp",
 "-i",
 streamUrl,
 "-update",
 1,
 "-r",
 "1/5",
 "-f",
 "image2",
 "-progress",
 "pipe:1",
 `./public/posters/${streamId}.jpg`,
 "-y",
 ];
 };
 const initStream = (streamUrl, streamId) => {
 const command = spawn("ffmpeg", setOptions(streamUrl, streamId), {
 detached: true,
 });
 command.setMaxListeners(0);
 command.on("exit", (code, signal) => {
 if (code === 1 && initialBuffer) {
 if (retries === maxRetries) {
 command.kill("SIGINT");
 }
 retries++;
 initStream(streamUrl, streamId);
 }
 });
 command.stdout.on("data", (chunk) => {
 if (initialBuffer) {
 initialBuffer = false;
 resolve(true);
 }
 exited = true;
 command.kill("SIGINT");
 });
 process.on("SIGINT", () => {
 command.kill("SIGINT");
 command.removeAllListeners();
 process.exit();
 });
 process.on("exit", () => {
 command.kill("SIGINT");
 command.removeAllListeners();
 });
 };
 initStream(streamUrl, streamId);
 });



I'm using
progress
buffer to listen for data to tell my app that ffmpeg has connected and to start manipulating that data.

The issue is that this is just too much for me and I need to handle more. I don't really need to stream these as live video, I just need to take image captures every X seconds.


However, it seems like there's a limited amount of child_proocesses I can use, and when I do spawn more ffmpeg processes, my Ryzen 9 CPU goes up to 100% and it freezes until I can kill the terminal.


What's the best way to do this ?