> On Jun 14, 2016, at 5:28 PM, wucg <[email protected]> wrote: > > 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 ! > > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user
This may help: 28224000 = 44100*640 As long as your time base can handle the sample rate you don’t need to have the exact time base with the sample rate. So it would be 640 ticks per sample in your case. But if you really must change the time base then i believe you have to rescale the timestamps of AVPackets using av_packet_rescale_ts And even after doing that you may get a timescale value of 1/2*sampleRate in your stream. _______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
