Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Add audio effect with mp3(audio/mpeg)

JIHOON_O_
Beginner
438 Views

I've been trying to add audio effect with mp3(audio/mpeg) but I can't make it.

It crashes with BufferOverflowException.

The log message is

 java.nio.BufferOverflowException
    java.nio.BufferOverflowException
            at java.nio.ByteBuffer.put(ByteBuffer.java:787)
            at com.intel.inde.mp.domain.Frame.copyDataFrom(Frame.java:91)
            at com.intel.inde.mp.domain.pipeline.CopyDataCommandHandler.handle(CopyDataCommandHandler.java:33)
            at com.intel.inde.mp.domain.CommandProcessor.process(CommandProcessor.java:114)
            at com.intel.inde.mp.domain.CommandProcessor.process(CommandProcessor.java:86)
            at com.intel.inde.mp.domain.CommandProcessor.processCommandPairs(CommandProcessor.java:78)
            at com.intel.inde.mp.domain.CommandProcessor.process(CommandProcessor.java:50)
            at com.intel.inde.mp.MediaComposer$1.run(MediaComposer.java:344)
            at java.lang.Thread.run(Thread.java:818)

What I've tried things to solve this problem are
- change the value of audioFormat.setKeyMaxInputSize(48 * 1024)
- change targetSampleRate value
- change the value of byteBuffer.limit(mAudioDecoderOutputBufferInfo.size); and decoderOutputBuffer.limit(mAudioDecoderOutputBufferInfo.size);

but these things didn't help.

so, I printed log with buffer's value.

