[Libav-user] how to set the time base ?

wucg 249165510 at qq.com
Tue Jun 14 16:28:33 CEST 2016

Could anyone tell me how to set the time_base for  audio/video stream ?
I hit my head agaist the wall for one thousand times, and still can't find a way to work it out!

(AVStream*)_audio_st->time_base = (AVRational ) { 1, _param.sampleRate };        // Not working
(AVCodecContext*)_codec_ctx->time_base = (AVRational ) { 1, _param.sampleRate };        // Not working

I analysis my aac file and find out:
stream time_base: 1/28224000
   0:STM_IDX:0, isKey:1, dts:      0, pts:      0, duration:1310720, pos:      0, size:371
   1:STM_IDX:0, isKey:1, dts:1310720, pts:1310720, duration:1310720, pos:    371, size:372
   2:STM_IDX:0, isKey:1, dts:2621440, pts:2621440, duration:1310720, pos:    743, size:371
   3:STM_IDX:0, isKey:1, dts:3932160, pts:3932160, duration:1310720, pos:   1114, size:372

The pts, dts, duration is so big and they are scary. Also the audio play too fast.
Thanks !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160614/9689f925/attachment.html>

More information about the Libav-user mailing list