我想通过Android中的应用程序使用sdcard中的图像创建视频。
答案 0 :(得分:1)
使用帧动画
以XML格式定义的动画,按顺序显示一系列图像(如电影)。
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot=["true" | "false"] >
<item
android:drawable="@[package:]drawable/drawable_resource_name"
android:duration="integer" />
</animation-list>
答案 1 :(得分:0)
试试这段代码,
path = Environment.getExternalStorageDirectory() + "/Testing/";
commandEditText.setText(
"-loop 1 -i "+path+"images_001.jpg " +
"-loop 1 -i "+path+"images_002.jpg " +
"-loop 1 -i "+path+"images_003.jpg " +
"-loop 1 -i "+path+"images_004.jpg " +
"-loop 1 -i "+path+"images_005.jpg " +
"-filter_complex " +
"[0:v]setsar=sar=40/33,trim=duration=1,fade=t=out:st=14.5:d=0.5[v0];" +
"[1:v]setsar=sar=40/33,trim=duration=1,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v1];" +
"[2:v]setsar=sar=40/33,trim=duration=1,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v2];" +
"[3:v]setsar=sar=40/33,trim=duration=1,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v3];" +
"[4:v]setsar=sar=40/33,trim=duration=1,fade=t=in:st=0:d=0.5,fade=t=out:st=14.5:d=0.5[v4];" +
"[v0][v1][v2][v3][v4]concat=n=5:v=1:a=0,format=yuv420p[v] -map [v] "+path+"out.mp4");
}