D/EqualRateAudioReader﹕ EqualRateAudioReader read start
D/EqualRateAudioReader﹕ decoderInputBufferIndex : 0
D/EqualRateAudioReader﹕ decoderInputBuffer.capacity() 524288, decoderInputBuffer.limit() 524288
D/EqualRateAudioReader﹕ SampleData size : 417
D/EqualRateAudioReader﹕ Presentation Time : 0
D/EqualRateAudioReader﹕ mAudioExtractor.getSampleFlags() : 1
I/ACodec﹕ >>> getPortFormat 16, OMX.SEC.mp3.dec
D/EqualRateAudioReader﹕ decoderOutputBufferIndex MediaCodec.INFO_OUTPUT_FORMAT_CHANGED
D/EqualRateAudioReader﹕ decoderInputBufferIndex : 1
D/EqualRateAudioReader﹕ decoderInputBuffer.capacity() 524288, decoderInputBuffer.limit() 524288
D/EqualRateAudioReader﹕ SampleData size : 418
D/EqualRateAudioReader﹕ Presentation Time : 26122
D/EqualRateAudioReader﹕ mAudioExtractor.getSampleFlags() : 1
D/EqualRateAudioReader﹕ decoderOutputBufferIndex : 0
D/EqualRateAudioReader﹕ mAudioDecoderOutputBufferInfo.offset : 0
D/EqualRateAudioReader﹕ mAudioDecoderOutputBufferInfo.size : 2492
D/EqualRateAudioReader﹕ byteBuffer.capacity() 1048576
D/EqualRateAudioReader﹕ byteBuffer.limit() 2492
D/EqualRateAudioReader﹕ decoderOutputBuffer.capacity() 27648
D/EqualRateAudioReader﹕ decoderOutputBuffer.limit() 2492
D/SubstituteAudioEffect﹕ timeProgress 0
D/SubstituteAudioEffect﹕ input.limit() 24576, input.capacity() 24576, byteBuffer.limit() 2492, byteBuffer.capacity() 1048576
I/AMP﹕ New frame allocated for buffer 0
I/AMP﹕ New frame allocated for buffer 12
I/AMP﹕ New frame allocated for buffer 1
D/EqualRateAudioReader﹕ EqualRateAudioReader read start
D/EqualRateAudioReader﹕ decoderInputBufferIndex : 2
D/EqualRateAudioReader﹕ decoderInputBuffer.capacity() 524288, decoderInputBuffer.limit() 524288
D/EqualRateAudioReader﹕ SampleData size : 418
D/EqualRateAudioReader﹕ Presentation Time : 52244
D/EqualRateAudioReader﹕ mAudioExtractor.getSampleFlags() : 1
D/EqualRateAudioReader﹕ decoderOutputBufferIndex : 1
D/EqualRateAudioReader﹕ mAudioDecoderOutputBufferInfo.offset : 0
D/EqualRateAudioReader﹕ mAudioDecoderOutputBufferInfo.size : 4608
D/EqualRateAudioReader﹕ byteBuffer.capacity() 1048576
D/EqualRateAudioReader﹕ byteBuffer.limit() 4608
D/EqualRateAudioReader﹕ decoderOutputBuffer.capacity() 27648
D/EqualRateAudioReader﹕ decoderOutputBuffer.limit() 4608
D/SubstituteAudioEffect﹕ timeProgress 23219
D/SubstituteAudioEffect﹕ input.limit() 24576, input.capacity() 24576, byteBuffer.limit() 4608, byteBuffer.capacity() 1048576
I/AMP﹕ New frame allocated for buffer 11
I/AMP﹕ New frame allocated for buffer 0
I/AMP﹕ New frame allocated for buffer 1
I/MPEG4Writer﹕ setStartTimestampUs: 0
I/MPEG4Writer﹕ Earliest track starting time: 0
I/AMP﹕ New frame allocated for buffer 2
D/EqualRateAudioReader﹕ EqualRateAudioReader read start
D/EqualRateAudioReader﹕ decoderInputBufferIndex : 3
D/EqualRateAudioReader﹕ decoderInputBuffer.capacity() 524288, decoderInputBuffer.limit() 524288
D/EqualRateAudioReader﹕ SampleData size : 418
D/EqualRateAudioReader﹕ Presentation Time : 78367
D/EqualRateAudioReader﹕ mAudioExtractor.getSampleFlags() : 1
D/EqualRateAudioReader﹕ decoderOutputBufferIndex : 2
D/EqualRateAudioReader﹕ mAudioDecoderOutputBufferInfo.offset : 0
D/EqualRateAudioReader﹕ mAudioDecoderOutputBufferInfo.size : 4608
D/EqualRateAudioReader﹕ byteBuffer.capacity() 1048576
D/EqualRateAudioReader﹕ byteBuffer.limit() 4608
D/EqualRateAudioReader﹕ decoderOutputBuffer.capacity() 27648
D/EqualRateAudioReader﹕ decoderOutputBuffer.limit() 4608
D/SubstituteAudioEffect﹕ timeProgress 46439
D/SubstituteAudioEffect﹕ input.limit() 24576, input.capacity() 24576, byteBuffer.limit() 4608, byteBuffer.capacity() 1048576


If you have any idea, please help me.

thank you.

0 Kudos
2 Replies
Sravanthi_K_Intel
438 Views

Hello there - Thanks for the question, but I'm afraid the information about the bug/error is not enough to understand the problem and its cause. Can you please give us information such as what product you used, what sample application you used etc? For example, to debug issues, we recommend customers use our sample applications or share their code with us with details. And also, please mention the product you are using too. In general, here is the information we request to understand the problem better - https://software.intel.com/en-us/forums/topic/531083

Thanks.

0 Kudos
JIHOON_O_
Beginner
438 Views

I'm sorry, I totally forgot to describe information.

I use m4m(media for mobile) of Intel INDE to develop video editing application on Android OS.

And I subscribe media for mobile android samples in github(https://github.com/INDExOS/media-for-mobile)

The problem is audio effect sample in m4m android samples.

I've tried to change sample to add audio effect with mp3 format(audio/mpeg not only audio/mp4a-latm)

But It crashes with BufferOverflowException.

If you need more information, please let me know.

Thank you.

0 Kudos
Reply