
Recherche avancée
Autres articles (24)
-
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras. -
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 (6925)
-
How do ffmpeg child processes differ on windows and linux ? ytdl
6 mai 2023, par eaglehunttThis class method works on linux but does not work on windows. Why is that ? ytdl is a node module called ytdl-core. This is almost line for line what they used in their documentation.


https://github.com/fent/node-ytdl-core/blob/master/example/ffmpeg.js


The biggest difference in my code vs theirs is that I convert the mkv file to an mp4 before closing the process.


I have been looking around the internet and I cannot seem to find anyone with this issue. I am new to child processes and ffmpeg.


static mp4 = async (url, videoQuality, destination) => {
 try {
 const videoInfo = this.#getVideoInfo(url);
 const videoTitle = (await videoInfo).title;

 const tracker = {
 start: Date.now(),
 audio: { downloaded: 0, total: Infinity },
 video: { downloaded: 0, total: Infinity },
 merged: { frame: 0, speed: '0x', fps: 0 },
 };
 
 // Get audio and video streams
 const audio = ytdl(url, { quality: 'highestaudio' })
 .on('progress', (_, downloaded, total) => {
 tracker.audio = { downloaded, total };
 });
 
 
 const video = ytdl(url, { quality: videoQuality })
 .on('progress', (_, downloaded, total) => {
 tracker.video = { downloaded, total };
 })
 .on('error', (error) => {
 console.error('(mp4) An error occurred when attempting to pipe the video stream:', error);
 });

 // Start the ffmpeg child process
 const mkvProcess = 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
 `${__dirname}/temp/temp.mkv`,
 ], {
 windowsHide: true,
 stdio: [
 /* Standard: stdin, stdout, stderr */
 'inherit', 'inherit', 'inherit',
 /* Custom: pipe:3, pipe:4, pipe:5 */
 'pipe', 'pipe', 'pipe',
 ],
 });
 mkvProcess.on('close', () => {
 const titleQuality = this.nativeMp4VideoQualityFormats[videoQuality];
 const mp4Process = cp.spawn(ffmpeg, ['-i',`${__dirname}/temp/temp.mkv`,'-c','copy',`${destination}`]);
 
 mp4Process.on('close', () => {
 if (fs.existsSync(`${__dirname}/temp/temp.mkv`)){
 try {
 fs.unlinkSync(`${__dirname}/temp/temp.mkv`);
 }
 catch (error){
 console.log(error)
 }
 };
 })
 mp4Process.on('exit', (code, signal) => {
 if (code !== 0) {
 console.error(`(mp4) The ffmpeg process exited with code ${code} and signal ${signal}.`);
 }
 })
 });
 mkvProcess.on('exit', (code, signal) => {
 if (code !== 0) {
 console.error(`(mkv) The ffmpeg process exited with code ${code} and signal ${signal}.`);
 }
 });
 // Link streams
 // FFmpeg creates the transformer streams and we just have to insert / read data
 mkvProcess.stdio[3].on('data', chunk => {
 
 const lines = chunk.toString().trim().split('\n');
 const args = {};
 for (const l of lines) {
 const [key, value] = l.split('=');
 args[key.trim()] = value.trim();
 }
 tracker.merged = args;
 });
 audio.pipe(mkvProcess.stdio[4]);
 video.pipe(mkvProcess.stdio[5]);
 return true;

 }
 catch {
 console.error('(mp4) An error occurred when attempting to download the video.')
 return false;
 }
 }



-
nodejs ffmpeg child-process stdio stream stops
10 mars 2023, par BleedFeedI've been trying to make an internet radio stream using ffmpeg to encode the audio data in mp3


function getAudioStream(url){

 return new Promise(async(resolve,reject)=>{

 const ytdlStream = await ytdl(url,{filter:'audioonly',quality:'highestaudio'});

 const ffmpegProcess = spawn('ffmpeg',[
 '-i','pipe:3',
 '-f','mp3',
 '-ar','44100',
 '-ac','2',
 '-b:a','128k',
 '-codec:a','libmp3lame',
 '-flush_packets', '1',
 'pipe:4'],{stdio:['ignore','ignore','pipe','pipe','pipe']});
 ytdlStream.pipe(ffmpegProcess.stdio[3]);
 ffmpegProcess.stderr.on('data',(chunk)=>{
 console.log('FFMPEG ERROR: ' + chunk.toString());
 })
 resolve(ffmpegProcess.stdio[4].pipe(new PassThrough({highWaterMark:4096})));
 });
}

async function setUpStream(fromQueue,client,shout){

 let readable;
 let videoDetails;

 if(fromQueue){
 readable = await getAudioStream(queue[0]);
 videoDetails = (await ytdl.getBasicInfo(queue[0])).videoDetails;
 queue.shift();
 }
 else{
 let song = songs[Math.floor(Math.random() * songs.length)];
 readable = await getAudioStream(song);
 videoDetails = (await ytdl.getBasicInfo(song)).videoDetails;
 }


 readable.on('data',async (chunk)=>{
 readable.pause();
 shout.send(chunk,chunk.length);
 await new Promise((resolve)=>{setTimeout(resolve,shout.delay())});
 readable.resume();
 });

 readable.on('end',()=>{
 readable.destroy();
 setUpStream(queue.length !==0,client,shout);
 });


 readable.on('error',(err)=>{
 console.log(err);
 });

}



shout.send is from npm nodeshout library and it delivers the audio data to icecast server.
I get another ffmpeg audio stream once the current one ends. After 20 or 30 minutes ffmpeg logs stop and no further data comes from ffmpegStream


FFMPEG ERROR: size= 2952kB time=00:03:08.89 bitrate= 128.0kbits/s speed=1.07x
FFMPEG ERROR: size= 3016kB time=00:03:13.00 bitrate= 128.0kbits/s speed=1.07x
FFMPEG ERROR: size= 3080kB time=00:03:17.10 bitrate= 128.0kbits/s speed=1.07x
FFMPEG ERROR: size= 3144kB time=00:03:21.17 bitrate= 128.0kbits/s speed=1.07x
FFMPEG ERROR: size= 3208kB time=00:03:25.27 bitrate= 128.0kbits/s speed=1.07x 



these are the last lines printed at console. Maybe some sort of memory management problem with child process ? How can i find what causes this problem ?


-
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