Skip to content

Commit 81e360d

Browse files
committed
FFmpeg Video Editor.
0 parents  commit 81e360d

File tree

84 files changed

+6999
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+6999
-0
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 29
5+
buildToolsVersion "29.0.3"
6+
7+
defaultConfig {
8+
applicationId "com.aryainfotech.ffmpegvideoeditor"
9+
minSdkVersion 21
10+
targetSdkVersion 29
11+
versionCode 1
12+
versionName "1.0"
13+
14+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15+
}
16+
17+
compileOptions {
18+
sourceCompatibility JavaVersion.VERSION_1_8
19+
targetCompatibility JavaVersion.VERSION_1_8
20+
}
21+
22+
buildTypes {
23+
release {
24+
minifyEnabled false
25+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
26+
}
27+
}
28+
29+
}
30+
31+
dependencies {
32+
implementation fileTree(dir: 'libs', include: ['*.jar'])
33+
34+
implementation 'androidx.appcompat:appcompat:1.2.0'
35+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
36+
testImplementation 'junit:junit:4.12'
37+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
38+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
39+
40+
implementation 'com.google.android.material:material:1.3.0'
41+
// implementation 'com.arthenica:mobile-ffmpeg-full-gpl:4.4.LTS'
42+
43+
implementation 'com.arthenica:mobile-ffmpeg-full:4.4.LTS'
44+
45+
implementation 'org.florescu.android.rangeseekbar:rangeseekbar-library:0.3.0'
46+
implementation 'androidx.cardview:cardview:1.0.0'
47+
implementation 'commons-io:commons-io:2.8.0'
48+
49+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.aryainfotech.ffmpegvideoeditor;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
25+
assertEquals("com.aryainfotech.ffmpegvideoeditor", appContext.getPackageName());
26+
}
27+
}

