Skip to content

Commit 5764fe8

Browse files
committed
fix vertical video distorted on lollipop
Fixes #3
1 parent 053cb82 commit 5764fe8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/src/main/java/net/ypresto/androidtranscoder/engine/VideoTrackTranscoder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ public void setup() {
7373
mEncoderOutputBuffers = mEncoder.getOutputBuffers();
7474

7575
MediaFormat inputFormat = mExtractor.getTrackFormat(mTrackIndex);
76+
if (inputFormat.containsKey("rotation-degrees")) {
77+
// Decoded video is rotated automatically in Android 5.0 lollipop.
78+
// Turn off here because we don't want to encode rotated one.
79+
// refer: https://android.googlesource.com/platform/frameworks/av/+blame/lollipop-release/media/libstagefright/Utils.cpp
80+
inputFormat.setInteger("rotation-degrees", 0);
81+
}
7682
mDecoderOutputSurfaceWrapper = new OutputSurface();
7783
mDecoder = MediaCodec.createDecoderByType(inputFormat.getString(MediaFormat.KEY_MIME));
7884
mDecoder.configure(inputFormat, mDecoderOutputSurfaceWrapper.getSurface(), null, 0);

0 commit comments

Comments
 (0)