Jay-Goo/Mp3Converter


Use latest Lame to transform PCM, WAV, AIFF and other uncompressed formats into MP3 format files(Andorid使用Lame将PCM、WAV、AIFF格式转为MP3格式文件)

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.Jay-Goo:Mp3Converter:0.0.34'
	}
	dependencies {
		implementation("com.github.Jay-Goo:Mp3Converter:0.0.34")
	}
	<dependency>
	    <groupId>com.github.Jay-Goo</groupId>
	    <artifactId>Mp3Converter</artifactId>
	    <version>0.0.34</version>
	</dependency>

                            
    libraryDependencies += "com.github.Jay-Goo" % "Mp3Converter" % "0.0.34"
        
        

                            
    :dependencies [[com.github.Jay-Goo/Mp3Converter "0.0.34"]]
        
        

Readme


Mp3Converter

Use latest Lame-3.100 to transform PCM, WAV, AIFF and other uncompressed formats into MP3 format files.

Usage

Dependencies

//Project build.gradle
allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}
//Module build.gradle
dependencies {
	        implementation 'com.github.Jay-Goo:Mp3Converter:v0.0.3'
	}

Methods

 /**
     * init lame
     * @param inSampleRate
     *              input sample rate in Hz
     * @param channel
     *              number of channels
     * @param mode
     *              0 = CBR, 1 = VBR, 2 = ABR.  default = 0
     * @param outSampleRate
     *              output sample rate in Hz
     * @param outBitRate
     *              rate compression ratio in KHz
     * @param quality
     *              quality=0..9. 0=best (very slow). 9=worst.<br />
     *              recommended:<br />
     *              2 near-best quality, not too slow<br />
     *              5 good quality, fast<br />
     *              7 ok quality, really fast
     */
 Mp3Converter.init(44100, 1, 0, 44100, 96, 7);

 /**
     * file convert to mp3
     * it may cost a lot of time and better put it in a thread
     * @param input
     *          file path to be converted
     * @param mp3
     *          mp3 output file path
     */
    Mp3Converter.convertMp3(inputPath, mp3Path);


  /**
     * get converted bytes in inputBuffer
     * @return
     *          converted bytes in inputBuffer
     *          to ignore the deviation of the file size,when return to -1 represents convert complete
     */
	Mp3Converter.getConvertBytes()

Build

You can use Android Studio Make Module 'library'to create your *.so files, they will be created in your library/src/jniLibsFolder.

ABI

This library support armeabi-v7a, arm64-v8a, mips, mips64, x86, x86_64

Blog

You can learn how to build this library through this article.

Future

Support amr format

联系我

  • Email: 1015121748@qq.com
  • QQ Group: 573830030 有时候工作很忙没空看邮件和Issue,大家可以通过QQ群联系我

    <div style="text-align: center;"> <img src="https://github.com/Jay-Goo/RangeSeekBar/blob/master/Gif/qq.png" style="margin: 0 auto;" height="250px"/> </div>

一杯咖啡

大家都知道开源是件很辛苦的事情,这个项目也是我工作之余完成的,平时工作很忙,但大家提的需求基本上我都尽量满足,如果这个项目帮助你节省了大量时间,你很喜欢,你可以给我一杯咖啡的鼓励,不在于钱多钱少,关键是你的这份鼓励所带给我的力量~

<div style="text-align: center;"> <img src="https://github.com/Jay-Goo/RangeSeekBar/blob/master/Gif/pay.png" height="200px"/> </div>

License

MIT License Copyright (c) 2018 Jay-Goo