diff --git a/app/src/main/java/com/frank/ffmpeg/activity/AudioHandleActivity.kt b/app/src/main/java/com/frank/ffmpeg/activity/AudioHandleActivity.kt
index ac30485..f73437e 100644
--- a/app/src/main/java/com/frank/ffmpeg/activity/AudioHandleActivity.kt
+++ b/app/src/main/java/com/frank/ffmpeg/activity/AudioHandleActivity.kt
@@ -104,7 +104,8 @@ class AudioHandleActivity : BaseActivity() {
R.id.btn_pcm_concat,
R.id.btn_audio_speed,
R.id.btn_audio_echo,
- R.id.btn_audio_tremolo
+ R.id.btn_audio_tremolo,
+ R.id.btn_audio_denoise
)
}
@@ -235,6 +236,11 @@ class AudioHandleActivity : BaseActivity() {
val tremoloPath = PATH + File.separator + "tremolo.mp3"
commandLine = FFmpegUtil.audioTremolo(srcFile, frequency, depth, tremoloPath)
}
+ R.id.btn_audio_denoise
+ -> {
+ val noisePath = PATH + File.separator + "denoise.mp3"
+ commandLine = FFmpegUtil.audioDenoise(srcFile, noisePath)
+ }
else -> {
}
}
diff --git a/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java b/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java
index 9303013..0015ee2 100644
--- a/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java
+++ b/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java
@@ -120,6 +120,22 @@ public class FFmpegUtil {
return tremoloCmd.split(" ");
}
+ /**
+ * Denoise audio samples with FFT
+ *
+ * @param inputPath input file
+ * @param outputPath output file
+ * @return mix success or not
+ */
+ public static String[] audioDenoise(String inputPath, String outputPath) {
+ // nr: noise reduction in dB, [0.01 to 97], Default value is 12 dB
+ // nf: noise floor in dB, [-80 to -20], Default value is -50 dB
+ // nt: noise type {w:white noise v:vinyl noise s:shellac noise}
+ String fftDenoiseCmd = "ffmpeg -i %s -af afftdn %s";
+ fftDenoiseCmd = String.format(Locale.getDefault(), fftDenoiseCmd, inputPath, outputPath);
+ return fftDenoiseCmd.split(" ");
+ }
+
/**
* mux audio and video together
*
diff --git a/app/src/main/res/layout/activity_audio_handle.xml b/app/src/main/res/layout/activity_audio_handle.xml
index 32dfabe..003861c 100644
--- a/app/src/main/res/layout/activity_audio_handle.xml
+++ b/app/src/main/res/layout/activity_audio_handle.xml
@@ -90,6 +90,13 @@
android:text="@string/audio_tremolo"
android:layout_marginTop="10dp" />
+
+
Audio speed
Echo effect
Tremolo effect
+ Audio denoise
Audio effect
Audio equalizer:
Audio style:
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d438f6f..d5790bc 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -3,7 +3,7 @@
音频转码
音频剪切
音频合并
- 音频混合
+ 音乐混音
音频解码AudioTrack播放
音频解码OpenSL播放
PCM编码
@@ -11,6 +11,7 @@
音频速度
空灵效果
惊悚效果
+ 音频降噪
音乐均衡器
均衡器:
风格: