
Recherche avancée
Médias (91)
-
999,999
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Demon seed (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
The four of us are dying (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Corona radiata (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Lights in the sky (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
Autres articles (37)
-
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...) -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...) -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)
Sur d’autres sites (5477)
-
Problem with FFmpeg breaking when streaming the entire screen and switching tabs
2 octobre 2024, par Ibad AhmadI'm working on a screen recording and streaming setup where the user records their entire screen and streams it to Twitch. The setup works fine initially, but when I switch tabs during recording, the stream breaks on the backend, and I get the following FFmpeg errors :


FFmpeg STDERR: [matroska,webm @ 0x7f9dcb904580] EBML header parsing failed
[in#0 @ 0x7f9dcb904380] Error opening input: Invalid data found when processing input
Error opening input file -.
Error opening input files: Invalid data found when processing input



My frontend code captures the screen and microphone and streams it via a WebSocket to the backend, where FFmpeg processes the stream. Below is my relevant frontend code :


const startRecording = async () => {
 try {
 const screenStream = await navigator.mediaDevices.getDisplayMedia({
 preferCurrentTab: true,
 systemAudio: 'include',
 surfaceSwitching: 'include',
 monitorTypeSurfaces: 'include',
 video: {
 displaySurface: 'browser',
 height: 720,
 width: 1280,
 frameRate: { ideal: 24, max: 30 },
 },
 });

 screenStream.getVideoTracks()[0].onended = () => {
 console.log('Screen sharing ended. Stopping the recorder.');
 stopRecording();
 };

 const micStream = await navigator.mediaDevices.getUserMedia({
 audio: true,
 });

 const combinedStream = new MediaStream([
 ...screenStream.getVideoTracks(),
 ...micStream.getAudioTracks(),
 ]);

 const recorder = new MediaRecorder(combinedStream, {
 mimeType: 'video/webm; codecs=vp8,opus',
 videoBitsPerSecond: 3 * 1024 * 1024,
 });

 const timeslice = 1000;

 recorder.ondataavailable = async (event) => {
 if (socket?.current?.connected && event.data.size > 0) {
 console.log('Sending chunk data:', socket.current.id);
 socket?.current.send(event.data);
 recordedChunks.current.push(event.data);
 } else if (!socket?.current?.connected) {
 handleSocketDisconnection();
 }
 };

 mediaRecorder.current = recorder;
 recorder.start(timeslice);
 setIsRecording(true);
 } catch (error) {
 console.log('Error starting screen recording:', error);
 toast.error('Failed to start screen recording: ' + error);
 }
};

const stopRecording = () => {
 if (socket?.current && mediaRecorder) {
 mediaRecorder?.current?.stop();
 socket.current.close();
 setIsRecording(false);
 downloadRecordedVideo();
 }
};




And here’s my backend code with FFmpeg settings for Twitch streaming :


const inputSettings = [
 '-f', 'webm', '-i', '-', '-v', 'error', '-analyzeduration', '1000000', '-probesize', '5000000',
];

const twitchSettings = (twitch) => {
 return [
 '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency',
 '-g', '60', '-b:v', '2500k', '-maxrate', '3000k', '-bufsize', '8000k',
 '-r', '30', '-vf', 'tpad=stop_mode=clone:stop_duration=2',
 '-c:a', 'aac', '-ar', '44100', '-b:a', '96k',
 '-use_wallclock_as_timestamps', '1', '-async', '1',
 '-err_detect', 'ignore_err', '-reconnect', '1',
 '-reconnect_streamed', '1', '-reconnect_delay_max', '5',
 '-y', '-f', 'flv', twitch,
 ];
};




Problem : When switching tabs during screen sharing, it seems like the frame rate drops or the stream gets interrupted, leading to FFmpeg errors like
EBML header parsing failed
andInvalid data found when processing input
. I suspect this happens because the browser deprioritizes resources when the tab is not active, which might lead to corrupt chunks being sent to FFmpeg.

Questions :


- 

- Could switching tabs during screen capture be causing the issue by disrupting the frame rate or dropping frames ?
- Is there a way to ensure FFmpeg doesn’t break due to these interruptions ?
- Any suggestions on handling the stream more reliably when switching tabs or optimizing the FFmpeg setup for this scenario ?








I tried adjusting the bitrate, frame rate, and buffer size but still experienced the same issue. I'm trying to figure out if the issue is related to how browsers handle screen capture when tab switching or something specific with FFmpeg handling the video stream.


Any insights would be greatly appreciated.
Thanks in advance !


-
ffmpeg-static Trimming a merging audio and viddeo having a freeza at the first second
13 avril 2023, par solI 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} `);
 });



-
Extract frames from live youtube stream
21 décembre 2022, par irmanI want to extract frames from a youtube live event, say one frame every 5 minutes, ideally without saving the stream to my local machine. Is there a simple way to do this, possibly a combination between
youtube-dl
andffmpeg
that I am not figuring out ? I found a similar question for UDP streams but don't know how to include the youtube stream : FFMPEG : extract a fram from a live stream once every 5 seconds


Thanks a lot in advance !