
Recherche avancée
Autres articles (99)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
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 (...) -
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 ;
Sur d’autres sites (11664)
-
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.