INDExOS / media-for-mobile

Media for Mobile
Other
456 stars 178 forks source link

MediaComposer got stuck while reducing video resolution #90

Open leoben7 opened 6 years ago

leoben7 commented 6 years ago

I'm using M4M to reduce video resolution. Basically what I'm doing is very similar to the sample ComposerTranscodeCoreActivity, i.e. creating a VideoFormatAndroid

       VideoFormatAndroid videoFormat = new VideoFormatAndroid(videoMimeType, width, height);

        videoFormat.setVideoBitRateInKBytes(videoBitRateInKBytes);
        videoFormat.setVideoFrameRate(videoFrameRate);
        videoFormat.setVideoIFrameInterval(videoIFrameInterval);

        mediaComposer.setTargetVideoFormat(videoFormat);

and than calling mediaComposer.start();

When I run the app from Android Studio, it works fine. But when I download the app from the store, the mediaComposer never ends and the org.m4m.IProgressListener is never called for onMediaDone, onMediaPause or onMediaStop.

Having a look at the logs, I can see

E/linker: readlink('/proc/self/fd/XXX') failed: Permission denied [fd=XXX]
E/linker: warning: unable to get realpath for the library "libwvm.so". Will use given name.

and this also happens for libstagefrighthw,libWVStreamControlAPI_L3.so, libwvdrm_L3.so, libHwExtendedExtractor.so, libstagefrighthw.so, libomx_vxd,libvpp.so, libomx_vxe.so, libstagefright_soft_aacdec.so, libstagefright_soft_aacenc.so.

Moreover after a series of

I/AMP: New frame allocated for buffer x

I can see only

I/art: Background sticky concurrent mark sweep GC freed 132914(4MB) AllocSpace objects, 0(0B) LOS objects, 6% free, 53MB/57MB, paused 6.498ms total 52.184ms I/art: Background sticky concurrent mark sweep GC freed 144141(4MB) AllocSpace objects, 0(0B) LOS objects, 6% free, 53MB/57MB, paused 1.649ms total 129.531ms .....

I modified my project's root build.gradle and my module-level build.gradle according to what suggested.

My module-level build.gradle looks like

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'
    defaultConfig {
        applicationId "zz.aaaa.bbbb"
        minSdkVersion 18 
        targetSdkVersion 23
        versionCode 15
        versionName "2.3"
        multiDexEnabled true 

        ndk {
            abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.0'

    compile 'com.android.support:multidex:1.0.1'

    compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
    compile 'io.reactivex.rxjava2:rxjava:2.1.5'

    compile "com.google.firebase:firebase-messaging:9.2.0"

    compile 'com.github.indexOS.media-for-mobile:android:master-SNAPSHOT' 

}