我有一組圖像與我,我希望通過循環運行它們,並將其保存爲SD卡中的視頻文件。有沒有我可以使用的Android的任何默認工具。 ?任何可以滿足我的要求的圖書館。 ?將圖像轉換爲Android中的單個視頻文件
回答
您需要一個庫來創建這些庫。這裏有一些職位有關:
教程:
有在支持此功能Android
庫沒有內置。 This SO post建議使用通過Java端口或使用Android NDK
以C/C++編寫的ffmpeg
。
用於創建逐幀動畫的對象,由一系列Drawable對象定義,可用作View對象的背景。
創建逐幀動畫的最簡單方法是在XML文件中定義動畫,放置在res/drawable /文件夾中,並將其設置爲View對象的背景。然後,調用start()來運行動畫。
XML中定義的AnimationDrawable由單個元素和一系列嵌套標籤組成。每個項目定義了動畫的一個框架。看下面的例子。在res /繪製/文件夾
spin_animation.xml文件:
<!-- Animation frames are wheel0.png -- 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>
這裏是加載和播放這個動畫的代碼。
// Load the ImageView that will host the animation and
// set its background to our AnimationDrawable XML resource.
ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image);
img.setBackgroundResource(R.drawable.spin_animation);
// Get the background, which has been compiled to an AnimationDrawable object.
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
// Start the animation (looped playback by default).
frameAnimation.start();
謝謝@Aakash,但你打算如何保存它作爲一個視頻文件? –
該代碼不能在我的電腦上工作 – deepak825
使用的Java javacpp.jar
和javacv.jar
在你的Android項目創建一系列圖像視頻
下面的代碼用於創建視頻
recorder = new FFmpegFrameRecorder("Videofilename", 480, 480);
try {
recorder.setVideoCodec(13);
recorder.setFrameRate(0.4d);
recorder.setPixelFormat(0);
recorder.setVideoQuality(1.0d);
recorder.setVideoBitrate(4000);
startTime = System.currentTimeMillis();
recorder.start();
int time = Integer.parseInt(params[0]);
resp = "Slept for " + time + " milliseconds";
for (int i = 0; i < iplimage.length; i++) {
long t = 1000 * (System.currentTimeMillis() - startTime);
if (t < recorder.getTimestamp()) {
t = recorder.getTimestamp() + 1000;
}
recorder.setTimestamp(t);
recorder.record(iplimage[i]);
}
} catch (Exception e) {
e.printStackTrace();
}
- 1. FFmpeg將單個圖像轉換爲視頻Android
- 2. 將MicrosoftOffice Docs + PDF +圖像++音頻/視頻轉換爲SWF文件
- 3. 在MATLAB中將圖像文件轉換爲AVI視頻
- 4. Android中的圖像轉換爲視頻轉換器
- 5. 如何將圖像轉換爲android中的視頻
- 6. 如何將視頻流轉換爲android中的圖像?
- 7. 將視頻文件字節[]或緩衝區轉換爲Android的位圖,從視頻文件獲取圖像
- 8. 將圖像轉換爲視頻
- 9. 將PNG圖像轉換爲視頻
- 10. 將圖像轉換爲視頻
- 11. FFMpeg:將圖像轉換爲視頻
- 12. 將圖像序列轉換爲視頻
- 13. 將視頻文件轉換爲等長的圖像序列?
- 14. 如何在android中使用javacv將圖像轉換爲視頻?
- 15. ffmpeg將視頻轉換爲圖像,同時正在編寫視頻文件
- 16. 如何將Bystream視頻轉換爲java中的文件視頻
- 17. 轉換圖像序列的視頻文件的Android的Java
- 18. 在Android中將GIF轉換爲視頻
- 19. 如何將圖像文件轉換爲Android中的pdf文件
- 20. 將視頻文件m4v轉換爲NSData
- 21. 將圖像轉換爲視頻文件,同時保持相同的文件名?
- 22. 在Android設備中轉碼音頻/視頻/圖像文件
- 23. 將視頻視圖轉換爲位圖android
- 24. 將靜止圖像轉換爲帶有轉場的視頻
- 25. 我想將圖像序列轉換爲SD卡中的視頻
- 26. 通過iphone中的ffmpeg將視頻轉換爲圖像?
- 27. 如何將視頻轉換爲iPhone中的GIF圖像?
- 28. 如何將圖像轉換爲Windows Phone 7中的視頻
- 29. 如何將視頻轉換爲C#中的圖像?
- 30. 如何將圖像轉換爲android中的文本轉換器?
http://stackoverflow.com/questions/13643046/how-to-convert-images-into-video-in-android-using-javacv –
http://stackoverflow.com/questions/13643046/how-to-convert-images-into-video-in-android-using -javacv 訪問上面的鏈接... –