音频处理|波形图:支持各声道分开画波形;解决一个编译警告

pull/221/head
Qiming 2 years ago
parent e77e4202e3
commit dd45dd5aa2
  1. 2
      AndroidMedia/build.gradle
  2. 2
      app/build.gradle
  3. 2
      app/src/main/java/com/frank/ffmpeg/activity/AudioHandleActivity.kt
  4. 6
      app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java

@ -1,8 +1,8 @@
apply plugin: 'com.android.library'
//apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.ext.compileSdkVersion

@ -1,6 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion rootProject.ext.compileSdkVersion

@ -261,7 +261,7 @@ class AudioHandleActivity : BaseActivity() {
12 -> { // audio waveform
outputPath = PATH + File.separator + "waveform.png"
val resolution = "1280x720"
commandLine = FFmpegUtil.showAudioWaveform(srcFile, resolution, outputPath)
commandLine = FFmpegUtil.showAudioWaveform(srcFile, resolution, 1, outputPath)
}
13 -> { //audio encode
val pcmFile = PATH + File.separator + "raw.pcm"

@ -870,9 +870,9 @@ public class FFmpegUtil {
return insert(trimCmd.split(" "), 2, inputPath, outputPath);
}
public static String[] showAudioWaveform(String inputPath, String resolution, String outputPath) {
String waveformCmd = "ffmpeg -i -filter_complex showwavespic=s=%s";
waveformCmd = String.format(Locale.getDefault(), waveformCmd, resolution);
public static String[] showAudioWaveform(String inputPath, String resolution, int splitChannels, String outputPath) {
String waveformCmd = "ffmpeg -i -filter_complex showwavespic=s=%s:split_channels=%d";
waveformCmd = String.format(Locale.getDefault(), waveformCmd, resolution, splitChannels);
return insert(waveformCmd.split(" "), 2, inputPath, outputPath);
}

Loading…
Cancel
Save