Skip to content

Commit 5aa313a

Browse files
committed
Remove option to extract images
This can be reworked and added back later, if it is found to be useful.
1 parent 665eeaa commit 5aa313a

File tree

2 files changed

+0
-75
lines changed

2 files changed

+0
-75
lines changed

app/src/main/java/protect/videotranscoder/activity/MainActivity.java

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ protected void onCreate(Bundle savedInstanceState)
7373
final TextView uploadVideo = findViewById(R.id.uploadVideo);
7474
TextView cutVideo = findViewById(R.id.cropVideo);
7575
TextView compressVideo = findViewById(R.id.compressVideo);
76-
TextView extractImages = findViewById(R.id.extractImages);
7776

7877
tvLeft = findViewById(R.id.tvLeft);
7978
tvRight = findViewById(R.id.tvRight);
@@ -147,22 +146,6 @@ public void onClick(View v)
147146
}
148147
});
149148

150-
extractImages.setOnClickListener(new View.OnClickListener()
151-
{
152-
@Override
153-
public void onClick(View v)
154-
{
155-
if (selectedVideoUri != null)
156-
{
157-
extractImagesVideo(rangeSeekBar.getSelectedMinValue().intValue() * 1000, rangeSeekBar.getSelectedMaxValue().intValue() * 1000);
158-
}
159-
else
160-
{
161-
Snackbar.make(mainlayout, "Please upload a video", 4000).show();
162-
}
163-
164-
}
165-
});
166149
extractAudio.setOnClickListener(new View.OnClickListener()
167150
{
168151
@Override
@@ -496,52 +479,6 @@ private void executeCompressCommand()
496479
videoView.pause();
497480
}
498481

499-
/**
500-
* Command for extracting images from video
501-
*/
502-
private void extractImagesVideo(int startMs, int endMs)
503-
{
504-
File moviesDir = Environment.getExternalStoragePublicDirectory(
505-
Environment.DIRECTORY_PICTURES
506-
);
507-
508-
String filePrefix = "extract_picture";
509-
String fileExtn = ".jpg";
510-
String yourRealPath = getPath(MainActivity.this, selectedVideoUri);
511-
512-
File dir = new File(moviesDir, "VideoEditor");
513-
int fileNo = 0;
514-
while (dir.exists())
515-
{
516-
fileNo++;
517-
dir = new File(moviesDir, "VideoEditor" + fileNo);
518-
519-
}
520-
521-
boolean result = dir.mkdir();
522-
if(result == false)
523-
{
524-
Toast.makeText(this, "Failed to create directory", Toast.LENGTH_LONG).show();
525-
return;
526-
}
527-
528-
filePath = dir.getAbsolutePath();
529-
File dest = new File(dir, filePrefix + "%03d" + fileExtn);
530-
531-
Log.d(TAG, "startTrim: src: " + yourRealPath);
532-
Log.d(TAG, "startTrim: dest: " + dest.getAbsolutePath());
533-
534-
/* Remove -r 1 if you want to extract all video frames as images from the specified time duration.*/
535-
536-
String[] complexCommand = {"-y", "-i", yourRealPath, "-an", "-r", "1", "-ss", "" + startMs / 1000, "-t", "" + (endMs - startMs) / 1000, dest.getAbsolutePath()};
537-
538-
FFmpegResponseHandler handler = new FFmpegResponseHandler(this, durationMs, progressDialog, _transcodeResultHandler);
539-
FFmpegUtil.call(complexCommand, handler);
540-
541-
stopPosition = videoView.getCurrentPosition(); //stopPosition is an int
542-
videoView.pause();
543-
}
544-
545482
/**
546483
* Command for extracting audio from video
547484
*/

app/src/main/res/layout/activity_main.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,6 @@
114114
android:textColor="#FFFFFF"
115115
android:textSize="@dimen/sp16" />
116116

117-
<TextView
118-
android:id="@+id/extractImages"
119-
android:layout_width="0dp"
120-
android:layout_height="match_parent"
121-
android:layout_weight="1"
122-
android:background="@drawable/extract_images_selector"
123-
android:gravity="center"
124-
android:padding="@dimen/dp2"
125-
android:text="@string/extractImages"
126-
android:textColor="#FFFFFF"
127-
android:textSize="@dimen/sp16" />
128-
129117
<TextView
130118
android:id="@+id/extractAudio"
131119
android:layout_width="0dp"

0 commit comments

Comments
 (0)