
Recherche avancée
Autres articles (102)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...) -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.
Sur d’autres sites (9220)
-
Ffmpeg freezes while decoding
22 mars 2017, par J.ClarkeFFmpeg freezes while decoding a small mp3 file. Thecrash happens conistantly after proscessing about 8 or 9 data buffers. I have no clue as to what is happening.
await e.Channel.SendMessage("Playing");
var server = e.Server;
var voiceChannel = client.FindServers(server.Name).FirstOrDefault().VoiceChannels.FirstOrDefault();
var _vClient = await client.GetService<audioservice>()
.Join(voiceChannel);
var pathOrUrl = "a.mp3";
var process = Process.Start(new ProcessStartInfo
{ // FFmpeg requires us to spawn a process and hook into its stdout, so we will create a Process
FileName = "ffmpeg",
Arguments = $"-i {pathOrUrl} " + // Here we provide a list of arguments to feed into FFmpeg. -i means the location of the file/URL it will read from
"-f s16le -ar 48000 -ac 1 pipe:1", // Next, we tell it to output 16-bit 48000Hz PCM, over 2 channels, to stdout.
UseShellExecute = false,
RedirectStandardOutput = true // Capture the stdout of the process
});
Thread.Sleep(2000); // Sleep for a few seconds to FFmpeg can start processing data.
int blockSize = 3840; // The size of bytes to read per frame; 1920 for mono
byte[] buffer = new byte[blockSize];
int byteCount;
while (true) // Loop forever, so data will always be read
{
byteCount = process.StandardOutput.BaseStream // Access the underlying MemoryStream from the stdout of FFmpeg
.Read(buffer, 0, blockSize); // Read stdout into the buffer
if (byteCount == 0) { // FFmpeg did not output anything
Console.WriteLine("Finished");
break;
}// Break out of the while(true) loop, since there was nothing to read.
_vClient.Send(buffer, 0, byteCount); // Send our data to Discord
}
_vClient.Wait();
</audioservice> -
Windows(WASAPI):Converting IEEE float PCM to PCM 16bit
10 octobre 2017, par Michael IVI do a hook into some of WASAPI methods to read out audio buffer that contains system sound.
The source is WAV with audio
format = WAVE_FORMAT_IEEE_FLOAT
andsubformat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
I am trying to convert it to PCM 16bit on the fly using FFMPEG libswresample. The resulting soundtrack has alot of forground noise with the original track’s data playing in the background.
Here is how I do it (I skip WASAPI init part) :
First,the source WAVEFORMATEX struct has the following properties :
Format tag:65534
Sample rate:44100
Num channels:2
CB size:22
Average bytes per sec:352800
Block align:8
Bits per sample:32Where 65534 stands for WAVE_FORMAT_IEEE_FLOAT.
WAVEFORMATEX *w;//filled with the props above
int samples = 0;
int bufferSize = 0;
int buffer_frames = 0;
int bWritten = 0;
char* bufferIn = NULL;
char* bufferOut = NULL;
BYTE* wavBuffer = NULL;
void InitSWRContext()
{
swrctx = swr_alloc_set_opts(NULL,
AV_CH_LAYOUT_STEREO, //stereo layout
AV_SAMPLE_FMT_S16, // sample out format
44100, // out sample rate
2, //number of channels
AV_SAMPLE_FMT_FLT, //sample in format
w->nSamplesPerSec ,//in sample rate
0,
NULL);
swr_init(swrctx);
//also tried like this:
/*
swrctx = swr_alloc();
av_opt_set_int(swrctx, "in_channel_layout", CA2SWR_chlayout(w->nChannels), 0);
av_opt_set_int(swrctx, "out_channel_layout", AV_CH_LAYOUT_STEREO, 0);
av_opt_set_int(swrctx, "in_sample_rate", 44100, 0);
av_opt_set_int(swrctx, "out_sample_rate", 44100, 0);
av_opt_set_sample_fmt(swrctx, "in_sample_fmt", AV_SAMPLE_FMT_FLT, 0);
av_opt_set_sample_fmt(swrctx, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
*/
samples = (int)av_rescale_rnd(CA_MAX_SAMPLES, 44100, w->nSamplesPerSec,
AV_ROUND_UP);
bufferSize = av_samples_get_buffer_size(NULL,2, samples * 2,AV_SAMPLE_FMT_S16, 1/*no-alignment*/);
bufferOut = ( char *)malloc(bufferSize ))
}These two methods are invoked by the system and I hook them to access audio buffer :
DEXPORT HRESULT __stdcall
_GetBuffer(
IAudioRenderClient *thiz,
UINT32 NumFramesRequested,
BYTE **ppData)
{
HRESULT hr;
hr = orig_GetBuffer(thiz, NumFramesRequested, ppData);
bufferIn = (char*)*ppData;
buffer_frames = NumFramesRequested;
return S_OK;
}Then on buffer release I perform the conversion and readout.
DEXPORT HRESULT __stdcall
_ReleaseBuffer(IAudioRenderClient *thiz,
UINT32 NumFramesWritten, DWORD dwFlags)
{
const unsigned char *srcplanes[2];
unsigned char *dstplanes[2];
int samples;
srcplanes[0] = (unsigned char*)bufferIn;
srcplanes[1] = NULL;
dstplanes[0] = (unsigned char*)bufferOut;
dstplanes[1] = NULL;
samples = (int)av_rescale_rnd(NumFramesWritten, 44100, 44100, AV_ROUND_UP);
int samplesConverted = swr_convert(swrctx, dstplanes, samples , srcplanes, NumFramesWritten);
int framesize = (/*PCM16*/16 / 8) * pwfx->nChannels * NumFramesWritten;
if (!wavBuffer)
{
wavBuffer = (BYTE*)malloc(4096 * 1000); //write out a few seconds
}
//copy converted buffer into wavBuffer
memcpy(wavBuffer + bWritten, bufferOut, framesize);
bWritten += framesize;
if (bWritten > 4096 * 1000)
{
pwfx->wFormatTag = WAVE_FORMAT_PCM;
pwfx->wBitsPerSample = 16;
pwfx->nBlockAlign = (pwfx->nChannels * pwfx->wBitsPerSample) / 8;
pwfx->cbSize = 0;
SaveWaveData(wavBuffer, bWritten, pwfx, L"test.wav");
exit(0);
}
}SaveWaveData
borrowed from here.Resulting sound file(WAV)
Original file : a2002011001-e02.wav
I tried to play and analyze the output in VLC,Audacity, and FMOD Studio.
The strange thing is that VLC show (codec info) that it is PCM16, while FMOD studio interprets the data as PCM32. I also tried to store without conversion the original buffer which also produces a sound with noise,though not as significant as when converting to PCM16 -
MPEG DASH (MPD) to MP4 in Node.js ?
28 janvier 2024, par Hello WorldI am trying to convert streams to .mp4 files. I have successfully converted an HLS to MP4 using
fluent-ffmpeg
package on version 2.1.2. I did so with with the following code :

