
Recherche avancée
Médias (2)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (93)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
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 ) (...) -
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
Sur d’autres sites (12130)
-
How to fix here "EPIPE" in Node js Socket.io
23 avril, par Mehdi008Receiving this error :


Error: write EPIPE
 at afterWriteDispatched (node:internal/stream_base_commons:161:15)
 at writeGeneric (node:internal/stream_base_commons:152:3)
 at Socket._writeGeneric (node:net:958:11)
 at Socket._write (node:net:970:8)
 at doWrite (node:internal/streams/writable:598:12)
 at clearBuffer (node:internal/streams/writable:783:7)
 at onwrite (node:internal/streams/writable:653:7)
 at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:107:10)
 Emitted 'error' event on Socket instance at:
 at emitErrorNT (node:internal/streams/destroy:169:8)
 at emitErrorCloseNT (node:internal/streams/destroy:128:3)
 at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
 errno: -4047,
 code: 'EPIPE',
 syscall: 'write'
 }



// for this code: const { spawn } = require("child_process");

module.exports = (socket, pool) => {
 
 let stream_req_token = "";
 let rtmps_array = [];

 socket.on("stream_request_token",async(token)=>{

 const stream_reqs = await pool`SELECT * FROM stream_request WHERE token=${token}`;


 if(stream_reqs.length === 0){
 
 socket.emit("token_validation_response",false);
 return;
 }

 const stream_req = stream_reqs[0];

 if(!stream_req.is_valid){

 socket.emit("token_validation_response",false);
 return;
 }

 socket.emit("token_validation_response",true);

 stream_req_token = token;


 })

 socket.on("rtmps_array",async(array)=>{

 try{

 const rtmps = JSON.parse(array);

 const streams_requests = await pool`SELECT id FROM stream_request WHERE token=${stream_req_token}`;
 const stream_req_id = streams_requests[0].id;

 rtmps_array = rtmps;

 rtmps.map(async(rtmp)=>{

 await pool`INSERT INTO stream (platform,url,url_key,stream_request_id) 
 VALUES(${rtmp.platform},${rtmp.url},${rtmp.key},${stream_req_id})`;
 })

 socket.emit("rtmps_array_response",true);

 } catch(err){

 console.log(err);
 socket.emit("rtmps_array_response",false);

 }


 })

 //Start Streaming
 let ffmpegProcess = null;
 let isStreaming = false; // Flag to track streaming state

 socket.on("stream", (chunk) => {
 if (!ffmpegProcess) {
 console.log('Initializing FFmpeg process...');

 // Spawn FFmpeg process
 const resolution = "1280x720"; // Change to "1920x1080" for 1080p

 const ffmpegArgs = [
 "-i", "pipe:0", // Input from stdin
 "-c:v", "libx264", // Video codec
 "-preset", "veryfast", // Low latency encoding
 "-b:v", "4500k", // Target average bitrate (4.5 Mbps)
 "-minrate", "2500k", // Minimum bitrate
 "-maxrate", "6000k", // Maximum bitrate
 "-bufsize", "16000k", // Buffer size (twice the max bitrate)
 "-r", "30", // **FORCE 30 FPS**
 "-g", "60", // Keyframe interval (every 2 seconds)
 "-tune", "zerolatency", // Low latency tuning
 "-sc_threshold", "0", // Constant bitrate enforcement
 "-flags", "+global_header",
 
 // **Resolution Fix**
 "-s", resolution, // **Set resolution to 720p or 1080p**
 "-aspect", "16:9", // **Maintain aspect ratio**
 
 // **Frame Rate Fix**
 "-vsync", "cfr", // **Forces Constant Frame Rate (CFR)**
 "-fps_mode", "cfr", // **Prevents FFmpeg from auto-adjusting FPS**
 
 // Audio settings
 "-c:a", "aac",
 "-b:a", "128k", // Audio bitrate
 "-ar", "44100", // Audio sample rate
 "-ac", "2", // Stereo audio
 
 "-f", "flv" // Output format
 ];
 
 // Map the streams to multiple RTMP destinations
 rtmps_array.forEach((rtmp) => {
 ffmpegArgs.push("-map", "0:v:0", "-map", "0:a:0", "-f", "flv", `${rtmp.url}/${rtmp.key}`);
 });
 
 // Spawn FFmpeg process
 ffmpegProcess = spawn("ffmpeg", ffmpegArgs);

 ffmpegProcess.stderr.on('data', (data) => {
 console.log(`FFmpeg STDERR: ${data}`);
 });

 ffmpegProcess.on('close', (code) => {
 console.log(`FFmpeg process closed with code ${code}`);
 ffmpegProcess = null; // Reset process
 isStreaming = false; // Reset streaming state
 });

 ffmpegProcess.on('error', (err) => {
 console.error(`FFmpeg process error: ${err.message}`);
 ffmpegProcess = null; // Reset process
 isStreaming = false; // Reset streaming state
 });

 console.log('FFmpeg process started.');
 isStreaming = true; // Set streaming state to true
 }

 // Write chunk to FFmpeg process
 if (isStreaming && ffmpegProcess && ffmpegProcess.stdin && !ffmpegProcess.stdin.destroyed) {
 try {
 ffmpegProcess.stdin.write(chunk); // Write chunk to stdin
 console.log('Chunk written to FFmpeg.');
 } catch (err) {
 console.error('Error writing chunk to FFmpeg stdin:', err.message);
 }
 } else {
 console.error('FFmpeg process or stdin is not ready.');
 }
});

socket.on("stop-stream", async() => {
 console.log('Stream Stopped.');

 if(stream_req_token.length !== 0){

 await pool`UPDATE stream_request 
 SET is_valid=false
 WHERE token=${stream_req_token}`

 await pool`DELETE FROM current_streams WHERE id=${stream_req_token}`; 
 }

 if (ffmpegProcess) {
 isStreaming = false; // Set streaming state to false

 try {
 // Check if stdin is open before closing
 if (ffmpegProcess.stdin) {
 ffmpegProcess.stdin.end(); // End stdin safely
 }

 // Wait for FFmpeg to close before setting to null
 ffmpegProcess.on("close", () => {
 console.log("FFmpeg process closed.");
 ffmpegProcess = null;
 });

 // Kill FFmpeg process
 ffmpegProcess.kill("SIGTERM"); // Use SIGTERM for graceful exit

 } catch (err) {
 console.error("Error while stopping FFmpeg:", err.message);
 }
 } else {
 console.log("No active FFmpeg process.");
 }
});


socket.on('error', (err) => {
 console.error('Socket error:', err);
});

socket.on("disconnect", async() => {
 console.log('Client Disconnected.');

 if(stream_req_token.length !== 0){

 await pool`UPDATE stream_request 
 SET is_valid=false
 WHERE token=${stream_req_token}`;

 await pool`DELETE FROM current_streams WHERE id=${stream_req_token}`; 

 }
 
 if (ffmpegProcess) {
 isStreaming = false; // Set streaming state to false

 try {
 // Check if stdin is open before closing
 if (ffmpegProcess.stdin) {
 ffmpegProcess.stdin.end(); // End stdin safely
 }

 // Wait for FFmpeg to close before setting to null
 ffmpegProcess.on("close", () => {
 console.log("FFmpeg process closed.");
 ffmpegProcess = null;
 });

 // Kill FFmpeg process
 ffmpegProcess.kill("SIGTERM"); // Use SIGTERM for graceful exit


 } catch (err) {
 console.error("Error while stopping FFmpeg:", err.message);
 }
 } else {
 console.log("No active FFmpeg process.");
 }
});

};





-
stream_encoder.c : Fix compiler warning
13 décembre 2015, par Erik de Castro Lopo -
Taking submissions for encoder comparison
8 mai 2010, par Dark Shikari — UncategorizedWith VP8 supposedly going to come out in about 2 weeks, it’s time to get a rough idea as to the visual state of the art in terms of encoders. Accordingly, I’m doing a small visual codec comparison in which we will take a few dozen encoders, encode a single test clip, and perform score-based visual tests on real humans using a blind test. There will be no PSNR or SSIM results posted.
See the doom9 thread for more information and feel free to submit streams for your own encoders. I’m particularly interested in some newer proprietary encoders for which I wouldn’t be able to get the software for due to NDAs or similar (such as VP8, Sony Blu-code, etc) — but for which I would be able to get a dump of the decoded output.