Hi to all,
I'm encoding video and audio. For video I encode frames extracted from my
real-time simulation
and for audio I encode "what I'm listening".
For video I "extract and encode" a frame every 40ms to obtain 25fps.
The problem come when I try to also encode audio. My sound card play sound
at 48000 samples/s
so I set the sample_rate param of the encoder to 48000 and I do this test
(copied from output_example.c)

//this routine is called 25 times/second
void timerCB(void *data, SoSensor *sensor)
{
   MovieRecorderIv *obj = (MovieRecorderIv *)data;

   /* compute current audio and video time */
   if ( obj->GetAudioStream() ){
       audio_pts = (double)obj->GetAudioStream()->pts.val *
obj->GetAudioStream()->time_base.num /
obj->GetAudioStream()->time_base.den;
     }
   else
       audio_pts = 0.0;

   if ( obj->GetVideoStream() )
       video_pts = (double)obj->GetVideoStream()->pts.val *
obj->GetVideoStream()->time_base.num / obj->GetVideoStream()->time_base.den;
   else
       video_pts = 0.0;

   /* write interleaved audio and video frames */
   if (!obj->GetVideoStream() || (obj->GetVideoStream() &&
obj->GetAudioStream() && audio_pts < video_pts)){
       obj->EncodeAudioFrame();
   }
   else{
       obj->EncodeVideoFrame();
   }
}

If I also encode audio as in the example above the created mpeg file run
much faster that original, instead If I only encode video
it run at the same fps of the original.
I have some problem to solve my problem, can I have a help?

Regards,
Franco

-- 
Franco Amato
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to