mercredi 31 décembre 2014

Seek issue with ffmpeg

I implemented one audio player using with ffmpeg for playing all format audio files in android.I used following code for seek the song.



int64_t seekTime = av_rescale_q(seekValue * AV_TIME_BASE,
AV_TIME_BASE_Q,
fmt_ctx->streams[seekStreamIndex]->time_base);

int64_t seekStreamDuration =
fmt_ctx->streams[seekStreamIndex]->duration;

int flags = AVSEEK_FLAG_BACKWARD;
if (seekTime > 0 && seekTime < seekStreamDuration)
flags |= AVSEEK_FLAG_ANY;

int ret = av_seek_frame(fmt_ctx, seekStreamIndex, seek_target,
flags);

if (ret < 0)
ret = av_seek_frame(fmt_ctx, seekStreamIndex, seekTime,
flags);

avcodec_flush_buffers(dec_ctx);


Its working fine for most of the songs.But some of the mp3 songs getting duration problem.For example if the song length is 2 mins if i seek the song to some position then finally song ends with 2 mins 10 seconds.I get this issue with only mp3 songs.Without seeking the same song ends with exact time. I am using ffmpeg 2.1 The some code working fine with ffmpeg 0.11.1 Please provide any information about this issue.


Aucun commentaire:

Enregistrer un commentaire