jonataslaw / VideoCompress

Compress videos, remove audio, manipulate thumbnails, and make your video compatible with all platforms through this lightweight and efficient library.
MIT License
232 stars 282 forks source link

Unexpected error while transcoding. Failed to release the muxer. #174

Open cnkygmr opened 2 years ago

cnkygmr commented 2 years ago

It works smoothly and fast on ios but gives this error on android

E/TranscodeEngine(28812): Unexpected error while transcoding.
E/TranscodeEngine(28812): java.lang.IllegalStateException: Failed to stop the muxer
E/TranscodeEngine(28812):   at android.media.MediaMuxer.nativeStop(Native Method)
E/TranscodeEngine(28812):   at android.media.MediaMuxer.stop(MediaMuxer.java:454)
E/TranscodeEngine(28812):   at com.otaliastudios.transcoder.sink.DefaultDataSink.stop(DefaultDataSink.java:218)
E/TranscodeEngine(28812):   at com.otaliastudios.transcoder.internal.transcode.DefaultTranscodeEngine.transcode(DefaultTranscodeEngine.kt:132)
E/TranscodeEngine(28812):   at com.otaliastudios.transcoder.internal.transcode.TranscodeEngine$Companion.transcode(TranscodeEngine.kt:48)
E/TranscodeEngine(28812):   at com.otaliastudios.transcoder.internal.transcode.TranscodeEngine.transcode(Unknown Source:2)
E/TranscodeEngine(28812):   at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:102)
E/TranscodeEngine(28812):   at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:99)
E/TranscodeEngine(28812):   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
E/TranscodeEngine(28812):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/TranscodeEngine(28812):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/TranscodeEngine(28812):   at java.lang.Thread.run(Thread.java:764)
I/Decoder(VIDEO,0)(28812): release(): releasing codec. dequeuedInputs=0 dequeuedOutputs=0
E/MediaMuxer(28812): stop() is called in invalid state 3
W/DefaultDataSink(28812): Failed to release the muxer.
W/DefaultDataSink(28812): java.lang.IllegalStateException: Failed to stop the muxer
W/DefaultDataSink(28812):   at android.media.MediaMuxer.nativeStop(Native Method)
W/DefaultDataSink(28812):   at android.media.MediaMuxer.stop(MediaMuxer.java:454)
W/DefaultDataSink(28812):   at android.media.MediaMuxer.release(MediaMuxer.java:694)
W/DefaultDataSink(28812):   at com.otaliastudios.transcoder.sink.DefaultDataSink.release(DefaultDataSink.java:224)
W/DefaultDataSink(28812):   at com.otaliastudios.transcoder.internal.transcode.DefaultTranscodeEngine.cleanup(DefaultTranscodeEngine.kt:137)
W/DefaultDataSink(28812):   at com.otaliastudios.transcoder.internal.transcode.TranscodeEngine$Companion.transcode(TranscodeEngine.kt:63)
W/DefaultDataSink(28812):   at com.otaliastudios.transcoder.internal.transcode.TranscodeEngine.transcode(Unknown Source:2)
W/DefaultDataSink(28812):   at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:102)
W/DefaultDataSink(28812):   at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:99)
W/DefaultDataSink(28812):   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/DefaultDataSink(28812):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/DefaultDataSink(28812):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/DefaultDataSink(28812):   at java.lang.Thread.run(Thread.java:764)
I/DataSources(28812): release(): releasing...
I/DataSources(28812): deinitializing com.otaliastudios.transcoder.source.UriDataSource@cf58174... (isInit=true)
I/DefaultDataSource(0)(28812): deinitialize(): deinitializing...
I/DataSources(28812): deinitializing com.otaliastudios.transcoder.source.UriDataSource@cf58174... (isInit=false)
I/DataSources(28812): release(): released.
W/System  (28812): A resource failed to call release. 
D/MPEG4Writer(28812): Video track stopping. Stop source
D/MPEG4Writer(28812): Audio track stopping. Stop source
W/System  (28812): A resource failed to call release. 
cnkygmr commented 2 years ago

Does anyone know why or can help?

14h4i commented 2 years ago

same problem

DiegoLovera commented 2 years ago

Same problem here, i tried it on android 12 and it works fine, but android 9 always gets this crash, i will try to test out more android versions