Recherche avancée

Médias (10)

Mot : - Tags -/wav

Autres articles (8)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

  • Qualité du média après traitement

    21 juin 2013, par

    Le bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
    Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...)

Sur d’autres sites (3997)

  • Youtube Readable stream, merge then trim using ffmpeg and ytdl-core

    13 avril 2023, par sol

    I am using FFmpeg-static in my express server to merge audio and video coming from Youtube Readable Stream then Trim. seems ok and working but im getting an error

    


    


    ffmpeg video input stream error : Error : write EPIPE

    


    ffmpeg audio input stream error : Error : write EPIPE

    


    


    then the triiming process has a glitch like freeze on the first second of the video output here is my code

    


    res.setHeader("Content-Disposition", attachment;  filename="${encodeURIComponent(info.videoDetails.title)}.mp4");

  let ffmpegArgs = [
      '-y', // Overwrite output file without asking
      '-i', 'pipe:3', // Read video stream from pipe 3
      '-i', 'pipe:4',
      '-map', '0:v',
      '-map', '1:a',
      '-c:v', 'copy',
      '-preset', 'ultrafast',
      '-b:v', '5000k',
      '-maxrate', '5000k',
      '-bufsize', '10000k',
      '-c:a', 'libmp3lame',
      '-crf', '18',
      '-preset', 'veryfast',
      '-movflags', 'frag_keyframe+empty_moov',
      '-f', 'mp4',
      '-loglevel', 'error'
  ];

  if (startTime && endTime) {
      ffmpegArgs = ffmpegArgs.concat(['-ss', startTime, '-to', endTime]); // Duration of the trimmed video
  }

  ffmpegArgs.push('-');

  let video = ytdl(url, { filter: 'videoonly', format: selectedFormat , highWaterMark: 1 << 25 })
  let audio = ytdl(url, { filter: 'audioonly', quality: 'highestaudio', highWaterMark: 1 << 25  });
  const ffmpegProcess = cp.spawn(ffmpeg, ffmpegArgs, {
      stdio: ['pipe', 'pipe', 'pipe', 'pipe', 'pipe'],
  });

  video.pipe(ffmpegProcess.stdio[3]); // Video stream to stdin (fd 3)
  audio.pipe(ffmpegProcess.stdio[4]);
      // Output the resulting merged and trimmed video to a file
      ffmpegProcess.stdio[1].pipe(res);

      // Handle the close event of the ffmpeg process
      ffmpegProcess.on('close', (code) => {
          if (code !== 0) {
            console.error(`ffmpeg process exited with code ${code}`);
          } else {
            console.log('ffmpeg process completed successfully');
            downloadedVideos.push({
              title: info.videoDetails.title,
              url: url,
              format: format
            });
          }
        });


    


    


    to the trim process i tried to move the -ss and -to to different lines but the freeze issue is still there

    


    i did try to add and error handling event but the output error is still the same error : write EPIPE

    


    


    
  // Pipe the video and audio streams to the ffmpeg process
          video.on('error', (err) => {
            console.error(`video stream error: ${err}`);
           });
            
          audio.on('error', (err) => {
            console.error(`audio stream error: ${err}`);
          });
            
          ffmpegProcess.stdio[3].on('error', (err)=> {
            console.error(`ffmpeg video input stream error: ${err} `);
          });
            
          ffmpegProcess.stdio[4].on('error', (err) => {
            console.error(`ffmpeg audio input stream error: ${err} `);
          });


    


  • ffmpeg-static Trimming a merging audio and viddeo having a freeza at the first second

    13 avril 2023, par sol

    I am using FFmpeg-static in my express server to merge audio and video coming from Youtube Readable Stream then Trim. seems ok and working but im getting an error

    


    ffmpeg video input stream error : Error : write EPIPE
