
Recherche avancée
Autres articles (90)
-
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 ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (10543)
-
FFmpeg child process closed, code null, signal SIGSEGV
22 novembre 2022, par AMRITESH GUPTAI have been working on a project where I am trying to get users' audio and video and stream it to youtube live. I tested my code on my windows machine, and everything is working fine, but when I deploy my server code on Heroku, I get this error
FFmpeg child process closed, code null, signal SIGSEGV
.

I used https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git for Heroku buildpack.


Code snippet :


const inputSettings = ['-i', '-', '-v', 'error'];

const youtubeSettings = () => {
 
 return [
 // video codec config: low latency, adaptive bitrate
 '-c:v',
 'libx264',
 '-preset',
 'veryfast',
 '-tune',
 'zerolatency',
 '-g:v',
 '60',
 
 // audio codec config: sampling frequency (11025, 22050, 44100), bitrate 64 kbits
 '-c:a',
 'aac',
 '-strict',
 '-2',
 '-ar',
 '44100',
 '-b:a',
 '64k',
 
 //force to overwrite
 '-y',
 
 // used for audio sync
 '-use_wallclock_as_timestamps',
 '1',
 '-async',
 '1',
 
 '-f',
 'flv',
 youtubeURL,
 ]
 
}

const ffmpegInput = inputSettings.concat(youtubeSettings());


io.on('connection', (socket) => {
 console.log(`socket connected to ${socket.id}`)
 
 try{

 const ffmpg = child_process.spawn('ffmpeg',ffmpegInput)

 ffmpg.on('close', (code, signal) => {
 console.log(
 'FFmpeg child process closed, code ' + code + ', signal ' + signal
 );
 // ws.terminate()
 })

 ffmpg.stdin.on('error', (e) => {
 console.log('FFmpeg STDIN Error', e)
 })

 // FFmpeg outputs all of its messages to STDERR. Let's log them to the console.
 ffmpg.stderr.on('data', (data) => {
 console.log('FFmpeg STDERR:', data.toString());
 })

 socket.on('message', (msg) => {
 console.log('DATA', msg)
 ffmpg.stdin.write(msg);
 })

 // If the client disconnects, stop FFmpeg.
 socket.conn.on('close', (e) => {
 console.log('kill: SIGINT')
 ffmpg.kill('SIGINT')
 })
}
catch(err){
 console.log(err);
}



Heroku logs




-
NodeJS SpeechRecorder pipe to child process ffmpeg encoder - dest.on is not a function
10 décembre 2022, par Matthew SwaringenTrying to make a utility to help me with recording words for something. Unfortunately getting stuck on the basics.


The error I get when I hit s key and talk enough to fill the buffer is


terminate called after throwing an instance of 'Napi::Error'
 what(): dest.on is not a function
[1] 2298218 IOT instruction (core dumped) node record.js



Code is below. I can write the wav file and then encode that but I'd rather not have to have an intermediate file unless there is no way around it, and I can't imagine that is the case.


const { spawn } = require('child_process');
const { writeFileSync } = require('fs');
const readline = require('readline');
const { SpeechRecorder } = require('speech-recorder');
const { WaveFile } = require('wavefile');

let paused = true;

const ffmpeg = spawn('ffmpeg', [
 // '-f', 's16', // input format
 //'-sample_rate', '16000',
 '-i', '-', // input source
 '-c:a', 'libvorbis', // audio codec 
 'output.ogg', // output file 
 '-y'
]);

let buffer = [];
const recorder = new SpeechRecorder({
 onAudio: ({ audio, speech }) => {
 //if(speech) {

 for (let i = 0; i < audio.length; i++) {
 buffer.push(audio[i]);
 }

 if(buffer.length >= 16000 * 5) { 
 console.log('piping to ffmpeg for output');
 let wav = new WaveFile()
 wav.fromScratch(1,16000,"16",buffer);
 //writeFileSync('output.wav',wav.toBuffer());
 ffmpeg.stdin.pipe(buffer, {end: false});
 }
 //}
 }
});

// listen for keypress events
readline.emitKeypressEvents(process.stdin);
process.stdin.setRawMode(true);

process.stdin.on('keypress', (str, key) => {
 if (key.name === 's') {
 // pause or resume recording
 paused = !paused;
 if(paused) { recorder.stop(); } else { recorder.start(); }

 
 } else if (key.ctrl && key.name === 'c') {
 // exit program
 ffmpeg.kill('SIGINT'); 
 process.exit();
 }
});



-
Read portion of lines from child process in Rust (chunk of data)
2 octobre 2022, par Alexey VolodkoWhen I try to spawn a child ffmpeg process I use additonal flag
-progress
, next I use pipe to pass this progress output to the stderr.
So the whole command looks like :

ffmpeg -i ... -progress pipe:2 ...



Without
-progress
flag ffmepg outputs following line in stderr, probably once per second :

frame=46 46 fps=0.0 q=0.0 size= 0kB time=00:00:01.72 bitrate= 0.2kbits/s speed=2.69x



With
-progress
flag ffmepg outputs (multiple lines) in stderr, probably once per second :

frame=1 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.19 bitrate= 2.0kbits/s speed=2.94x 
fps=0.00
stream_0_0_q=0.0
bitrate= 2.0kbits/s
total_size=48
out_time_us=192000
out_time_ms=192000
out_time=00:00:00.192000
dup_frames=0
drop_frames=0
speed=2.94x
progress=continue



The main puppose of using
-progress
flag is to calc percentage of completion by parsingout_time_ms
line and comparing to the whole duration.

Reading this chunk (portion of lines) is pretty simple in NodeJS :


const { spawn } = require('child_process');
const child = spawn('ffmpeg', [..., '-progress', 'pipe:2', ...]);

child.stderr.on('data', (data) => {
 // data will contain multiple lines, exactly one chunk
});



Reading this chunk (portion of lines) is pretty simple in Deno also :


const child = Deno.spawnChild("ffmpeg", {
 args: [..., '-progress', 'pipe:2', ...],
});
const stderrReader = child.stderr.getReader();
let readResult = await stderrReader.read();
while (readResult.done !== true) {
 readResult = await stderrReader.read();
 // readResult will contain multiple lines, exactly one chunk
}



I can't achieve the same in rust :


let mut command = Command::new("ffmpeg");
command.args(["...", "-progress", "pipe:2", "..."]);
let mut child = command
 .stdout(Stdio::piped())
 .stderr(Stdio::piped())
 .spawn()
 .unwrap();

let child_stderr = child.stderr.as_mut().expect("Unable to pipe stderr");
let mut reader = BufReader::new(child_stderr);
let mut buff = String::new();
while reader.read_line(&mut buff).expect("Unable to read chunk") > 0 {
 // buff will contain only on line
 buff.clear();
}



I am new in Rust. I can not detect what character signals end of chunk.


- 

- Runnig
read_line()
- will read only one line. - Runnig
read_to_end()
- will read the whole output until the end of process (EOF).






How can I read in Rust portion of lines that ffmpeg outputs probably once per second ?
How Node/Deno detects this "end of chunk" ?
Does rust have such event/signal also ?


- Runnig