Skip to content

Commit

Permalink
更新到ffmpeg4.2.2,添加x86_64的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
YANGJIE8 committed May 22, 2020
1 parent c2915c3 commit c49f40f
Show file tree
Hide file tree
Showing 33 changed files with 81 additions and 12 deletions.
13 changes: 7 additions & 6 deletions joevideolib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
minSdkVersion 16
targetSdkVersion 25
targetSdkVersion 27
versionCode 1
versionName "1.0"
versionName "1.1"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

Expand All @@ -26,11 +26,12 @@ android {
sourceSets {
main {
jniLibs.srcDirs = ['libs']

}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-annotations:25.1.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'com.android.support:support-annotations:25.1.1'
}
Binary file removed joevideolib/libs/arm64-v8a/libavcodec.so
Binary file not shown.
Binary file removed joevideolib/libs/arm64-v8a/libavdevice.so
Binary file not shown.
Binary file removed joevideolib/libs/arm64-v8a/libavfilter.so
Binary file not shown.
Binary file removed joevideolib/libs/arm64-v8a/libavformat.so
Binary file not shown.
Binary file removed joevideolib/libs/arm64-v8a/libavutil.so
Binary file not shown.
Binary file removed joevideolib/libs/arm64-v8a/libffmpeg.so
Binary file not shown.
Binary file removed joevideolib/libs/arm64-v8a/libpostproc.so
Binary file not shown.
Binary file removed joevideolib/libs/arm64-v8a/libswresample.so
Binary file not shown.
Binary file removed joevideolib/libs/arm64-v8a/libswscale.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi-v7a/libavcodec.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi-v7a/libavdevice.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi-v7a/libavfilter.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi-v7a/libavformat.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi-v7a/libavutil.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi-v7a/libffmpeg.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi-v7a/libpostproc.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi-v7a/libswresample.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi-v7a/libswscale.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi/libavcodec.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi/libavdevice.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi/libavfilter.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi/libavformat.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi/libavutil.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi/libffmpeg.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi/libpostproc.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi/libswresample.so
Binary file not shown.
Binary file removed joevideolib/libs/armeabi/libswscale.so
Binary file not shown.
4 changes: 3 additions & 1 deletion joevideolib/src/main/java/Jni/FFmpegCmd.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package Jni;

import android.support.annotation.Keep;
import android.support.annotation.VisibleForTesting;

import VideoHandle.OnEditorListener;

Expand All @@ -21,7 +22,7 @@ public class FFmpegCmd {
System.loadLibrary("swscale");
System.loadLibrary("avfilter");
System.loadLibrary("avdevice");
System.loadLibrary("ffmpeg");
System.loadLibrary("ffmpeg-exec");
}

private static OnEditorListener listener;
Expand All @@ -38,6 +39,7 @@ public class FFmpegCmd {
public static native int exec(int argc, String[] argv);

@Keep
@VisibleForTesting
public static native void exit();

@Keep
Expand Down
3 changes: 3 additions & 0 deletions joevideolib/src/main/java/Jni/TrackUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

public class TrackUtils {

private TrackUtils() {
}

private static final String TAG = "TrackUtils";

/**
Expand Down
31 changes: 27 additions & 4 deletions joevideolib/src/main/java/Jni/VideoUitls.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.media.MediaFormat;

/**
* Created by 杨杰 on 2017/3/21.
* Created by Yj on 2017/3/21.
* 获取音频或视频的信息
*/

Expand All @@ -17,16 +17,16 @@ private VideoUitls() {
* 获取视频信息
*
* @param url
* @return 视频时长(单位微秒)
* @return 视频时长(单位微秒)
*/
public static long getDuration(String url) {
try {
MediaExtractor mediaExtractor = new MediaExtractor();
mediaExtractor.setDataSource(url);
int videoExt = TrackUtils.selectVideoTrack(mediaExtractor);
if(videoExt == -1){
if (videoExt == -1) {
videoExt = TrackUtils.selectAudioTrack(mediaExtractor);
if(videoExt == -1){
if (videoExt == -1) {
return 0;
}
}
Expand All @@ -38,4 +38,27 @@ public static long getDuration(String url) {
return 0;
}
}

/**
* 获取音轨数量
*
* @param url
* @return
*/
public static int getChannelCount(String url) {
try {
MediaExtractor mediaExtractor = new MediaExtractor();
mediaExtractor.setDataSource(url);
int audioExt = TrackUtils.selectAudioTrack(mediaExtractor);
if (audioExt == -1) {
return 0;
}
MediaFormat mediaFormat = mediaExtractor.getTrackFormat(audioExt);
int channel = mediaFormat.containsKey(MediaFormat.KEY_CHANNEL_COUNT) ? mediaFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT) : 1;
mediaExtractor.release();
return channel;
} catch (Exception e) {
return 0;
}
}
}
40 changes: 40 additions & 0 deletions joevideolib/src/main/java/VideoHandle/AudioOptions.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package VideoHandle;

public class AudioOptions {
private int sampleRates = 44100;//采样率
private float volume = 1.0f;
private String startTime;
private String duration;

public int getSampleRates() {
return sampleRates;
}

public void setSampleRates(int sampleRates) {
this.sampleRates = sampleRates;
}

public float getVolume() {
return volume;
}

public void setVolume(float volume) {
this.volume = volume;
}

public String getStartTime() {
return startTime;
}

public void setStartTime(String startTime) {
this.startTime = startTime;
}

public String getDuration() {
return duration;
}

public void setDuration(String duration) {
this.duration = duration;
}
}
2 changes: 1 addition & 1 deletion joevideolib/src/main/java/VideoHandle/EpEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public static void merge(List<EpVideo> epVideos, OutputOption outputOption, OnEd
* @param onEditorListener 回调监听
*/
public static void mergeByLc(Context context, List<EpVideo> epVideos, OutputOption outputOption, final OnEditorListener onEditorListener) {
String appDir = context.getFilesDir().getAbsolutePath() + "/EpVideos/";
String appDir = context.getCacheDir().getAbsolutePath() + "/EpVideos/";
String fileName = "ffmpeg_concat.txt";
List<String> videos = new ArrayList<>();
for (EpVideo e : epVideos) {
Expand Down

0 comments on commit c49f40f

Please sign in to comment.