几年前,我使用以下bash脚本从mp3和一个图像中获取视频(因此视频中的图像在mp3的长度上被冻结),这很好.
i=0;
for file in *.mp3;
do
i=$((i+1));
ffmpeg -loop 1 -shortest -y -i image.jpg -i $file -acodec copy -vcodec libx264 $file.flv;
done
Run Code Online (Sandbox Code Playgroud)
现在我想再次使用它来做同样的事情.
问题:
它不会在mp3结束时停止转换.表示当前的mp3文件,例如.有3分钟的长度,脚本转换为永远或我停止它,所以flv的长度远远大于3分钟.
(ffmpeg已安装,但与libav相同)
输出:
ffmpeg version 1.2.6-7:1.2.6-1~trusty1 Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 26 2014 18:52:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --arch=amd64 --disable-stripping --enable-avresample --enable-pthreads --enable-runtime-cpudetect --extra-version='7:1.2.6-1~trusty1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx …Run Code Online (Sandbox Code Playgroud) 我有跟随动画来飞入我的ListView中的项目:
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="500"
android:fromYDelta="100%p"
android:toYDelta="0" />
<alpha
android:duration="500"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>
Run Code Online (Sandbox Code Playgroud)
并在我的适配器中的getView()末尾使用以下命令启动它:
Animation animation = AnimationUtils.loadAnimation(
MainActivity.myContext, R.anim.push_up_in);
vi.startAnimation(animation);
animation = null;
Run Code Online (Sandbox Code Playgroud)
它的作用:在应用程序开始时,它会立即在一个块中立即可见的项目中.通过滚动每个新项目单独飞行.
我想要的是:每个项目都应该在应用程序的开头单独飞行- 就像通过滚动一样.
我尝试了什么:根据项目位置设置AnimationDuration:
if (position < 6){
animation.setDuration(500 * position);
} else {
animation.setDuration(100*position); //Because it get's too slow by staying with 500 * position
}
Run Code Online (Sandbox Code Playgroud)
这或多或少都有效 - 但是当屏幕可以容纳超过6个我认为的项目时,它看起来并不流畅.
有没有一种简单的方法来获得每个项目更流畅的飞行?
提前致谢!
animation android listview android-animation android-listview