I have a set of images with me, I wish to run them through a loop , and save it as a video file in sdcard. Is there any default utility in android which I can use. ? Any libraries that can fulfill my requirement. ?
- stackoverflow.com/questions/13643046/…Venkatesh S– Venkatesh S2013-01-25 12:47:56 +00:00Commented Jan 25, 2013 at 12:47
- stackoverflow.com/questions/13643046/… Visit the above link ...Venkatesh S– Venkatesh S2013-01-25 12:48:36 +00:00Commented Jan 25, 2013 at 12:48
- @Shishir Shetty ... did you find any solution?Android dev– Android dev2019-02-04 09:39:50 +00:00Commented Feb 4, 2019 at 9:39
- @Androiddev I ended up using javacodegeeks.com/2011/02/… . . Please note this was like 5 years ago.Shishir Shetty– Shishir Shetty2019-02-05 18:44:44 +00:00Commented Feb 5, 2019 at 18:44
4 Answers
You need a library for creating these. There are some post here about that:
Tutorial :
Comments
There is no built in Android library that supports this functionality. This SO post suggest the use of the ffmpeg written in C/C++ via a Java port or using the Android NDK.
Comments
Used Java javacpp.jar and javacv.jar in your android project to create series of Images to Video
Below Code Use to create video
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 Comment
An object used to create frame-by-frame animations, defined by a series of Drawable objects, which can be used as a View object's background.
The simplest way to create a frame-by-frame animation is to define the animation in an XML file, placed in the res/drawable/ folder, and set it as the background to a View object. Then, call start() to run the animation.
An AnimationDrawable defined in XML consists of a single element, and a series of nested tags. Each item defines a frame of the animation. See the example below.
spin_animation.xml file in res/drawable/ folder:
<!-- 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> Here is the code to load and play this animation.
// 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();