
Recherche avancée
Autres articles (61)
-
MediaSPIP : Modification des droits de création d’objets et de publication définitive
11 novembre 2010, parPar défaut, MediaSPIP permet de créer 5 types d’objets.
Toujours par défaut les droits de création et de publication définitive de ces objets sont réservés aux administrateurs, mais ils sont bien entendu configurables par les webmestres.
Ces droits sont ainsi bloqués pour plusieurs raisons : parce que le fait d’autoriser à publier doit être la volonté du webmestre pas de l’ensemble de la plateforme et donc ne pas être un choix par défaut ; parce qu’avoir un compte peut servir à autre choses également, (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
Use, discuss, criticize
13 avril 2011, parTalk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
A discussion list is available for all exchanges between users.
Sur d’autres sites (7100)
-
Programmatically terminate ffmpeg child process on Raspberry Pi
16 août 2020, par McGuireV10Is it possible to cleanly terminate ffmpeg when it's running as a child process under Linux (specifically on a Raspberry Pi 4B) ? I have a .NET Core 3.1 application which spawns ffmepg with the following command, which should encode an h.264 stream to an MP4 file :


ffmpeg -framerate 24 -i - -b:v 2500k -c copy video.mp4



After some arbitrary period of time I want to terminate ffmpeg, but everything I try is either ignored or causes ffmpeg to exit immediately — it never writes the MOOV chunk to the end of the MP4 file, which results in a corrupted file that cannot be played. I realize this chunk can take awhile to generate, and I've tried leaving the process alone for up to 60 seconds, which is far longer than h.264 to MP4 encoding requires interactively on the same device. For the record, I know how to create a "fragmented" MP4 which is mostly playable (using the
-movflags
switch and others), but I'm trying to generate a correct MP4.

I've tried sending a Q key with or without various CR+LF combos, which I've seen mentioned in similar questions, but I think that's a Windows-only thing.


I've tried every Unix signal as well as combinations of two signals. I saw somewhere (I think the ffmpeg site itself) that
SIGINT
should be sent twice, but that does nothing. In another SO post, somebody suggested sendingSIGQUIT
which also does nothing. Interestingly, sendingSIGINT
followed bySIGQUIT
is the only combination that actually terminates the process, but it ends immediately with the following output :

Error writing trailer of /media/ramdisk/video.mp4: Immediate exit requested
frame= 236 fps= 29 q=-1.0 Lsize= 28928kB time=00:00:09.79 bitrate=24201.9kbits/s speed= 1.2x
video:29167kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.



I've tried a long delay between the two, nothing happens until the
SIGQUIT
at which point it responds as shown above. Oddly, sometimes it saysreceived signal 3
instead of 2.

There has to be some trick I'm missing.


-
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 ?

-
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 !!!