Reputation: 31
Did we can use ffmpeg command like (screenrecord, screenshot) in android programmatically.
for example ffmpeg -r 24 -f rawvideo -pix_fmt rgb565le -s 320x480 -i /dev/graphics/fb0 -vcodec libx264 /sdcard/videokit/screen.mp4
Upvotes: 2
Views: 1151
Reputation: 5361
You can compile FFmpeg (it's named AVConv after latest update) with optimization for mobile CPU like arm6/arm7. We did so for Android during several years. Yes it has no hardware acceleration - which means low FPS. But it still useful. To use HW accelerated encoding there is only one way for now - Java API from Android SDK (OS 4.1.2 and above).
1) Compile FFMpeg as shared library using Android NDK. You can try this: https://github.com/guardianproject/android-ffmpeg
Or my own build script (i think little bit outdated now): https://dl.dropboxusercontent.com/u/76581728/build_android_r7.sh
Suggest you to use latest Android NDK.
2) To apply this console options you have to pass this option to FFMpeg AVDictionary structure in your native code. It's pretty simple. You have to lock inside ffmpeg.c source file and also you can analyse how desktop version of ffmpeg works using breakpoints inside Netbeans IDE (very helpful).
av_opt_set(oc->priv_data, "f", "rawvideo", 0);
3) I think you will have trouble as I know with accessing /dev/graphics/fb0 in NOT rooted devices because of Android security.
Upvotes: 3