
Recherche avancée
Autres articles (36)
-
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
Sur d’autres sites (12891)
-
Streaming audio from FFMPEG to browser via WebSocket and WebAudioApi
17 novembre 2022, par Sebi O.My project has 2 parts :


- 

- a web interface that the user accesses
- and a standalone app installed on the computer, that acts as a websocket server.






From the web UI, the user has to hear his computer's microphone.
At this moment, I have a working solution that listens to microphone and sends the raw PCM audio chunks back to web-UI which is able to play them. But some serious lag gets added in time, despite it all runs on the same computer, so there's no internet latency/etc. That is why I am testing FFMPEG now.


So, here's the FFMPEG command for streaming microphone data :


ffmpeg.exe -re -f dshow -i audio="Microphone (HD Pro Webcam C920)" -ar 44100 -ac 1 -f f32le pipe:1



Data gets sent successfully via websocket, but playing it using WebAudioApi is not working, i mean i don't hear anything.


Can anyone point me to what am I doing wrong ?
Here's the web javascript :


let ipOfAudioServer = 'localhost';

 let wsClient = null;
 
 var audioCtx = null;
 var subcounter = 0;
 var audiobuffer = [];
 var source = null;
 
 // must match the values in the audio-server. Thought despite audio-server could send 2channels.. we resume to only one, to save bandwidth
 var sampleRate = 44100; 
 var channels = 1;
 
 var microphone = 'Microphone (HD Pro Webcam C920)';
 
 
 // this method reads current position from the audiobuffer and plays the audio
 // the method will re-call itself, in order to play the next item in queue
 this.play = function(soundName) {

 var ffs = audiobuffer[subcounter];
 
 if (ffs) {
 var frameCount = ffs.byteLength;
 console.log(frameCount, audiobuffer.length);
 
 var myAudioBuffer = audioCtx.createBuffer(channels, frameCount, sampleRate); 
 myAudioBuffer.getChannelData(0).set(ffs)
 
 if (myAudioBuffer != null)
 { 
 subcounter += 1;
 
 source = audioCtx.createBufferSource();
 source.buffer = myAudioBuffer;
 source.connect(audioCtx.destination);
 source.onended = () => { console.log("finished, continuing to seek buffer!"); play(soundName); }
 source.start();
 } 
 }
 // just in case the counter got to be bigger than the actual amount of items in the list, set it back to last one
 if (subcounter > audiobuffer.length)
 subcounter = audiobuffer.length;
 };
 
 
 // the method to initialize WS client
 this.initWebsocketClient = function ()
 {
 if (wsClient == null)
 {
 wsClient = new WebSocket(`ws://${ipOfAudioServer}:23233`, "protocol");
 wsClient.binaryType = "arraybuffer";
 
 wsClient.onmessage = function (event) 
 {
 if (typeof event.data === 'object') {
 
 console.log(event.data, event.data.size);
 
 // clear memory in case buffer is already too big
 if (subcounter > 50) {
 console.log('cleared memory');
 audiobuffer = [];
 subcounter = 0;
 }
 
 
 audiobuffer.push(event.data);
 if (audiobuffer.length == 1) {
 play('sinewave');
 }
 
 }
 else {
 if (event.data == 'stopMicrophone=ok') {
 wsClient.close();
 wsClient = null;
 
 audiobuffer = [];
 subcounter = 0;
 }
 
 console.log(event.data);
 }
 }
 }
 };

 // method used in send() which will actually send the message only after connection has been established successfully.
 this.waitForConnection = function (callback, interval) {
 if (wsClient.readyState === 1) {
 callback();
 } else {
 var that = this;
 // optional: implement backoff for interval here
 setTimeout(function () {
 that.waitForConnection(callback, interval);
 }, interval);
 }
 };
 
 // using this method to send WS messages to the audio-server
 this.send = function (message, callback) 
 {
 this.initWebsocketClient();
 
 this.waitForConnection(function () {
 wsClient.send(message);
 if (typeof callback !== 'undefined') {
 callback();
 }
 }, 1000);
 };
 
 // called by clicking the start button
 function startCapture() {
 if (audioCtx == null)
 audioCtx = new (window.AudioContext || window.webkitAudioContext)();
 
 audiobuffer = [];
 subcounter = 0;
 
 this.send(`startMicrophone?device=${microphone}`);
 }

 // called by clicking the stop button
 function stopCapture() {
 this.send('stopMicrophone');
 } 