ffmpeg audio input stream error : Error : write EPIPE

    


    then the triiming process has a glitch like freeze on the first second of the video output

    


    here is my code

    


    res.setHeader("Content-Disposition", attachment;  filename="${encodeURIComponent(info.videoDetails.title)}.mp4") ;

    


      let ffmpegArgs = [
      '-y', // Overwrite output file without asking
      '-i', 'pipe:3', // Read video stream from pipe 3
      '-i', 'pipe:4',
      '-map', '0:v',
      '-map', '1:a',
      '-c:v', 'copy',
      '-preset', 'ultrafast',
      '-b:v', '5000k',
      '-maxrate', '5000k',
      '-bufsize', '10000k',
      '-c:a', 'libmp3lame',
      '-crf', '18',
      '-preset', 'veryfast',
      '-movflags', 'frag_keyframe+empty_moov',
      '-f', 'mp4',
      '-loglevel', 'error'
  ];

  if (startTime && endTime) {
      ffmpegArgs = ffmpegArgs.concat(['-ss', startTime, '-to', endTime]); // Duration of the trimmed video
  }

  ffmpegArgs.push('-');

  let video = ytdl(url, { filter: 'videoonly', format: selectedFormat , highWaterMark: 1 << 25 })
  let audio = ytdl(url, { filter: 'audioonly', quality: 'highestaudio', highWaterMark: 1 << 25  });
  const ffmpegProcess = cp.spawn(ffmpeg, ffmpegArgs, {
      stdio: ['pipe', 'pipe', 'pipe', 'pipe', 'pipe'],
  });

  video.pipe(ffmpegProcess.stdio[3]); // Video stream to stdin (fd 3)
  audio.pipe(ffmpegProcess.stdio[4]);
      // Output the resulting merged and trimmed video to a file
      ffmpegProcess.stdio[1].pipe(res);

      // Handle the close event of the ffmpeg process
      ffmpegProcess.on('close', (code) => {
          if (code !== 0) {
            console.error(`ffmpeg process exited with code ${code}`);
          } else {
            console.log('ffmpeg process completed successfully');
            downloadedVideos.push({
              title: info.videoDetails.title,
              url: url,
              format: format
            });
          }
        });


    


    to the trim process i tried to move the -ss and -to to different lines but the freeze issue is still there

    


    i did try to add and error handling event but the output error is still the same error : write EPIPE

    


      // Pipe the video and audio streams to the ffmpeg process
          video.on('error', (err) => {
            console.error(`video stream error: ${err}`);
           });
            
          audio.on('error', (err) => {
            console.error(`audio stream error: ${err}`);
          });
            
          ffmpegProcess.stdio[3].on('error', (err)=> {
            console.error(`ffmpeg video input stream error: ${err} `);
          });
            
          ffmpegProcess.stdio[4].on('error', (err) => {
            console.error(`ffmpeg audio input stream error: ${err} `);
          });


    


  • Failed to convert web-saved .wemb audio to .wav by using php "shell_exec" and javascript

    30 mai 2022, par Anirbasgnaw

    I'm working on an online experimenter which could record participants' audio from the browser. The audio data I get has an extension of .wemb, so I plan to use ffmpeg to convert it to .wav while I save the data.

    


    I tried to use PHP's shell_exec but nothing happens when I run the scripts. Then I found that my echo and print_r also did not work. I'm new to PHP and javascript, so I''m really confused now.

    


    Below are the relevant codes, I really appreciate it if you could help !

    


    write_data.php :

    


    <?php
  $post_data = json_decode(file_get_contents('php://input'), true); 
  // the directory "data" must be writable by the server
  $name = "../".$post_data['filename'];
  $data = $post_data['filedata'];
   // write the file to disk
  file_put_contents($name, $data);
  
  $INPUT = trim($name) . ".webm";
  $OUTPUT = trim($name) . ".wav";
  echo "start converting...";

  // check if ffmprg is available
  $ffmpeg = trim(shell_exec('which ffmpeg'));
  print_r($ffmpeg);
  // call ffmpeg
  shell_exec("ffmpeg -i '$INPUT' -ac 1 -f wav '$OUTPUT' 2>&1 ");
?>


    


    javascript :

    


      saveData: function(fileName,format){
    // save  as json by default
    if (!format){ format = 'json';}
    // add extension to filename
    fileName = `${fileName}.${format}`
    // create saveData object using fetch
    let saveData = [];
    if (format == 'json') {
        saveData = {
          type: 'call-function',
          async: true,
          func: async function(done) {
            let data = jsPsych.data.get().json();
            const response = await fetch("../write_data.php", {
              method: "POST",
              headers: {
                "content-type": "application/json"
              },
              body: JSON.stringify({ filename: fileName, filedata: data })
            });
            if (response.ok) {
              const responseBody = await response.text();
              done(responseBody);
            }
          }
        }
    } else {
        saveData = {
          type: 'call-function',
          async: true,
          func: async function(done) {
            let data = jsPsych.data.get().csv();
            const response = await fetch("../write_data.php", {
              method: "POST",
              headers: {
                "content-type": "application/json"
              },
              body: JSON.stringify({ filename: fileName, filedata: data })
            });
            if (response.ok) {
              const responseBody = await response.text();
              done(responseBody);
            }
          }
        }
    }
    return saveData;
  },