
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (106)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Ajout d’utilisateurs manuellement par un administrateur
12 avril 2011, parL’administrateur d’un canal peut à tout moment ajouter un ou plusieurs autres utilisateurs depuis l’espace de configuration du site en choisissant le sous-menu "Gestion des utilisateurs".
Sur cette page il est possible de :
1. décider de l’inscription des utilisateurs via deux options : Accepter l’inscription de visiteurs du site public Refuser l’inscription des visiteurs
2. d’ajouter ou modifier/supprimer un utilisateur
Dans le second formulaire présent un administrateur peut ajouter, (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (13218)
-
NodeJS - efficiently and correctly convert from raw PCM to WAV at scale (without FFMPEG ?)
13 juillet 2024, par Royi BernthalI have a stream of raw PCM buffers I need to convert to playable WAV buffers.


@ffmpeg.wasm
can convert an individual buffer in the stream well, but it's limited to executing 1 command at a time, so it won't work in a real-life streaming scenario (streams x concurrent users). We can use it as a reference to a conversion that outputs a good playable wav.

import { FFmpeg, createFFmpeg, fetchFile } from '@ffmpeg.wasm/main';

async pcmToWavFFMPEG(buffer: Buffer) {
 // bitDepth - PCM signed 16-bit little-endian
 const options = { sampleRate: '24k', channels: '1', bitDepth: 's16le' };

 this.ffmpeg.FS('writeFile', 'input.pcm', await fetchFile(buffer));

 await this.ffmpeg.run(
 '-f',
 options.bitDepth,
 '-ar',
 options.sampleRate,
 '-ac',
 options.channels,
 '-i',
 'input.pcm',
 'output.wav',
 );

 const wavBuffer = this.ffmpeg.FS('readFile', 'output.wav');

 this.ffmpeg.FS('unlink', `input.pcm`);
 this.ffmpeg.FS('unlink', `output.wav`);

 return Buffer.from(wavBuffer);
 }



In order to get over the command execution limit, I've tried
fluent-ffmpeg
. I couldn't find a way to convert a single buffer, so I'm just passing the whole readable stream so that ffmpeg can convert all of its buffers to wav. The buffers I'm getting in on('data') aren't playable wav. The same is true for concatting the accumulated buffers in on('complete') - the result is not a playable wav.

import ffmpeg from 'fluent-ffmpeg';
import internal from 'stream';

async pcmToWavFluentFFMPEG(
 readable: internal.Readable,
 callback: (chunk: Buffer) => void,
 ) {
 const options = { sampleRate: 24000, channels: 1, bitDepth: 's16le' };

 ffmpeg(readable)
 .inputFormat(options.bitDepth)
 .audioFrequency(options.sampleRate)
 .audioChannels(options.channels)
 .outputFormat('wav')
 .pipe()
 .on('data', callback);
 }



I've also tried using
node-wav
to convert each buffer individually. It manages to convert everything to playable wavs that sound close to the desired result, however for some reason they're extremely loud and sound a bit weird.

import wav from 'node-wav';

pcmToWavBad(buffer: Buffer) {
 const pcmData = new Int16Array(
 buffer.buffer,
 buffer.byteOffset,
 buffer.byteLength / Int16Array.BYTES_PER_ELEMENT,
 );

 const channelData = [pcmData]; // assuming mono channel

 return wav.encode(channelData, { sampleRate: 24000, bitDepth: 16 });
 }



I've also tried wrapping the PCM as a WAV with
wavefile
without any actual conversion (which is redundant as PCM is contained as is in WAV), but it results in white noise :

import { WaveFile } from 'wavefile';

pcmToWav(buffer: Buffer) {
 const wav = new WaveFile();

 wav.fromScratch(1, 24000, '16', buffer); // 's16le' is invalid

 return Buffer.from(wav.toBuffer());
 }



-
Creating a continuous stream for RTMP in Node.js
9 mars 2023, par hankthetank27I'm working on an app that downloads audio from youtube that will be streamed sequentially, similar to radio broadcast. I'm having trouble getting the individual tracks to stream continuously. My idea was to write the tracks sequentially into a readable stream that then is read by FFMPEG. Here is the code I'm having trouble with...


import ytdl from "ytdl-core";
import ffmpeg from 'fluent-ffmpeg';
import { Readable } from "node:stream"

export async function startAudioStream(): Promise<void>{

 const mainStream = await createStreamedQueue()

 ffmpeg(mainStream)
 .inputOptions([
 '-re'
 ])
 .outputOption([
 // '-c:v libx264',
 // '-preset veryfast',
 // '-tune zerolatency',
 '-c:a aac',
 '-ar 44100',
 ])
 .save('rtmp://localhost/live/main.flv');
};

async function createStreamedQueue(): Promise<readable>{

 function createStream(): Readable{
 const stream = new Readable({
 read(){},
 highWaterMark: 1024 * 512,
 });
 stream._destroy = () => { stream.destroyed = true };
 return stream;
 }

 const mainStream = createStream();

 const ref1 = 'https://youtu.be/lLCEUpIg8rE'
 const ref2 = 'https://youtu.be/bRdyzdXJ0KA';

 function queueSong(src: string, stream: Readable): Promise<void>{
 return new Promise<void>((resolve, reject) => {
 ytdl(src, {
 filter: 'audioonly',
 quality: 'highestaudio'
 })
 .on('data', (data) => {
 stream.push(data);
 })
 .on('end', () => {
 resolve();
 })
 .on('error', (err) => {
 console.error('Error downloading file from YouTube.', err);
 reject(err);
 })
 })
 }
 
 await queueSong(ref1, mainStream);
 // console.log('after firsrt: ', mainStream)
 await queueSong(ref2, mainStream);
 // console.log('after second: ', mainStream)
 return mainStream;
};
</void></void></readable></void>


To start,
startAudioStream
is called to initiate a readable stream of audio to an RTMP server via FFMPEG. That is working fine. The part I'm having trouble with is "queuing" the tracks into the stream that's being fed into FFMPEG. Right now, I have a "main" stream that each songs data is being pushed into, as you can see inqueueSong
. At the end of ytdl stream, the promise is resolved, allowing for the next song to be queued and its data to be pushed intomainStream
. The issue that I'm experiencing is that the audio fromref1
is only every played.

I can see in the logs that
mainStream
does grow in length after each call toqueueSong
, but still will only stream the audio from the first track. My initial thought was that there is a terminating character at the of the last data chunk thats being written to the steam for each song ? But maybe im getting screwed up on how streams work...

-
How do I independently fade in/out multiple (3+) overlay images over video using FFMPEG ?
9 janvier 2019, par blahblahberUsing an arbitrary source video, I would like to INDEPENDENTLY fade in/fade out a minimum of three .png overlays/watermarks at various times throughout the video. I’m having trouble getting the syntax right for the filter chain.
In these failed attempts below, I’m using four transparent .png images all at 1920x1080 using the same sized source input video. No scaling/positioning needed, just the overlays fading in and out at the defined times.
I have the functionality working without fade, unsing ’enable’, like so :
ffmpeg -i vid1.mp4 -loop 1 -i img1.png -i img2.png -i img3.png -i img4.png -filter_complex
"overlay=0:0:enable='between(t,8,11)' [tmp];
[tmp]overlay=0:0:enable='between(t,10,15)'[tmp1];
[tmp1]overlay=0:0:enable='between(t,15,138)'[tmp2];
[tmp2]overlay=0:0:enable='between(t,140,150)"
-c:v libx264 -c:a copy
-flags +global_header -shortest -s 1920x1080 -y out.mp4I just want the same control, using fade in/out.
The following almost works as I’d like but I obviously don’t want the entire output stream to fade out. I realize that adding the fade=out to lines 7, 8 & 9 is fading the combined output (starting at line 7), but this is as close as I’ve come where I see each overlay image actually fading. The defined fades in lines 3, 4 and 5 apparently don’t affect anything, and that’s where I defined them originally. When I copied them to the output stream, the fade works on each overlay image, but again I don’t want it to affect the entire output stream, just the individual overlays.
ffmpeg -i vid1.mp4 -loop 1 -i img1.png -i img2.png -i img3.png -i img4.png -filter_complex
"[1:v]fade=out:st=3:d=1[watermark0];
[2:v]fade=out:st=4:d=1[watermark1];
[3:v]fade=out:st=5:d=1[watermark2];
[4:v]fade=out:st=6:d=1[watermark3];
[0:v][watermark0] overlay=0:0 [tmp0];
[tmp0][watermark1] overlay=0:0,fade=out:st=4:d=1 [tmp1];
[tmp1][watermark2] overlay=0:0,fade=out:st=6:d=1 [tmp2];
[tmp2][watermark3] overlay=0:0,fade=out:st=8:d=1 [out]" -map "[out]" -c:v libx264 -c:a copy
-flags +global_header -shortest -s 1920x1080 -y out.mp4I’ve also tried ’split’ with similar results to the above, but the fade only seems to work on the first image (this one uses fade in as well) :
ffmpeg -i vid.mp4 -loop 1 -i img1.png -i img2.png -i img3.png -i img4.png -filter_complex
"[1:v]split=4[wm1][wm2][wm3][wm4];
[wm1]fade=in:st=1:d=1:alpha=1,fade=out:st=3:d=1:alpha=1[ovr1];
[wm2]fade=in:st=2:d=1:alpha=1,fade=out:st=4:d=1:alpha=1[ovr2];
[wm3]fade=in:st=3:d=1:alpha=1,fade=out:st=5:d=1:alpha=1[ovr3];
[wm4]fade=in:st=4:d=1:alpha=1,fade=out:st=6:d=1:alpha=1[ovr4];
[0:v][ovr1]overlay=0:0[base1];
[base1][ovr2]overlay=0:0[base2];
[base2][ovr3]overlay=0:0[base3];
[base3][ovr4]overlay=0:0[out]" -map "[out]"
-t 10 -c:v libx264 -c:a copy -flags +global_header -shortest -s 1920x1080 -y out.mp4Any help is greatly appreciated ! :)