yellowcath / VideoProcessor

process video(cut & scale & increase & decrease & reverse) with mediacodec
Apache License 2.0
968 stars 141 forks source link

android.media.MediaCodec$CodecException: start failed #45

Open lhholylight opened 4 years ago

lhholylight commented 4 years ago

同时压缩文件超过2个时会报错

2020-05-30 18:36:25.405 11258-11585/com.hw.videoprocessor W/System.err: android.media.MediaCodec$CodecException: start failed 2020-05-30 18:36:25.406 11258-11585/com.hw.videoprocessor W/System.err: at android.media.MediaCodec.native_start(Native Method) 2020-05-30 18:36:25.406 11258-11585/com.hw.videoprocessor W/System.err: at android.media.MediaCodec.start(MediaCodec.java:2075) 2020-05-30 18:36:25.406 11258-11585/com.hw.videoprocessor W/System.err: at com.hw.videoprocessor.VideoEncodeThread.doEncode(VideoEncodeThread.java:116) 2020-05-30 18:36:25.406 11258-11585/com.hw.videoprocessor W/System.err: at com.hw.videoprocessor.VideoEncodeThread.run(VideoEncodeThread.java:65) 2020-05-30 18:36:25.410 11258-11588/com.hw.videoprocessor W/System.err: android.media.MediaCodec$CodecException: start failed 2020-05-30 18:36:25.410 11258-11588/com.hw.videoprocessor W/System.err: at android.media.MediaCodec.native_start(Native Method) 2020-05-30 18:36:25.411 11258-11588/com.hw.videoprocessor W/System.err: at android.media.MediaCodec.start(MediaCodec.java:2075) 2020-05-30 18:36:25.411 11258-11588/com.hw.videoprocessor W/System.err: at com.hw.videoprocessor.VideoEncodeThread.doEncode(VideoEncodeThread.java:116) 2020-05-30 18:36:25.411 11258-11588/com.hw.videoprocessor W/System.err: at com.hw.videoprocessor.VideoEncodeThread.run(VideoEncodeThread.java:65)

NikolaDespotoski commented 1 year ago

Is it happening on Huawei devices only? Does it happen on recorded videos with that device?

I don't know if it is same issue however, I was parallelizing multiple conversions. I made the conversion in serial fashion the issue is gone. It was a problem primarily on huawei devices. Seems that some of the internal buffers are not finished, if the issue still occurs try adding small delay or exponential retry.