I am trying to use a portion of a pre-recorded video file for processing on Android. Currently I am working with MediaCodec library on Android. I am using MediaExtractor to extract the data from video file. The idea is to extract only required gata stream for processing. The code looks like:
    extractor = new MediaExtractor();
    File file = new File(mInputFile);
    FileInputStream inputStream = new FileInputStream(file);
    long len = file.length();
    long start = 200L;
    extractor.setDataSource(inputStream.getFD(),start,len);
    inputStream.close(); 
Logcat is:
java.io.IOException: Failed to instantiate extractor. at android.media.MediaExtractor.setDataSource(Native Method).
It works well if I set starting bytes to 0. What am I doing wrong ? Can we not extract portion of videos using mediaextractor ?