
Recherche avancée
Médias (91)
-
DJ Z-trip - Victory Lap : The Obama Mix Pt. 2
15 septembre 2011
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Matmos - Action at a Distance
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
DJ Dolores - Oslodum 2004 (includes (cc) sample of “Oslodum” by Gilberto Gil)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Danger Mouse & Jemini - What U Sittin’ On ? (starring Cee Lo and Tha Alkaholiks)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Cornelius - Wataridori 2
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Rapture - Sister Saviour (Blackstrobe Remix)
15 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (42)
-
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 (6351)
-
mpeg-dash live streaming can't fetch chunks
27 juin 2020, par user1902653I'm trying to create a live stream of mpeg-dash with ffmpeg.


I'm streaming with python the frames to the ffmpeg process.


This is the current command I'm using for creating the mpeg-dash manifest and m4s files :


ffmpeg -re -f rawvideo -pix_fmt bgr24 -video_size 640x360 -i - -vcodec libx264 -preset ultrafast -tune zerolatency -f dash -window_size 10 -use_template 1 -use_timeline 0 -live 1 /srv/http/dash/stream.mpd



I'm using nginx as a server for now and I've created a simple index.html using shaka player, but the problem is I couldn't get it to load and play more then the first chunk. (checked with dev-tools in chrome in the network tab)


This is how I'm using shaka player right now :





 
 <code class="echappe-js"><script src="https://cdnjs.cloudflare.com/ajax/libs/shaka-player/2.1.4/shaka-player.compiled.js"></script>

<script>&#xA; var manifestUri = &#x27;stream.mpd&#x27;;&#xA; function initApp() {&#xA; shaka.polyfill.installAll();&#xA; if (shaka.Player.isBrowserSupported()) {&#xA; initPlayer();&#xA; } else {&#xA; console.error(&#x27;Browser not supported!&#x27;);&#xA; }&#xA; }&#xA; function initPlayer() {&#xA; var video = document.getElementById(&#x27;video&#x27;);&#xA; var player = new shaka.Player(video);&#xA; window.player = player;&#xA; player.addEventListener(&#x27;error&#x27;, onErrorEvent);&#xA; player.load(manifestUri).then(function() {&#xA; console.log(&#x27;The video has now been loaded!&#x27;);&#xA; }).catch(onError);&#xA; }&#xA; function onErrorEvent(event) {&#xA; onError(event.detail);&#xA; }&#xA; function onError(error) {&#xA; console.error(&#x27;Error code&#x27;, error.code, &#x27;object&#x27;, error);&#xA; }&#xA; document.addEventListener(&#x27;DOMContentLoaded&#x27;, initApp);&#xA; </script>

 
 
 
 







For some reason the stream is only playing the first chunk and never requesting for the next chunk. How can I make it load the next chunks ?


When tried using dash.js I couldn't get it to load even the first chunk.


Thanks in advance.


-
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} `);
 });