How to take image for watermark from drawable folder or assets folder in Android.
I found many examples with command but all the examples are working with static image path of internal storage.
I have done following code to make video with watermark.
try {
FFmpeg ffmpeg = FFmpeg.getInstance(mContext);
// to execute "ffmpeg -version" command you just need to pass "-version"
String mSelectedPath = PathUtils.getPathFromUri(mContext, selectedUri);
String mFileName = PathUtils.getFileName(mSelectedPath);
final String mDestinationPath = "/storage/emulated/0/" + mFileName;
String[] array = new String[]{"-i", mSelectedPath , "-i", "/storage/emulated/0/logo.png", "-filter_complex", "[0:v][1:v]overlay=main_w-overlay_w-10:10", "-codec:a", "copy", mDestinationPath};
ffmpeg.execute(array, new ExecuteBinaryResponseHandler() {
@Override
public void onStart() {
Log.d(TAG, "onStart: ");
Toast.makeText(mContext, "Preparing video...", Toast.LENGTH_SHORT).show();
}
@Override
public void onProgress(String message) {
Log.d(TAG, "onProgress: " + message);
Toast.makeText(mContext, "Processing for compression...", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(String message) {
Log.d(TAG, "onFailure: " + message);
Toast.makeText(mContext, "Failed to upload, Try Again.", Toast.LENGTH_SHORT).show();
}
@Override
public void onSuccess(String message) {
Log.d(TAG, "onSuccess: " + message);
Toast.makeText(mContext, "Uploading started", Toast.LENGTH_SHORT).show();
mFinalUploadUri = PathUtils.getUriFromPath(mContext, new File(mDestinationPath));
uploadVideo();
}
@Override
public void onFinish() {
Log.d(TAG, "onFinish: ");
}
});
} catch (FFmpegCommandAlreadyRunningException e) {
// Handle if FFmpeg is already running
e.printStackTrace();
}
Anyone know how to use image for watermark from drawable or assets folder? Can anyone help?
from Android ffmpeg : Use image for Watermark from drawable or assets folder
No comments:
Post a Comment