How do you capture video from the camera on command-line of a rooted Android mobile device?
2 Answers
Depending on the recording app installed, that could be done by calling the corresponding activity via the am
(activity manager). The syntax for this is explained on the ADB help page:
start [options] <INTENT>
Example given:
am start -a android.intent.action.VIEW
This means, you first have to find the corresponding intent. This can be done using any Manifest browser (there are several apps available), or e.g. using the activity browser integrated with Apex Launcher (long-tap free space on homescreen, select Shortcut, then Activity). The am
call then can either be initiated from within a terminal in the way described above, or via ADB by prefixing the call with adb shell
, e.g. adb shell am start -a android.intent.action.VIEW
.
See also: http://en.androidwiki.com/wiki/ADB_Shell_Command_Reference
-
1Another way to get the activity is: launch the camera in video capture mode manually and then do
adb shell dumpsys activity | grep mFocusedActivity
to see the corresponding activity. Or doadb shell dumpsys activity recents | grep -A15 "Recent #0"
(replace 'recents' with 'activities' for Android 4.2.1) and see the intent or activities responsible for video mode.– Firelord ♦Commented Aug 12, 2015 at 6:22
This worked for me,
adb shell am start -a android.media.action.VIDEO_CAPTURE
However, this did NOT start the recording, so it's kind of undesirable.
I did open an issue upstream to ask the author of Open Camera if this would be possbile