var ffmpegCommand = ffmpeg();
 ffmpegCommand
 .input(HLS FILE HERE)
 .inputOptions('-protocol_whitelist file,http,https,tcp,tls,crypto,data')
 .on("error", (err, stdout, stderr) => {
 console.log(err)
 let error = new Error(err.message)
 error.code = err.code || 'FILE_CONVERSION_M3U8_TO_MP3/UNKNOWN_ERROR';
 error.status = err.status || 500;

 console.log('An error occurred: ' + err.message, err, stderr);
 reject(error)
 })
 .on("end", () => {
 console.log(temporaryFilePath2)
 resolve(temporaryFilePath2);
 })
 .on('progress', function(progress) {
 console.log('progress: ' + (progress.percent || 0).toFixed(2) + '%。');
 progressGathering.push((progress.percent || 0).toFixed(2))

 if(progressGathering.length == 10 && progressGathering[9] == 0.00){
 let error = new Error("File is a live stream.")
 error.code = 'FILE_CONVERSION_M3U8_TO_MP3/LIVESTREAM_SUPPORT'
 error.status = 501

 ffmpegCommand.kill()
 reject(error)
 }
 })
 .inputOptions('-allowed_extensions ALL')
 .outputOptions("-c copy")
 .output(temporaryFilePath2)
 .run();

 setTimeout(() => {
 ffmpegCommand.kill();
 let error = new Error("The file selected was too large or the network was hanging. Conversion timeout.")
 error.code = 'FILE_CONVERSION_M3U8_TO_MP3/TIMEOUT'
 error.status = 599;
 reject(error)
 }, 300000) // 5 minutes



However, when I attempt something similar with a mpd file url in the input, I get several errors that are all the same :


ffmpeg exited with code 1: https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd: Invalid data found when processing input


Is this something fluent-ffmpeg can't handle ? If so, I would like to know another package that can accomplish this.