2

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

4
  • You can by compiling the entire ffmpeg.c for android, but it is not going to work very fast. Commented Sep 3, 2014 at 6:30
  • thanks, any guide mean link. I have use the FfmpegFrameRecorder to convert images into video but it take time to convert image into videos. I capture images of my application and then convert into video but take time. Commented Sep 3, 2014 at 6:40
  • then I decide to use the command in android programmatically for directly recrod the screen. instead take image and then convert into video. Commented Sep 3, 2014 at 6:42
  • It won't be any faster, probably even slower. I'd google for an android ffmpeg build. There are plenty of hits. Commented Sep 3, 2014 at 7:04

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.