[Ffmpeg-devel] Recording audio and Video

oz ozden ozyozden
Mon Mar 27 20:56:45 CEST 2006

I have been trying to use ffmpeg to record an audio and video stream to a file.
The code i have written is based on output_example.c in the ffmpeg dir.
I use 2 threads to do the writing one for audio and one for video.
The video stream has PIX_FMT set to YUV420P and if i play the recorded file back
i can see the video. 
Unfortunately i cant seem to get the Audio working.
I have set the CODEC_ID_PCM_16BE for audio 
Below is the main loop of the audio thread
  ReSampleContext * smpl_ctx = audio_resample_init(2, 1, 44100, 8000);
 if (socket->Read(buffer, 480)) {
                audio_amount = socket->GetLastReadCount();
                if (audio_amount == 480) { //audio
                        audio_amount = audio_resample(smpl_ctx, (short int*) ab, (short int *)buffer, 240);
                        audio_amount *= 2;
                        memcpy(buffer, ab, audio_amount);
                        write_audio_frame(thread_data[count].oc, thread_data[count].audio_st,thread_data[count].writetofile_mutex);
  The headers etc are setup as in output_example.c
Any help greatly appreciated, 

Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2?/min or less.

More information about the ffmpeg-devel mailing list