android-aac-enc icon indicating copy to clipboard operation
android-aac-enc copied to clipboard

android 5.0 crash

Open wufannet opened this issue 10 years ago • 4 comments

android-aac-enc android 5.0 problem: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x82df8000 in tid 12653 (Thread-589)

wufannet avatar Aug 04 '15 09:08 wufannet

Having the same....what might be the problem?

taraspaliy avatar Oct 07 '15 16:10 taraspaliy

Having the same....

PoetGcc avatar Mar 04 '16 08:03 PoetGcc

put the libaac-encoder in to the armeabi-v7a and armeabi

badboy-tian avatar May 06 '16 14:05 badboy-tian

final String name = files.get(postion).getParentFile().getAbsolutePath() + "/" + files.get(postion).getName().replace(".wav", ".mp4");

    AACEncoder aacEncoder = new AACEncoder();
    ByteArrayOutputStream bos = null;
    int size = 0;
    byte[] buffer = null;
    try {
        File file = files.get(postion);
        FileInputStream fis = new FileInputStream(file);

        bos = new ByteArrayOutputStream();
        byte[] b = new byte[1000];
        int n;
        while ((n = fis.read(b)) != -1) {
            bos.write(b, 0, n);
        }

        bos.size();
        fis.close();
        bos.close();
        buffer = bos.toByteArray();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    Uri uri = Uri.parse(files.get(postion).getAbsolutePath());
    MediaMetadataRetriever mmr = new MediaMetadataRetriever();
    mmr.setDataSource(this,uri);
    String durationStr = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
    int millSecond = Integer.parseInt(durationStr);

    int bitRate = Integer.parseInt(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE));
    Log.e("xxx", bitRate + "");

    aacEncoder.init(bitRate, 1, 44100, 16, name.replace(".mp4", ".aac"));
    aacEncoder.encode(buffer);



    aacEncoder.uninit();

work normal!

badboy-tian avatar May 06 '16 14:05 badboy-tian