Recherche avancée

Médias (0)

Mot : - Tags -/médias

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (91)

Sur d’autres sites (16689)

  • Distorted audio output from microphone input

    25 août 2016, par Mohammad Abu Musa

    I am writing an ogg encoder with chrome native client, I managed to successfully export the files as the wave samples come in put I have two issues

    1. Timing in the file
    2. The voice is distorted, I hear noises instead of the voice collected from the microphone

    Here how the code works, first I collect the microphone samples and process it as the following

    const char* data = static_cast<const>(buffer.GetDataBuffer());
    audio_buffer_size = buffer.GetDataBufferSize();
    uint32_t channels = buffer.GetNumberOfChannels();
    uint32_t samples = buffer.GetNumberOfSamples() / channels;

    if (channel_count_ != channels || sample_count_ != samples) {
     channel_count_ = channels;
     sample_count_ = samples;

     samples_.resize(sample_count_ * channel_count_);
     // Try (+ 5) to ensure that we pick up a new set of samples between each
     // timer-generated repaint.
     timer_interval_ = (sample_count_ * 1000) / buffer.GetSampleRate() + 5;
     // Start the timer for the first buffer.
     if (first_buffer_) {
       first_buffer_ = false;
       ScheduleNextTimer();
     }
    }

    memcpy(samples_.data(), data,
       sample_count_ * channel_count_ * sizeof(char));
    </const>

    The result is a vector called samples_ of type char for the other information they are as follows

    1. Samples 480
    2. Channels 1
    3. Sample Rate 48000
    4. Time Interval is 15

    On the function ScheduleNextTimer I make the encoding and the storage of the packets to ogg file. I used the standard code provided in the encoder example but I do not think I am doing write since I am not importing from a wave file, I am rather collecting raw bytes so I do not think the loops I am using are correct.
    Attempt #1

    for (int i = 0; i &lt; sampread; i++) {
       for (int j = 0; j &lt; audioCh; j++) {
           vorbis_buffer[j][i] = ((samples_[count + 1] &lt;&lt; 8)
                   | (0x00ff &amp; (int) samples_[count])) / 32768.f;
           count += 2;
       }
    }

    Attempt #2

    for(int i=0;i4;i++){
             vorbis_buffer[0][i]=((samples_[i*4+1]&lt;&lt;8)|
                         (0x00ff&amp;(int)samples_[i*4]))/32768.f;
             vorbis_buffer[1][i]=((samples_[i*4+3]&lt;&lt;8)|
                         (0x00ff&amp;(int)samples_[i*4+2]))/32768.f;
         }

    Both of these attempts did not work. My question is should I keep using the vector or should I change it to something else. what are these values in the loop I do not get them or what they represent and how does the timing work.

    Here is what I get from ffprob

    Input #0, ogg, from 'file.ogg':
     Duration: 00:01:21.00, start: 0.000000, bitrate: 118 kb/s
       Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp, 80 kb/s
  • How to run the "ffmpeg -i input.mp4 output.avi" in Node.js ? [duplicate]

    3 septembre 2016, par Thales

    This question already has an answer here :

    I have a application on Electron that needs receive video and convert him another format, but I don’t know how to do. I’m thinking to do with node, but I need how to run the command "ffmpeg -i input.mp4 output.avi". I don’t know if this way is better. I thank first of all and I apologize for the ignorance.

  • Use Output of FFMPEG as the Input of another FFMPEG command, in one execution

    1er juillet 2022, par Xavi Font

    I asked a question earlier but had too many steps and was too long maybe to receive an answer, so here is a simple one that will help me A LOT.

    &#xA;

    I have a command, could be anything ffmpeg -loop 1 -i my_dog_playing.jpg -t 5 output.mp4 and want to take that output and add stuff to it, like a complex_filter (say... an image overlay on the corner), but I want to do so before that output.mp4 is encoded (rendered) so that no time is wasted (I want it to be done within one command).

    &#xA;