android-transcoder icon indicating copy to clipboard operation
android-transcoder copied to clipboard

MediaFormatValidator.validateAudioOutputFormat validates the inputFormat instead of outputFormat

Open edwardotis opened this issue 7 years ago • 2 comments

I'm using Android720pFormatStrategy and getting a runtime exception on short video created in an Android 8.0.0 Nexus 5X emulator.

Input audio format: {sample-rate=8000, track-id=2, durationUs=2200000, mime=audio/3gpp, channel-count=1, language=```, max-input-size=52}

Output audio format: {max-bitrate=192, sample-rate=8000, mime=audio/mp4a-latm, channel-count=2, bitrate=192, csd-0=java.nio.HeapByteBuffer[pos=0 lim=2 cap=2]}

// validateVideoOutputFormat correctly gets passed the output format MediaFormatValidator.validateVideoOutputFormat(mVideoTrackTranscoder.getDeterminedFormat()) https://github.com/ypresto/android-transcoder/blob/master/lib/src/main/java/net/ypresto/androidtranscoder/engine/VideoTrackTranscoder.java#L97

//validateAudioOutputFormat gets passed the input format. This looks like a bug. It should be using the output format variable for validating the output format. MediaFormatValidator.validateAudioOutputFormat(mAudioTrackTranscoder.getDeterminedFormat()); https://github.com/ypresto/android-transcoder/blob/master/lib/src/main/java/net/ypresto/androidtranscoder/engine/AudioTrackTranscoder.java#L82

error: 10-29 18:03:01.988 9457-9599/com.yahoo.mobile.client.android.tripod.demo.exposure E/MediaTranscoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android. net.ypresto.androidtranscoder.engine.InvalidOutputFormatException: Audio codecs other than AAC is not supported, actual mime type: audio/3gpp at net.ypresto.androidtranscoder.engine.MediaFormatValidator.validateAudioOutputFormat(MediaFormatValidator.java:47) at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine$1.onDetermineOutputFormat(MediaTranscoderEngine.java:163) at net.ypresto.androidtranscoder.engine.QueuedMuxer.onSetOutputFormat(QueuedMuxer.java:66) at net.ypresto.androidtranscoder.engine.QueuedMuxer.setOutputFormat(QueuedMuxer.java:61) at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.drainEncoder(VideoTrackTranscoder.java:207) at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.stepPipeline(VideoTrackTranscoder.java:105) at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.runPipelines(MediaTranscoderEngine.java:191) at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:97) at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:184) at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:166) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)

edwardotis avatar Oct 30 '18 01:10 edwardotis

@ypresto I've created a PR with a fix to the issue. Can you take a look? Thanks https://github.com/ypresto/android-transcoder/pull/70

...

edwardotis avatar Oct 31 '18 22:10 edwardotis

bump

edwardotis avatar Nov 06 '18 21:11 edwardotis