Android , Java - Rendering a video using bitmap frames to reverse a video (Xuggler)
Asked Answered
V

2

13

I am having no of video frames in ArrayList<Bitmap>. I have accessed this frames using MediaMetadataRetriever.getFrameAtTime() method over a Video file(.mp4).

i reverse the order of frames in ArrayList. Now using this reverse ordered frame queue i want to render a video so dat it would get reversed (i hope i am on right track).

After creating that video i also want to save it to sd Card.

how to achieve this? Or Is der any other method to reverse a video in java?

Edit 1: (***Using xuggler*)**

i tried using xuggler ... i tried using it's .jar file. but it is throwing some errors.

[2012-08-18 00:29:16 - xugglertest2] The library 'xuggle-xuggler-5.2.jar' contains native libraries that will not run on the device.
    [2012-08-18 00:29:16 - xugglertest2]  The following libraries were found:
    [2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/i686-pc-linux-gnu/libxuggle-ferry.so
    [2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/i686-pc-linux-gnu/libxuggle-xuggler-io.so
    [2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/i686-pc-linux-gnu/libxuggle-xuggler.so
    [2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/i686-pc-linux-gnu/libxuggle.so
    [2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/x86_64-pc-linux-gnu/libxuggle-ferry.so
    [2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/x86_64-pc-linux-gnu/libxuggle-xuggler-io.so
    [2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/x86_64-pc-linux-gnu/libxuggle-xuggler.so
    [2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/x86_64-pc-linux-gnu/libxuggle.so

What should i do ??

i copied xuggler-xuggler-5.4.jar in libs folder of project and then add it to build path. m i doing it correctly?



Edit 2: (Using ffmpeg)
I have compiled ffmpeg for android on ubuntu platform as per given Here
I got compiled files as per the document.
Now can anybody tell me how can i use those compiled files in android application? what exactly should i do with those files??
I didn't find any suitable documentation. any help would be gr8.


Edit 3 : (Ported to android -ffmpeg)

hey.. finally i compiled ffmpeg on ubuntu i got libffmpeg.so. I ported it to android successfully. libffmpeg.so is loading in android activity successfully. Now i just want to test a simple ffmpeg command or program.
can you suggest where shall i look for it.? can you suggest me a sample command to test it.

Thanks and regards

Virology answered 12/8, 2012 at 9:59 Comment(10)
Did you solve this? Please help me, I have a similar requirement.Midway
unfortunately i haven't. i will post the solution here as soon as i solve this.Virology
if you can access the video file, can't you just copy it to the SD card? getFrameAtTime() gets you only 1 frame anyways, so I am not sure how you will construct video from it.Hunks
yes m doing it !! m getting frames !! now i want to reverse video.. so m reversing the order of frames in a queue ArrayList<Bitmap>. now i want to render a video using reversed frame queue !!Virology
i have edited my question a bit. please have a lookVirology
also checkout their how tos youtube.com/playlist?list=PL18879AD3C269291A&feature=plcpHunks
Please take a look at my edit. i compiled ffmpeg on ubuntu.Virology
about your update2 - that's why there's project like xuggler - cause you need a wrapper for ffmpeg - you can't use it directly in code, except if you run it via "Runtime.getRuntime().exec("ffmpeg <options>");" as I already stated in my answer.Hunks
please have a look at my Edit 3. I ported ffmpeg on android successfully. just need a little help testing it.Virology
Xuggler is not implemented in Android. see here #23780936Magalymagan
H
11

You can use ffmpeg to assemble video from images. You can integrate ffmpeg in Java(Android) in a couple of ways (one being directly running it via

Runtime.getRuntime().exec("ffmpeg <options>");

), but probably a good way to do it is via the Xuggler project - it heavily relies on ffmpeg. For starting point, here's a set of introduction tutorials and here's a complete tutorial how to encode video from sequence of images. It's a lot of work and reading, but all the information you need is there. Good luck!

Hunks answered 15/8, 2012 at 9:31 Comment(7)
Or, you could build ffmpeg as a shared library and link against it; write a JNI wrapper and you should be all set.Intarsia
please take a look at my problem. any help would be great. see EditVirology
try adding all jars from xuggler>share>java>jars to the build pathHunks
please have a look at my Edit 3. I ported ffmpeg on android successfully. just need a little help testing it.Virology
hey Runtime.getRuntime().exec("ffmpeg"); is giving me an error "environment null". how can i tackle it. see i have posted a question related to it here: #12130314Virology
Runtime.getRuntime().exec("ffmpeg -codecs"); is giving me errors IOException permission denied (NATIVE METHOD) !! m using compiled ffmpeg. how can i solve this?Virology
@Chaitanya Chandurkar, Have you got it working or found some other solution? if you could post Answer to your own question would be appreciated.Precise
E
0

Regarding your xuggler usage, the version of your library won't work on your specific device, as it contains native code compiled for x86_64 and i686 platforms:

[2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/i686-pc-linux-gnu/
[2012-08-18 00:29:16 - xugglertest2]  - com/xuggle/ferry/x86_64-pc-linux-gnu/

try finding version of this library with native code parts compiled for ARMv6 (most common Android architecture - includes older devices, if don't want to support devices older than ~1-2 years ago, ARMv7 would be better).

Otherwise, you'll need to get the ffmpeg compiled for ARM and use it with support of Android NDK. You'll need to write a code in C/C++ implementing encoding your series of images into a specific file and wrap it up with JNI interface. You can pass Java arrays to native implementations of class' methods.

please see sample Android NDK applications in SDK samples to see how to use JNI in your code

Eutherian answered 21/8, 2012 at 11:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.