Recherche avancée

Médias (91)

Autres articles (64)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (11563)

  • Problem with calculating and writing silence

    3 mars 2023, par Bohdan Petrenko

    Because Discord sends no audio if user isn't talking, I need to calculate time after their latest voice data received and write some amout of silence to the buffer. I have this code for handling audio data :

    


    private async Task OnVoiceReceived(VoiceNextConnection sender, VoiceReceiveEventArgs e)
{
    try
    {
        if (!_isRecording) return;
        
        if (e.User is null) return;

        if (!_circularBuffers.TryGetValue(e.User.Id, out var circularBuffer))
        {
            circularBuffer = new CircularBuffer(e.AudioFormat.SampleRate * e.AudioFormat.ChannelCount * 2 * _bufferDurationSeconds, 
                e.AudioFormat.ChannelCount);
            _circularBuffers[e.User.Id] = circularBuffer;
        }

        TimeSpan delay;

        if (!_lastVoiceActivity.TryGetValue(e.User.Id, out var lastData))
        {
            // If we don't have any data for this user, we assume that last data from this user was received at the same time as recording started
            delay = DateTimeOffset.Now - _recordingStartedAt;
        }
        else delay = DateTimeOffset.Now - lastData;

        // calculate how much silence we need to add to the buffer
        var silence = new byte[e.AudioFormat.SampleRate * e.AudioFormat.ChannelCount * 2 * (int)Math.Round(delay.TotalSeconds)];
        
        await circularBuffer.WriteAsync(silence);

        _lastVoiceActivity[e.User.Id] = DateTimeOffset.Now;
        
        
        await circularBuffer.WriteAsync(e.PcmData);
    }
    catch (Exception exception)
    {
        Log.Error(exception, "Error while receiving voice data");
    }
}


    


    After the recording finishes, with ffmpeg I write buffers to .wav files and then mix audios.

    


    I have a problem that sometimes amount of silence is wrong and espacially this can be heard after mixing audios of multiple users. Sometimes amount of silence is not enough and somtimes it's too long. For example, In conversation recording user 1 can respond to user 2 even before user 2 asks him or vice-versa, user 1 can respond too late. Also I found that the problem appears often after some data of the buffer was removed due to overfilling.

    


    I tried to change formula to calculate silence, and add data duration when setting new value of _lastVoiceActivity but that just made the problem worse. Also I tried to add silence only if delay is more than 100ms but this also didn't help. For testing I use circular buffers which can contain 30 seconds of audio.

    


    I use DSharpPlus for Discord and ffmpeg for mixing audios.

    


    UPD : I found that if I don't remove data from buffers due to overfilling, the probles becomes almost invisible. So here is my CircularBuffer implementation :

    


        public class CircularBuffer&#xA;{&#xA;    private readonly ConcurrentQueue<byte> _buffer;&#xA;    &#xA;    private readonly object _lockObject;&#xA;    private readonly int _bufferSize;&#xA;&#xA;    public int Channels { get; private set; }&#xA;&#xA;    public int Count&#xA;    {&#xA;        get&#xA;        {&#xA;            lock (_lockObject)&#xA;            {&#xA;                return _buffer.Count;&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    public CircularBuffer(int size, int channels)&#xA;    {&#xA;        _buffer = new ConcurrentQueue<byte>();&#xA;        _bufferSize = size;&#xA;        Channels = channels;&#xA;        _lockObject = new object();&#xA;    }&#xA;&#xA;    public async Task WriteAsync(ReadOnlyMemory<byte> data)&#xA;    {&#xA;        lock (_lockObject)&#xA;        {&#xA;            if (data.Length > _bufferSize) data = data[^_bufferSize..];&#xA;&#xA;            if (_buffer.Count &#x2B; data.Length > _bufferSize)&#xA;            {&#xA;                var bytesToRemove = _buffer.Count &#x2B; data.Length - _bufferSize;&#xA;                &#xA;                for (var i = 0; i &lt; bytesToRemove; i&#x2B;&#x2B;)&#xA;                {&#xA;                    _buffer.TryDequeue(out _);&#xA;                }&#xA;            }&#xA;            &#xA;            for (var index = 0; index &lt; data.Span.Length; index&#x2B;&#x2B;)&#xA;            {&#xA;                var b = data.Span[index];&#xA;                _buffer.Enqueue(b);&#xA;            }&#xA;        }&#xA;        &#xA;        await Task.CompletedTask;&#xA;    }&#xA;    &#xA;    public async Task ReadAsync(Memory<byte> data)&#xA;    {&#xA;        lock (_lockObject)&#xA;        {&#xA;            if (data.Length > _buffer.Count)&#xA;            {&#xA;                data = data[.._buffer.Count];&#xA;            }&#xA;            &#xA;            for (var index = 0; index &lt; data.Span.Length; index&#x2B;&#x2B;)&#xA;            {&#xA;                _buffer.TryDequeue(out var b);&#xA;                data.Span[index] = b;&#xA;            }&#xA;        }&#xA;&#xA;        await Task.CompletedTask;&#xA;    }&#xA;&#xA;    public void Clear()&#xA;    {&#xA;        lock (_lockObject)&#xA;        {&#xA;            _buffer.Clear();&#xA;        }&#xA;    }&#xA;}&#xA;</byte></byte></byte></byte>

    &#xA;

  • Revision 11e3ac62a5 : Fixing display size setting problem. Fix of https://code.google.com/p/webm/issu

    23 août 2013, par Dmitry Kovalev

    Changed Paths :
     Modify /vp9/decoder/vp9_decodframe.c



    Fixing display size setting problem.

    Fix of https://code.google.com/p/webm/issues/detail?id=608. We could have
    used invalid display size equal to the previous frame size (not to the
    current frame size).

    Change-Id : I91b576be5032e47084214052a1990dc51213e2f0

  • Control noise and duration values while extracting silences of a video using FFMPEG

    15 avril 2017, par Jitender Kumar

    I have a requirement where I need to cut the video in chunk size of 10 mints. For that I need to detect silences first . I know the command, which is given below :

    -i "C:\tmp\Test1.mp4" -af silencedetect=noise=-20dB:d=.2-f null -

    But I am really struggling to set the value of duration and noise in proportion that it can detect the silence near about 10 mints.
    I need a help to set it out and also little bit of more information how both together work ?

    I have found link https://ffmpeg.org/ffmpeg-filters.html and under this section 6.60 silencedetect they have tried to explain about them. I see there that duration, we need to provide in seconds but I am completely fail to understand the purpose of noise.

    Also I am executing this command on Window.