-
Getting error "WebAssembly.Memory() : could not allocate memory" when running ffmpeg.wasm on android chrome browser
27 juin 2022, par Ravi KunduError in detail :


WebAssembly.Memory(): could not allocate memory
at https://*******/ffmpeg-core.js:22:82
at https://*******/ffmpeg.min.js:1:6506
at f (https://*******/ffmpeg.min.js:1:11322)
at Generator._invoke (https://*******/ffmpeg.min.js:1:11110)
at Generator.next (https://*******/ffmpeg.min.js:1:11747)
at i (https://*******/ffmpeg.min.js:1:4295)
at c (https://*******/ffmpeg.min.js:1:4498)



Code for ffmpeg :


const downloadWithFFMPEG = async () =>{
 const sourceBuffer = await fetch(recordingURL).then(r => r.arrayBuffer());
 await ffmpeg.load();
 await ffmpeg.FS(
 "writeFile",
 "input.webm",
 new Uint8Array(sourceBuffer, 0, sourceBuffer.byteLength)
 );
 await ffmpeg.run("-i", "input.webm", "-c", "copy", "output.mp4")
 const output = ffmpeg.FS("readFile", "output.mp4");
 var link = document.createElement('a')
 link.href = URL.createObjectURL(new Blob([output.buffer], { type: 'video/mp4;codecs=H264' }));
 link.download = this.data;
 link.click();
 recording = false;
}



Brief about problem :
The error only comes for android chrome browser. The same code works fine on pc/laptop chrome.
Have also enabled Webassembly-thread on chrome ://flags for android browser as someone suggested me to do it but still same error. Can someone help me ?


-
How to use ffmpeg on hardware acceleration with multiple inputs ?
20 mars 2019, par ColeI’m trying to speed up the rendering of a video by using the GPU instead of the CPU. This code works, but I don’t know if I’m doing it correctly.
ffmpeg -hwaccel cuvid -c:v hevc_cuvid \
-i video.mp4 \
-i logo.png \
-i text.mov \
-c:v h264_nvenc \
-filter_complex " \
[0]scale_npp=1920:1080,hwdownload,format=nv12[bg0]; \
[bg0]trim=0.00:59.460,setpts=PTS-STARTPTS[bg0]; \
[1]scale=150:-1[logo1];[bg0][logo1]overlay=(W-w)-10:(H-h)-10[bg0]; \
[2]scale=500:-1[logo2];[logo2]setpts=PTS-STARTPTS[logo2]; \
[bg0][logo2]overlay=-150:-100[bg0]; \
[bg0]fade=in:00:30,fade=out:1750:30[bg0]" \
-map "[bg0]" -preset fast -y output.mp4I feel like I need to be using hwuplaod somewhere in there, but I’m not totally sure. Any help would be appreciated.
Log from run :
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
configuration: --enable-gpl --enable-libx264 --enable-cuda --enable-nvenc --enable-cuvid --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
[hevc @ 0x3eb04c0] vps_num_hrd_parameters -1 is invalid
[hevc @ 0x3eb04c0] VPS 0 does not exist
[hevc @ 0x3eb04c0] SPS 0 does not exist.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.7.100
Duration: 00:00:59.46, start: 0.000000, bitrate: 5894 kb/s
Stream #0:0(und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 5891 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 29.97 tbc (default)
Metadata:
handler_name : VideoHandler
Input #1, png_pipe, from 'logo.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba(pc), 528x128 [SAR 11339:11339 DAR 33:8], 25 tbr, 25 tbn, 25 tbc
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'text.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.56.100
Duration: 00:00:06.00, start: 0.000000, bitrate: 1276 kb/s
Stream #2:0(eng): Video: qtrle (rle / 0x20656C72), bgra, 1920x1080, 1274 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
Metadata:
handler_name : DataHandler
Stream mapping:
Stream #0:0 (hevc_cuvid) -> scale_npp
Stream #1:0 (png) -> scale
Stream #2:0 (qtrle) -> scale
fade -> Stream #0:0 (h264_nvenc)
Press [q] to stop, [?] for help
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.12.100
Stream #0:0: Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:
encoder : Lavc58.18.100 h264_nvenc
Side data:
cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: -1
frame= 1783 fps=151 q=30.0 Lsize= 15985kB time=00:00:59.45 bitrate=2202.4kbits/s dup=4 drop=0 speed=5.04x
video:15977kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.050389%Not sure what to make of this, pretty new to ffmpeg.