Recherche avancée
Médias (1)
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (68)
-
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 (...) -
Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur
8 février 2011, parLa visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
Configuration de la boite multimédia
Dès (...) -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.
Sur d’autres sites (9430)
-
ffmpeg waits to close the pipe in order to start processing data
15 juin 2022, par Mahmoud FerigI'm struggling with this issue.
Here I am trying to stream video using ffmpeg from images and audio file this code below works fine but it is start streaming after stdin closed, I would expect ffmpeg to start processing the pipe input as it is received, and immediately output the result.


p = subprocess.Popen(
 [
 'ffmpeg',
 '-y',
 '-re',
 '-f', 'image2pipe',
 '-vcodec', 'mjpeg',
 '-framerate', '15',
 '-analyzeduration', '2147483647',
 '-probesize', '2147483647',
 '-i', '-',
 '-vn', '-i', audio_path,
 '-c:v', 'libx264',
 '-pix_fmt', 'yuv420p',
 '-preset', 'ultrafast',
 '-c:a', 'aac',
 '-f', 'flv',
 rtmp_url
 ],
 stdin=subprocess.PIPE,
 stdout=subprocess.PIPE
)

time.sleep(2)

i = 0
while True:
 current_images = [name for name in os.listdir(img_dir) if os.path.isfile(os.path.join(img_dir, name))]
 current_images = sorted(current_images)
 if i > fnum-1:
 print("frame read failed")
 break
 try:
 img = cv2.imread(os.path.join(img_dir, current_images[i]))
 success, buffer = cv2.imencode('.jpg', img)
 frame = buffer.tobytes()
 p.stdin.write(frame)
 i += 1
 except:
 time.sleep(2)
 pass

p.stdin.close()
p.wait()


Why is ffmpeg waiting to close the pipe to start processing ? Can it be configured to start a live transcoding of the received stream ?


Do you know how can I convince ffmpeg to start producing output immediately ?


Thank you !


-
How can I create a write stream for res for a child_process.spawn method as it says cp.spawn().pipe(res) is not a method
11 juin 2022, par niishaaantconst express = require('express');
const router = express.Router();
const ytdl = require('ytdl-core');
const cp = require('child_process');
const ffmpeg = require('ffmpeg-static');

router.get('/', async (req, res) => {
 const { v, f, q } = req.query;
 if (!ytdl.validateID(v) && !ytdl.validateURL(v)) {
 return res
 .status(400)
 .json({ success: false, error: 'No valid YouTube Id!' });
 }
 try {
 let info = await ytdl.getInfo(v);

 //set format and title
 // const title = info.videoDetails.title;
 // res.setHeader('Content-disposition', contentDisposition(`${title}${f}`));

 //define audio and video stream seperately and download them
 const audio = ytdl(v, { quality: 'highestaudio' }).on(
 'progress',
 (_, downloaded, total) => {
 console.log({ downloaded, total });
 }
 );
 let format = ytdl.chooseFormat(info.formats, { quality: q });
 const video = ytdl(v, { format }).on('progress', (_, downloaded, total) => {
 console.log({ downloaded, total });
 });

 const ffmpegProcess = cp
 .spawn(
 ffmpeg,
 [
 // Remove ffmpeg's console spamming
 '-loglevel',
 '8',
 '-hide_banner',
 // Redirect/Enable progress messages
 '-progress',
 'pipe:3',
 // Set inputs
 '-i',
 'pipe:4',
 '-i',
 'pipe:5',
 // Map audio & video from streams
 '-map',
 '0:a',
 '-map',
 '1:v',
 // Keep encoding
 '-c:v',
 'copy',
 // Define output file
 `out.${f}`,
 ],
 {
 windowsHide: true,
 stdio: [
 /* Standard: stdin, stdout, stderr */
 'inherit',
 'inherit',
 'inherit',
 /* Custom: pipe:3, pipe:4, pipe:5 */
 'pipe',
 'pipe',
 'pipe',
 ],
 }
 )
 .on('close', () => {
 console.log('done');
 });

 // Link streams
 // FFmpeg creates the transformer streams and we just have to insert / read data
 ffmpegProcess.stdio[3].on('data', (chunk) => {
 // Parse the param=value list returned by ffmpeg
 const lines = chunk.toString().trim().split('\n');
 const args = {};
 for (const l of lines) {
 const [key, value] = l.split('=');
 args[key.trim()] = value.trim();
 }
 });
 audio.pipe(ffmpegProcess.stdio[4]);
 video.pipe(ffmpegProcess.stdio[5]);
 } catch (error) {
 res.status(400);
 console.log('error ', error);
 }
});

module.exports = router;




I am trying to create a youtube downloader app and this is the code for downloading a video using the ytdl and ffmpeg packages in an express route but i don't know how i can download the result (out.mp4) for the client. when I try to pipe it to res error occurs saying cp.spawn().pipe() is not a method.




-
Pipe ffmpeg process with node js
20 juin 2022, par MaxWhen I make request to route, spawn process and pipe it directly to response, it works perfectly fine and creates livestream. However, it takes some time to start process and buffer some data to start playing video.


app.get("/stream", async (req, res) => {
 const url = "rtsp://213.3.38.11/axis-media/media.amp";

 const cmd = [
 "-re",
 "-loglevel",
 "debug",
 "-reorder_queue_size",
 "5",
 "-rtsp_transport",
 "tcp",
 "-i",
 `${url}`,
 "-c:v",
 "copy",
 "-c:a",
 "aac",
 "-f",
 "mp4",
 "-movflags",
 "+frag_keyframe+empty_moov+default_base_moof",
 "pipe:1",
 ];

 const child = spawn("ffmpeg", cmd, {
 stdio: ["ignore", "pipe", process.stderr],
 });

 child.stdio[1].pipe(res)l

 res.on("close", () => {
 child.stdio[1].unpipe(res);
 });
});



I would like to create process while starting server so I can pipe it whenever I make request to that route, but when I do so, process is living for a few seconds then stops using cpu. Sometimes it lives, but dies when I make request and try piping it.