Skip to content

Commit 44b6dd3

Browse files
committed
Correct progress if video is cut
The entire video duration was used to calculate progress instead of the part of the video which is being processed.
1 parent 4aa1ce3 commit 44b6dd3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,12 @@ private void startEncode()
331331
}
332332

333333
int endTimeSec = rangeSeekBar.getSelectedMaxValue().intValue();
334+
int durationSec = endTimeSec - startTimeSec;
334335
if( (videoInfo.durationMs)/1000 != endTimeSec)
335336
{
336337
// Duration of media file
337338
command.add("-t");
338-
command.add(Integer.toString(endTimeSec - startTimeSec));
339+
command.add(Integer.toString(durationSec));
339340
}
340341

341342
if(container.supportedVideoCodecs.size() > 0)
@@ -389,7 +390,7 @@ private void startEncode()
389390
// Output file
390391
command.add(destination.getAbsolutePath());
391392

392-
FFmpegResponseHandler handler = new FFmpegResponseHandler(videoInfo.durationMs, progressBar, _transcodeResultHandler);
393+
FFmpegResponseHandler handler = new FFmpegResponseHandler(durationSec*1000, progressBar, _transcodeResultHandler);
393394
FFmpegUtil.call(command.toArray(new String[command.size()]), handler);
394395

395396
stopVideoPlayback();

0 commit comments

Comments
 (0)