Skip to content

Commit dd45dd5

Browse files
QimingQiming
authored andcommitted
音频处理|波形图:支持各声道分开画波形;解决一个编译警告
1 parent e77e420 commit dd45dd5

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

AndroidMedia/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
apply plugin: 'com.android.library'
33
//apply plugin: 'com.android.application'
4-
apply plugin: 'kotlin-android-extensions'
54
apply plugin: 'kotlin-android'
5+
apply plugin: 'kotlin-android-extensions'
66

77
android {
88
compileSdkVersion rootProject.ext.compileSdkVersion

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apply plugin: 'com.android.application'
2-
apply plugin: 'kotlin-android-extensions'
32
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
44

55
android {
66
compileSdkVersion rootProject.ext.compileSdkVersion

app/src/main/java/com/frank/ffmpeg/activity/AudioHandleActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class AudioHandleActivity : BaseActivity() {
261261
12 -> { // audio waveform
262262
outputPath = PATH + File.separator + "waveform.png"
263263
val resolution = "1280x720"
264-
commandLine = FFmpegUtil.showAudioWaveform(srcFile, resolution, outputPath)
264+
commandLine = FFmpegUtil.showAudioWaveform(srcFile, resolution, 1, outputPath)
265265
}
266266
13 -> { //audio encode
267267
val pcmFile = PATH + File.separator + "raw.pcm"

app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,9 +870,9 @@ public static String[] trimVideo(String inputPath, int start1, int end1, int sta
870870
return insert(trimCmd.split(" "), 2, inputPath, outputPath);
871871
}
872872

873-
public static String[] showAudioWaveform(String inputPath, String resolution, String outputPath) {
874-
String waveformCmd = "ffmpeg -i -filter_complex showwavespic=s=%s";
875-
waveformCmd = String.format(Locale.getDefault(), waveformCmd, resolution);
873+
public static String[] showAudioWaveform(String inputPath, String resolution, int splitChannels, String outputPath) {
874+
String waveformCmd = "ffmpeg -i -filter_complex showwavespic=s=%s:split_channels=%d";
875+
waveformCmd = String.format(Locale.getDefault(), waveformCmd, resolution, splitChannels);
876876
return insert(waveformCmd.split(" "), 2, inputPath, outputPath);
877877
}
878878

0 commit comments

Comments
 (0)