[Ffmpeg-devel] Encoding from PCM to MPEG

Paul paul.pham
Tue Jan 9 09:35:43 CET 2007


i get output_example.c in installation of ffmpeg..

i care about encoding audio frame from PCM to MPEG, 

i see these code:

void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
{
    int j, i, v;
    int16_t *q;

    q = samples;
    for(j=0;j<frame_size;j++) {
        v = (int)(sin(t) * 10000);
        for(i = 0; i < nb_channels; i++)
            *q++ = v;
        t += tincr;
        tincr += tincr2;
    }

}

the samples point will be use for the function write_audio_frame. So if run my app (code copy from output_example.c ) then this work. But now, i would like to to use buffer PCM instead of constant values of samples .

Beside that, I used directsound and can get each captured buffer . The data of buffer were stored in this point: VOID * pbCaptureData

So, how i can use data or change data for samples . I would like pass all data of pbCaptureData to samples . And after this, i will call function write_audio_frame. 

Please help me how to do that?



More information about the ffmpeg-devel mailing list