
Recherche avancée
Autres articles (65)
-
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
-
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...) -
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)
Sur d’autres sites (11877)
-
child process spawn output file and directory in NodeJs
5 juin 2021, par ZeeshanI am using ffmpeg with child process to merge audio and video, but when i am trying to download the file, it is downloading in the same folder, but i want it to download it in the public folder.


following is my code for the child process spawn.


// Start the ffmpeg child process
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
 'title.mp4',
], {
 windowsHide: true,
 stdio: [
 /* Standard: stdin, stdout, stderr */
 'inherit', 'inherit', 'inherit',
 /* Custom: pipe:3, pipe:4, pipe:5 */
 'pipe', 'pipe', 'pipe',
 ],
});



-
Kill child process only after readFile() Node js Electron
14 mai 2021, par RadespyI'm using an imported
ffmpeg
binaryffmpeg-static-electron
in an Electron-React app (on Windows Pro 10) and want to delete a saved cropped video and then kill the child process afterwards from myMain process
.

The overall aim is to crop a video of the whole screen following capture and then send the cropped video to a renderer.


const fsPromises = require('fs').promises
const ffmpeg = require('ffmpeg-static-electron')
const { execFile } = require("child_process")


ipcMain.on("windoze_capture_screen:video_buffer", async (event, buffer) => {
 const temp_directory = await fsPromises.mkdtemp(await fsPromises.realpath(os.tmpdir()) + path.sep)
 const capture_screen_video_path = path.join(temp_directory, "screen_capture_video.mp4")

 child_object = execFile(`${ffmpeg.path}`, 

 ['-i', `${capture_screen_video_path}`, '-vf', `crop=${width}:${height}:${x_pos}:${y_pos}`, `${path.join(temp_directory,'cropped_video.mp4')}`])
 
 child_object.on("exit", async () => {

 // child_object.kill()
 console.log("?Killed -1", child_object.killed)
 
 try { 
 databasePayload.video_buffer = await fsPromises.readFile(path.join(temp_directory, "cropped_video.mp4"), {encoding: 'base64'})
 mainWindow.webContents.send("main_process:video_buffer", databasePayload.video_buffer)
 } catch (error) {
 console.log(error)
 } finally {

 // child_object.kill()
 console.log("?Killed - 2", child_object.killed)
 
 // noASAR required to be set to 'true' in order to remove temp directory in build
 process.noAsar = true 
 fs.rmdir(temp_directory, {recursive: true}, (error) => {if (error) {log(error)}})
 process.noASAR = false
 }

 // 3rd scenario
 // child_object.kill()
 console.log("?Killed -3", child_object.killed) 
 })

 // 4th scenario
 console.log("?Killed-4", child_object.killed) 
 })




When running each of these scenarios, I get the following outputs.


Scenario's 1, 2 and 3 - Successfully sends cropped video to renderer but doesn't kill process.


Output :


?Killed-4 false
?Killed -1 false
[ffmpeg version 3.0.1 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.0 (GCC).... etc. ]
?Killed-2 false
?Killed -3 false



Scenario 4 - Doesn't crop video


?Killed-4 true
?Killed -1 true
Command failed: C:\Users\XXX\Desktop\windows-electron-forge\node_modules\ffmpeg-static-electron\bin\win\x64\ffmpeg.exe -i C:\Users\XXX\AppData\Local\Temp\4WgnUw\screen_capture_video.mp4 -vf crop=796:763:462:509 C:\Users\XXX\AppData\Local\Temp\4WgnUw\cropped_video.mp4

[Error: ENOENT: no such file or directory, open 'C:\Users\XXX\AppData\Local\Temp\4WgnUw\cropped_video.mp4'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\XXX\\AppData\\Local\\Temp\\4WgnUw\\cropped_video.mp4'
}
?Killed - 2 true
?Killed -3 true



The last scenario has been tried out of desperation.


Question : Where am I going wrong with this ? I suspect it's something to do with ipc between child and parent process but not sure where to place the code.


Any help will be much appreciated !!!


-
Use both stdio and stout in the same child process
31 janvier 2021, par mr noobI am using ffmpeg to combine the audio/video 2 streams and pipe them to express. Here is my code :


var ffmpeg = cp.spawn('ffmpeg', [
 // Set inputs
 '-i', 'pipe:4',
 '-i', 'pipe:5',
 // Map audio & video from streams
 '-map', '0:v',
 '-map', '1:a',
 // Keep encoding
 '-c', 'copy',
 '-movflags', 'frag_keyframe+empty_moov',
 '-f', 'mp4',
 // Define output file
 'pipe:1',
 ], {
 stdio: [
 /* Standard: stdin, stdout, stderr */
 'inherit', 'inherit', 'inherit',
 /* Custom: pipe:3, pipe:4, pipe:5 */
 'pipe', 'pipe', 'pipe',
 ],
 });
 video.pipe(ffmpeg.stdio[4]);
 audio.pipe(ffmpeg.stdio[5]);
 res.header('Content-Disposition', 'attachment; filename="video.mp4"');
 ffmpeg.stdout.pipe(res);



But the code gives an error saying that
ffmpeg.stout
is null. After a bit of research, I found out that you can't have the stdio options array, or else stout will be null. Any way to fix this ?