Recherche avancée

Médias (91)

Autres articles (102)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP 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 2011

    MediaSPIP 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.Clarke

    FFmpeg 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 IV

    I 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 and

    subformat = 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:32

    Where 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 World

    I 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 :

    &#xA;

    var ffmpegCommand = ffmpeg();&#xA;            ffmpegCommand&#xA;            .input(HLS FILE HERE)&#xA;            .inputOptions(&#x27;-protocol_whitelist file,http,https,tcp,tls,crypto,data&#x27;)&#xA;            .on("error", (err, stdout, stderr) => {&#xA;                console.log(err)&#xA;                let error = new Error(err.message)&#xA;                error.code = err.code || &#x27;FILE_CONVERSION_M3U8_TO_MP3/UNKNOWN_ERROR&#x27;;&#xA;                error.status = err.status || 500;&#xA;&#xA;                console.log(&#x27;An error occurred: &#x27; &#x2B; err.message, err, stderr);&#xA;                reject(error)&#xA;            })&#xA;            .on("end", () => {&#xA;                console.log(temporaryFilePath2)&#xA;                resolve(temporaryFilePath2);&#xA;            })&#xA;            .on(&#x27;progress&#x27;, function(progress) {&#xA;                console.log(&#x27;progress: &#x27; &#x2B; (progress.percent || 0).toFixed(2) &#x2B; &#x27;%。&#x27;);&#xA;                progressGathering.push((progress.percent || 0).toFixed(2))&#xA;&#xA;                if(progressGathering.length == 10 &amp;&amp; progressGathering[9] == 0.00){&#xA;                    let error = new Error("File is a live stream.")&#xA;                    error.code = &#x27;FILE_CONVERSION_M3U8_TO_MP3/LIVESTREAM_SUPPORT&#x27;&#xA;                    error.status = 501&#xA;&#xA;                    ffmpegCommand.kill()&#xA;                    reject(error)&#xA;                }&#xA;            })&#xA;            .inputOptions(&#x27;-allowed_extensions ALL&#x27;)&#xA;            .outputOptions("-c copy")&#xA;            .output(temporaryFilePath2)&#xA;            .run();&#xA;&#xA;            setTimeout(() => {&#xA;                ffmpegCommand.kill();&#xA;                let error = new Error("The file selected was too large or the network was hanging. Conversion timeout.")&#xA;                error.code = &#x27;FILE_CONVERSION_M3U8_TO_MP3/TIMEOUT&#x27;&#xA;                error.status = 599;&#xA;                reject(error)&#xA;            }, 300000) // 5 minutes&#xA;

    &#xA;

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

    &#xA;

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

    &#xA;

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

    &#xA;