[Libav-user] FFMPEG seek Issue with mp3 songs

Michelle Cannon sai.ramesh51 at gmail.com
Thu Jan 1 10:09:42 CET 2015


Hi all. 
     
       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.



--
View this message in context: http://libav-users.943685.n4.nabble.com/FFMPEG-seek-Issue-with-mp3-songs-tp4660741.html
Sent from the libav-users mailing list archive at Nabble.com.


More information about the Libav-user mailing list