Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (88)

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 mars 2010, par

    Le 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 inscription3 (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (5938)

  • Read portion of lines from child process in Rust (chunk of data)

    2 octobre 2022, par Alexey Volodko

    When 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 parsing out_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 ?

    


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


    


  • 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