Hello all,
I am looking at the demonstration code decode_encode.c which I received with ffMpeg when I downloaded it. I want to get this code  to run as it is before doing anything else with it.
I have the part that uses avcodec_encode_audio2 to encode into mp2 format.
This program opens just one file, the one it writes to so I am taking it that I am supposed to give it its source sound.
I am using Windows and Visual C++.
I recorded my voice with Audacity and saved it as a WAV file.
Then I opened that WAV file with a fopen command and I put the following 'fread' line into the example program.
        av_init_packet(&pkt);
        pkt.data = NULL; // packet data will be allocated by the encoder
        pkt.size = 0;
BytesRead = fread(samples, 1, buffer_size, InFilePtr); // from my WAV file
        for (j = 0; j < c->frame_size; j++)
    {
            samples[2*j] = (int)(sin(t) * 10000);

            for (k = 1; k < c->channels; k++)
                samples[2*j + k] = samples[2*j];
            t += tincr;
        }
It runs and writes to the file ok but the output file in MP2 format just makes a whirring noise. Has anyone managed to get his program to run and to process a source file into MP2?. Am I misunderstanding something? Is WAV the correct format to start with?

Any help much appreciated

Peadar


---
This email has been checked for viruses by AVG.
http://www.avg.com

_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to