deepmedia / deepmedia/Transcoder
Friendly API for changing speed of single video in a chain
- Dominant language
- Java
- Stars
- 864
- Forks
- 181
- PR merge metrics
- No merged PRs in 30d
Description
I have 2 videos I want to keep Speed of First video to the original speed, i.e 1 and for the second video to double speed i.e 2,
The first video is 5 seconds long, and second video is 46 seconds long, So now the video should be 28 seconds long(5+23)
however the code converts both video to double speed ,
**can we Set speed of Individual videos**
This is the code I am trying
```
mProgressView = findViewById(R.id.progress);
mProgressView.setMax(PROGRESS_BAR_MAX);
try {
File outputDir = new File(getExternalFilesDir(null), "outputs");
//noinspection ResultOfMethodCallIgnored
outputDir.mkdir();
mTranscodeOutputFile = File.createTempFile("transcode_test", ".mp4", outputDir);
} catch (IOException e) {
Toast.makeText(this, "Failed to create temporary file.", Toast.LENGTH_LONG).show();
return;
}
DataSink sink = new DefaultDataSink(mTranscodeOutputFile.getAbsolutePath());
Transcoder.into(sink)
.addDataSource(Environment.getExternalStorageDirectory() + "/Test_videos/c.mp4").
setSpeed(1).
addDataSource(Environment.getExternalStorageDirectory() + "/Test_videos/d.mp4").
setSpeed(2).
setListener(new TranscoderListener() {
public void onTranscodeProgress(double progress) {
if (progress < 0) {
mProgressView.setIndeterminate(true);
} else {
mProgressView.setIndeterminate(false);
mProgressView.setProgress((int) Math.round(progress * PROGRESS_BAR_MAX));
}
}
public void onTranscodeCompleted(int successCode) {
if (successCode == Transcoder.SUCCESS_TRANSCODED) {
Toast.makeText(abcd.this, "Success ", Toast.LENGTH_SHORT).show();
mProgressView.setIndeterminate(false);
mProgressView.setProgress(0);
} else if (successCode == Transcoder.SUCCESS_NOT_NEEDED) {
}
}
public void onTranscodeCanceled() {}
public void onTranscodeFailed(@NonNull Throwable exception) {}
}).transcode();
```
Contributor guide
Assessment
This issue has not been assessed yet.