Recherche avancée

Médias (91)

Autres articles (89)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications 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, par

    Certains 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, par

    Pré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 (10574)

  • nodejs ffmpeg child-process stdio stream stops

    10 mars 2023, par BleedFeed

    I'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 GUPTA

    I 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

    


    enter image description here

    


  • NodeJS SpeechRecorder pipe to child process ffmpeg encoder - dest.on is not a function

    10 décembre 2022, par Matthew Swaringen

    Trying 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();
  }
});