
Recherche avancée
Médias (1)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
Autres articles (65)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
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 (6522)
-
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 !