
Advanced search
Medias (1)
-
Video d’abeille en portrait
14 May 2011, by
Updated: February 2012
Language: français
Type: Video
Other articles (104)
-
Soumettre améliorations et plugins supplémentaires
10 April 2011Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...) -
Emballe médias : à quoi cela sert?
4 February 2011, byCe 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"; -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 March 2010, byLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3); le plugin champs extras v2 nécessité par (...)
On other websites (10828)
-
Kill child process only after readFile() Node js Electron
14 May 2021, by 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 !!!


-
FFMPEG not saving logs when converting to audio format
2 February, by PUXIIIThe command does not save or even create a file:


ffmpeg -i "video.mp4" -f mp3 "audio.mp3" -vstats_file "log_file.log"



And if you convert to a video file, everything normally creates and writes:


ffmpeg -i "video.mp4" -f mp3 "video.avi" -vstats_file "log_file.log"



Goal: to pull out the time from the log file and bind it to the process bar.


There are no problems with video, everything works. But with the sound does not work.


I tried the command:


ffmpeg -i "video.mp4" -f mp3 "video.avi" >2 "log_file.txt"



But there are other problems popping out. Since I run it all from the Python using the
subprocess
module.

ffmpegProc = subprocess.Popen(ffmpegCommand, startupinfo=startupinfo, shell=True)



, I can not kill the running process, because it is started with the attribute
shell=True
, and only the shell is killed.

-
How to do make a loading screen for ffmpeg using c# asp.net
1 September 2011, by anthonypliuI have this function and where the Debug.WriteLine commands are is where I output the values. How would I get this data to print into a webpage so I can mimic a loading screen? I am calling this function externally through a *.ashx web service file.
private string ConvertToFLV(string phyicalFilePath)
{
if (Path.GetExtension(phyicalFilePath).Equals(".flv")) return phyicalFilePath;
var argument = string.Format(@"-i ""{0}"" -vcodec flv -f flv -r 29.97 -s 320x240 -aspect 4:3 -b 300k -g 160 -cmp dct -subcmp dct -mbd 2 -flags +aic+cbp+mv0+mv4 -trellis 1 -ac 1 -ar 22050 -ab 56k ""{1}""", phyicalFilePath, Path.ChangeExtension(phyicalFilePath, "flv"));
libfaac -ar 48000 -ab 128k -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0 {1}", phyicalFilePath, Path.ChangeExtension(phyicalFilePath, "mp4"));
File.Delete(Path.ChangeExtension(phyicalFilePath, "flv"));
ProcessStartInfo process = new ProcessStartInfo(ffmpegPhysicalPath, argument);
Process proc = new Process();
float duration = 0.00F, current = 0.00F;
proc.StartInfo = process;
proc.EnableRaisingEvents = false;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.Start();
StreamReader d = proc.StandardError;
do
{
string s = d.ReadLine();
if (s.Contains("Duration: "))
{
Debug.WriteLine("DURATION: " + s);
}
else
{
if (s.Contains("frame="))
{
Debug.WriteLine("FRAME: " + s);
}
}
} while (!d.EndOfStream);
proc.WaitForExit();
return Path.ChangeExtension(phyicalFilePath, "flv");