Frage

The input is a video file. I want to process each video frame, while the audio remains the same. The output is a video file.

I basically follow the example DecodeEditEncodeTest.java and MeidaMuxerText.java in bigflake.com Without adding audio track, the application works well. Now I add audio track into the mMuxer.

Since I do not need to process the audio, I do not use decode or encode for the audio.

Here is a dilemma. If I want to know whether the sample data is video or audio, I will use: int chunkSize = extractor.readSampleData(inputBuf, 0)

If I set the inputBuf as a general ByteBuffer, and if the sample turns out to be audio, it is fine. I just use mMuxer.writeSampleData to write the inputBuf to the output video file.

But if the sample turns out to be video, then I am supposed to write the data in the decoder's input buffer. But now since I do not know it first, how can I determine which buffer to use?

War es hilfreich?

Lösung

MediaExtractor.getSampleTrackIndex() tells you which track the current sample comes from.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top