Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slow MediaExtractor seekTo

I created a video player using MediaCodec and MediaExtractor, but when I try to change the media position using MediaExtractor seekTo method it is really slow (took 10 seconds to seek for a 1080P video) while the SDK MediaPlayer can seek in real-time. Any idea to fix this?

MediaExtractor extractor = new MediaExtractor();
extractor.setDataSource(SAMPLE);    
.
.
.
extractor.seekTo(480000000, MediaExtractor.SEEK_TO_CLOSEST_SYNC);

Update

Theo original project is here

like image 247
Mohsen Afshin Avatar asked Jun 11 '13 08:06

Mohsen Afshin


1 Answers

I've found the bug that caused the seeking to be slow. It was the sync clock used for maintaining media FPS.

I've just uploaded the new working project with the following features:

  • Correct seek
  • Correct media current position
  • Correct media duration
  • MediaController
  • Playback fix for some videos that hardware decoder (MediaCodec) can't detect their frame time stamps correctly.

https://github.com/mafshin/MediaCodecDemo

like image 132
Mohsen Afshin Avatar answered Sep 23 '22 11:09

Mohsen Afshin