
Recherche avancée
Médias (1)
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (6)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
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 (3643)
-
How do I exit or kill a running OS process (FFMPEG) started with Node.js without crashing my app ?
18 novembre 2022, par Alula LeakemariamI am developing an express application that starts FFMPEG through nodejs's child_process. The process starts, but when I try deleting specific processes by pid, the whole app crashes and has to be restarted.


I start the stream with this :


const { spawn, exec } = require("child_process");
const execFile = require("child_process").execFile;

function startStream(foo, url, bar) {
 const ls = spawn(`mkdir`, [`$foo`], {
 cwd: `path/to/working/dir`,
 stdio: "inherit",
 });

 const child = execFile(
 "ffmpeg",
 ["-i", url, "-hls_flags", "delete_segments", "-c", "copy", `path/to/file.m3u8`],
 { maxBuffer: Infinity },
 (error, stdout, stderr) => {
 if (error) {
 console.error("stderr: =============================", stderr);
 throw error;
 }
 console.log("stdout: ==========================", stdout);
 }
 );

 const checkProcesses = exec(`ps`, (error, stdout, stderr) => {
 if (error) {
 console.error("stderr: =============================", stderr);
 throw error;
 }
 console.log("stdout: ==========================", stdout);
 });

 return child.pid;
}

module.exports = startStream;



The code below is the results of running the ps command to list the running processes, which lists ffmpeg as one of them. This will also show ffmpeg again for each time I run the function above.


6394 pts/3 00:00:00 bash
 110129 pts/3 00:00:28 npm run start
 110140 pts/3 00:00:00 sh
 110141 pts/3 00:00:38 node
 136730 pts/3 00:00:00 node
 137148 pts/3 00:00:00 ffmpeg
 137358 pts/3 00:00:00 sh
 137359 pts/3 00:00:00 ps




This will also start copying the FFMPEG files to the directory as expected. Afterwards, another endpoint will use the function below to delete the files created and (attempt to) kill the process :


const { spawn, exec } = require("child_process");
const kill = require("tree-kill");

async function endStream(foo, bar, pid) {
 kill(pid, "SIGKILL");

 // Also tried this commented out code below with spawn and exec
 // const killProcessByPid = spawn("kill", ["-9", `${pid}`]);
 
 const ls = exec(`rm -rf ${foo}`, {
 cwd: `./path/to/working/dir`,
 });
}
module.exports = endStream;




I've tried a few variations but the result I get is usually along the lines of this :


Exiting normally, received signal 15.

 at ChildProcess.exithandler (node:child_process:402:12)
 at ChildProcess.emit (node:events:513:28)
 at maybeClose (node:internal/child_process:1100:16)
 at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5) {
 code: 255,
 killed: false,
 signal: null,
 cmd: 'ffmpeg -i <url>.m3u8 -hls_flags delete_segments -c copy path/to/file.m3u8'
}
[nodemon] app crashed - waiting for file changes before starting..

</url>


I only started using exec/execFile/spawn after failing with libraries like fluent-ffmpeg and a few others, though it doesn't look like starting the process causes the same issues that exiting them do.


If there's anything else I can optimize while my code is up, i'd love to hear it. I'm not even sure if this code will have success with many ffmpeg processes running concurrently.


I am running this on linux (ubuntu) right now and eventually plan to deploy the server.


-
avformat_write_header() changes my stream's time_base
12 avril 2023, par grekenI have a high framerate camera which can capture >2000 fps. My plan was to assign actual capture timestamps with µs resolution to the frames and encode with H.264 in a matroska file.


So I set the
time_base
of both theAVStream
and theAVCodecContext
to{1, 1'000'000}
. But after callingavformat_write_header(avFormatContext, nullptr)
I notice that the stream'stime_base
is{1, 1'000}
. Now, since my framerate is double this resolution, I get identical consecutive timestamps and half my frames get lost when I extract them from the video file.

Does anyone have an idea why this is happening and what I can do about it ? Preferably in a way that preserves the correct timestamps.


-
How can I stream then play YUV format with/without VLC/FFMPEG ?
13 janvier 2023, par orfruitI'm able to play a local YUV file through VLC (as expected)


.\vlc.exe --demux rawvideo --rawvid-fps 25 --rawvid-width 480 --rawvid-height 360 --rawvid-chroma I420 out.yuv



Also FFPLAY is playing well


.\ffplay.exe -f rawvideo -pixel_format yuv420p -video_size 480x360 out.yuv



Conversion to YUV was done with FFMPEG


.\ffmpeg.exe -i "video.mp4" -c:v rawvideo -pixel_format yuv420p out.yuv



However, I'm not able o stream it and play'it over local network.
I know, it sounds crazy :) but I plan to use VLC as a monitor/debugger for some YUV data.


The original MP4 file is streamed/played fine with VLC (test on the same computer)


.\vlc.exe "video.mp4" --sout="#std{access=http, mux=ts, dst=:55555/}"
.\vlc.exe http://192.168.0.174:55555/



So the big question !
How can I stream the YUV format and VLC recognise an play it as well ?


All that I tried with VLC is not playable.


Thanks for any hints !