app/src/main/AndroidManifest.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="com.aryainfotech.ffmpegvideoeditor">
5+
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
7+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
8+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
9+
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
10+
11+
12+
<application
13+
android:allowBackup="true"
14+
android:icon="@mipmap/ic_launcher"
15+
android:label="@string/app_name"
16+
android:largeHeap="true"
17+
android:requestLegacyExternalStorage="true"
18+
android:roundIcon="@mipmap/ic_launcher_round"
19+
android:supportsRtl="true"
20+
android:theme="@style/AppTheme"
21+
tools:ignore="AllowBackup,UnusedAttribute">
22+
<activity
23+
android:name="com.aryainfotech.ffmpegvideoeditor.activity.MainActivity"
24+
android:screenOrientation="portrait"
25+
tools:ignore="LockedOrientationActivity">
26+
<intent-filter>
27+
<action android:name="android.intent.action.MAIN" />
28+
29+
<category android:name="android.intent.category.LAUNCHER" />
30+
</intent-filter>
31+
</activity>
32+
<activity
33+
android:name="com.aryainfotech.ffmpegvideoeditor.activity.PreviewActivity"
34+
android:screenOrientation="portrait"
35+
tools:ignore="LockedOrientationActivity">
36+
37+
</activity>
38+
<activity
39+
android:name="com.aryainfotech.ffmpegvideoeditor.activity.PreviewImageActivity"
40+
android:screenOrientation="portrait"
41+
tools:ignore="LockedOrientationActivity">
42+
43+
</activity>
44+
<activity
45+
android:name="com.aryainfotech.ffmpegvideoeditor.activity.AudioPreviewActivity"
46+
android:screenOrientation="portrait"
47+
tools:ignore="LockedOrientationActivity">
48+
49+
</activity>
50+
</application>
51+
52+
</manifest>
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
package com.aryainfotech.ffmpegvideoeditor.activity;
2+
3+
import android.media.AudioManager;
4+
import android.media.MediaPlayer;
5+
import android.media.audiofx.Visualizer;
6+
import android.net.Uri;
7+
import android.os.Bundle;
8+
import android.view.MenuItem;
9+
import android.widget.TextView;
10+
11+
import com.aryainfotech.ffmpegvideoeditor.R;
12+
import com.aryainfotech.ffmpegvideoeditor.views.VisualizerView;
13+
14+
import androidx.annotation.Nullable;
15+
import androidx.appcompat.app.AppCompatActivity;
16+
17+
18+
/**
19+
* Created by Bhuvnesh on 09-03-2017.
20+
*/
21+
22+
public class AudioPreviewActivity extends AppCompatActivity {
23+
24+
private VisualizerView mVisualizerView;
25+
26+
private MediaPlayer mMediaPlayer;
27+
private Visualizer mVisualizer;
28+
private static final String FILEPATH = "filepath";
29+
30+
31+
@Override
32+
protected void onCreate(@Nullable Bundle savedInstanceState) {
33+
super.onCreate(savedInstanceState);
34+
setContentView(R.layout.activity_audio_preview);
35+
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
36+
getSupportActionBar().setDisplayShowHomeEnabled(true);
37+
38+
mVisualizerView = (VisualizerView) findViewById(R.id.visualizerView);
39+
40+
41+
}
42+
43+
@Override
44+
protected void onResume() {
45+
super.onResume();
46+
initAudio();
47+
}
48+
49+
@Override
50+
public boolean onOptionsItemSelected(MenuItem item) {
51+
// handle arrow click here
52+
if (item.getItemId() == android.R.id.home) {
53+
finish(); // close this activity and return to preview activity (if there is any)
54+
}
55+
56+
return super.onOptionsItemSelected(item);
57+
}
58+
@Override
59+
protected void onPause() {
60+
super.onPause();
61+
if (mMediaPlayer != null) {
62+
mVisualizer.release();
63+
mMediaPlayer.release();
64+
mMediaPlayer = null;
65+
}
66+
}
67+
68+
private void initAudio() {
69+
setVolumeControlStream(AudioManager.STREAM_MUSIC);
70+
String filePath = getIntent().getStringExtra(FILEPATH);
71+
TextView tvInstruction=(TextView) findViewById(R.id.tvInstruction);
72+
tvInstruction.setText("Audio stored at path "+filePath);
73+
mMediaPlayer = MediaPlayer.create(this, Uri.parse(filePath));
74+
75+
setupVisualizerFxAndUI();
76+
// Make sure the visualizer is enabled only when you actually want to
77+
// receive data, and
78+
// when it makes sense to receive data.
79+
mVisualizer.setEnabled(true);
80+
// When the stream ends, we don't need to collect any more data. We
81+
// don't do this in
82+
// setupVisualizerFxAndUI because we likely to have more,
83+
// non-Visualizer related code
84+
// in this callback.
85+
mMediaPlayer
86+
.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
87+
public void onCompletion(MediaPlayer mediaPlayer) {
88+
mVisualizer.setEnabled(false);
89+
}
90+
});
91+
mMediaPlayer.start();
92+
mMediaPlayer.setLooping(true);
93+
94+
}
95+
private void setupVisualizerFxAndUI() {
96+
97+
// Create the Visualizer object and attach it to our media player.
98+
mVisualizer = new Visualizer(mMediaPlayer.getAudioSessionId());
99+
mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
100+
mVisualizer.setDataCaptureListener(
101+
new Visualizer.OnDataCaptureListener() {
102+
public void onWaveFormDataCapture(Visualizer visualizer,
103+
byte[] bytes, int samplingRate) {
104+
mVisualizerView.updateVisualizer(bytes);
105+
}
106+
107+
public void onFftDataCapture(Visualizer visualizer,
108+
byte[] bytes, int samplingRate) {
109+
}
110+
}, Visualizer.getMaxCaptureRate() / 2, true, false);
111+
}
112+
}

0 commit comments

Comments
 (0)