对于一个项目,我必须逐帧对视频进行一些操作(如视频上的绘图元素)。是否有方法允许我在Android上逐帧执行操作?
答案 0 :(得分:0)
如果你有框架,你可以使用Android的逐帧动画技术。
<!-- Animation frames are wheel0.png through wheel5.png
files inside the res/drawable/ folder -->
<animation-list android:id="@+id/selected" android:oneshot="false">
<item android:drawable="@drawable/wheel0" android:duration="50" />
<item android:drawable="@drawable/wheel1" android:duration="50" />
<item android:drawable="@drawable/wheel2" android:duration="50" />
<item android:drawable="@drawable/wheel3" android:duration="50" />
<item android:drawable="@drawable/wheel4" android:duration="50" />
<item android:drawable="@drawable/wheel5" android:duration="50" />
</animation-list>
使用imageview播放这些帧。
ImageView img =(ImageView)findViewById(R.id.spinning_wheel_image); img.setBackgroundResource(R.drawable.spin_animation); AnimationDrawable frameAnimation =(AnimationDrawable)img.getBackground();
//启动动画(默认循环播放)。 frameAnimation.start();
参考。
https://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html