我想制作我的自定义媒体播放器并需要视频的方向信息(用于检测它是从前置或后置摄像头录制的).对于jpeg图像我可以使用,ExifInterface.TAG_ORIENTATION但对于视频如何我可以找到这些信息.
我试图从视频文件中获取帧并将其转换为jpeg但是它总是0在所有情况下提供方向.
请帮我.提前致谢.
我尝试了这种图像的捏缩放功能.它工作正常,但我如何实现相机预览的捏缩放功能.请帮我.提前致谢.
我有一个图像的MediaStore.Images.Media.DATA uri如何使用该uri获取MediaStore.Images.ImageColumns.ORIENTATION?我得到一个NullPointerException.
以下是我的代码,
private int getOrientation(Context context, Uri photoUri) {
Log.v("orientatioon", "not crashed01");
Cursor cursor = context.getContentResolver().query(photoUri,
new String[] { MediaStore.Images.ImageColumns._ID,MediaStore.Images.ImageColumns.ORIENTATION }, null, null, null);
Log.v("orientatioon", "not crashed02");
cursor.moveToFirst();
Log.v("orientatioon", "not crashed 03");
int i=cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns.ORIENTATION));
Log.v("orientatioon", ""+i);
cursor.close();
return i;
}
Run Code Online (Sandbox Code Playgroud)
我得到一个NullPointerException在cursor.moveToFirst()代码行.
我正在使用 FFmpeg 在 android 中进行视频编辑。我可以使用以下命令修剪、裁剪和添加叠加层:
对于修剪:
command = new String[]{"-i",inputVideoFilePath,"-ss","00:00:30.0","-c","copy","-t","00:00:10.0",outputVideoFilePath};
Run Code Online (Sandbox Code Playgroud)
作物:
command = new String[]{"-i",inputVideoFilePath,"-preset", "ultrafast","-filter:v","crop=400:400:0:0","-c:a","copy", outputVideoFilePath};
Run Code Online (Sandbox Code Playgroud)
对于叠加:
command = new String[]{"-i",inputVideoFilePath, "-i",overlayImagePath,"-preset", "ultrafast","-filter_complex", "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2", "-codec:a", "copy", outputVideoFilePath};
Run Code Online (Sandbox Code Playgroud)
但我无法将这些命令合并为一个命令。请帮我。