Package: recdroidvid
reddroidvidMonitor and record video from Android devices remotely, pulling, renaming, and
optionally previewing the videos when recording stops.  Has very basic integration
capability with DAW software (Ardour is currently the default setting).Currently only works over USB (via the ADB interface).  Only tested with
OpenCamera on Android, controlled from Linux.  (Windows could work in
principle, but there are various Linux-specific commands which would need to be
replaced.) No attempt is made to unlock a locked phone.Disclaimer:  This is beta-level software that works for what I need it to do.
It is, however, written fairly generally to be customizable.Screenshot of the program being used to record music a performance:InstallationThe easiest way to install the basic program is to install from PyPI using pip:pipinstallrecdroidvidDependenciesThe required and optional dependencies are described below.scrcpyThe scrcpy program needs to be installed and set up to be runnable via USB.  It
functions as the computer-screen monitor for what is being recorded on the
phone.  (All the actual recording is done on the phone, however.) The program
is available in many linux repos, or can be compiled from the scrcpy site
athttps://github.com/Genymobile/scrcpy.On Ubuntu the command to install from the repos is:sudoaptinstallscrcpyInstalling via snap is also possible (and may be a more recent version):sudosnapinstallscrcpysnapconnectscrcpy:cameraSetup requires that developer mode be activated on the mobile device to allow
ADB commands via USB:Go toSettings > About phoneand tap theBuild numberat the bottom
seven times to activate developer mode.Then go toSettings > System > Advanced > Developer Optionsand turn on
USB debugging.Connect the mobile device via USB and authorize it on the Android
notification.See the scrcpy Github page for more information.  Usescrcpy--help| morefor information about the available options.ffmpegThe ffmpeg program is used to print out information about the pulled movies, as
well as to optionally extract audio from the video files:sudoaptinstallffmpegpreviewingPreviewing by default assumes the mpv movie player is installed (though there is an
option to set any movie player program from the command line):sudoaptinstallmpvOptions and CustomizationTo see the command-line options, runrecdroidvid--help| more.  The output
of that command follows.  Note that any options can also be set in the config
file~/.recdroidvid_rc.py.  The file will be imported and the strings on the
listrdv_optionswill be used as the default command-line options.  See the
example config file.usage: recdroidvid [-h] [–scrcpy-cmd CMD-STRING] [–numbering-start INTEGER][–loop] [–autorecord] [–preview-video]
[–preview-video-cmd CMD-STRING]
[–preview-video-cmd-jack CMD-STRING]
[–date-and-time-in-video-name]
[–sync-daw-transport-with-video-recording]
[–toggle-daw-transport-cmd CMD-STRING]
[–add-daw-mark-on-transport-start]
[–add-daw-mark-cmd CMD-STRING]
[–raise-daw-on-camera-app-open]
[–raise-daw-on-transport-toggle]
[–raise-daw-to-top-cmd CMD-STRING]
[–is-daw-running-cmd CMD-STRING] [–audio-extract]
[–camera-save-dir DIRPATH]
[–camera-package-name PACKAGENAME]
[–config-conditional STRING]
[PREFIXSTRING]Record a video on mobile via ADB and pull result. All config options can be
set in a file.recdroidvid_rc.py. The file is evaluated and the listrdv_optionsin the file is used as the options list. See the example config
file.positional arguments:PREFIXSTRING          The basename or prefix of the pulled video file.Whether name or prefix depends on the method used to
record.optional arguments:-h,--helpshow this help message and exit--scrcpy-cmdCMD-STRING,-yCMD-STRINGThe command, including arguments, to be used to launch
the scrcpy program. Otherwise a default version is
used with some common arguments. Note that the string--window-title=RDV_SCRCPY_TITLEcan be used to
substitute-in a more descriptive title for the window.--numbering-startINTEGER,-nINTEGERThe number at which to start numbering pulled videos.
The number is currently appended to the user-defined
prefix and defaults to 1. Allows for restarting and
continuing a naming sequence across invocations of the
program.--loop,-lLoop the recording, querying between invocations ofscrcpyas to whether or not to continue. This allows
for shutting down the scrcpy display to save both
local CPU and remote device memory (videos are
downloaded and deleted from the device at the end of
each loop), but then restarting with the same options.
Video numbering (as included in the filename) is
automatically incremented over all the videos, across
loops.--autorecord,-aAutomatically start recording when the scrcpy monitor
starts up.--preview-video,-pPreview each video that is downloaded. Currently uses
the mpv program.--preview-video-cmdCMD-STRINGThe command used to invoke a movie player to view the
preview. The default uses the mpv movie viewer. The
string ‘RDV_PREVIEW_FILENAME’, if present in the
command, will be replaced with the title of the video
being previewed.--preview-video-cmd-jackCMD-STRINGThe command used to invoke a movie player to view the
preview when the jack audio system is detected to be
running. The default uses the mpv movie viewer. The
string ‘RDV_PREVIEW_FILENAME’, if present in the
command, will be replaced with the title of the video
being previewed.--date-and-time-in-video-name,-tInclude the date and time in the video names in a
readable format.--sync-daw-transport-with-video-recording,-sStart the DAW transport when video recording is
detected on the mobile device. May increase CPU loads
on the computer and the mobile device.--toggle-daw-transport-cmdCMD-STRINGA system command to toggle the DAW transport. Used
when the--sync-to-dawoption is chosen. The default
uses xdotool to send a space-bar character to Ardour.--add-daw-mark-on-transport-start,-mWhether to add a mark in the DAW when the transport
starts, to help in syncing with the video.--add-daw-mark-cmdCMD-STRINGA system command to add a mark to the DAW at the
playhead. The default uses xdotool to send a tab
character to Ardour.--raise-daw-on-camera-app-open,-qRaise the DAW to the top of the window stack when the
camara app is opened on the mobile device. Works well
when scrcpy is also passed the--always-on-topoption.--raise-daw-on-transport-toggle,-rRaise the DAW to the top of the window stack whenever
the DAW transport is toggled by the--sync-to-dawoption. Works well when scrcpy is also passed the--always-on-topoption.--raise-daw-to-top-cmdCMD-STRINGA system command to raise the DAW windows to the top
of the window stack. Used when either of the--raise_daw_on_camera_app_openor--raise-daw-on-
transport-toggleoptions are selected. The default
uses xdotool to activate any Ardour windows.--is-daw-running-cmdCMD-STRINGA system command to test if the DAW is actually
running. A zero return code means it is, and a nonzero
return code means it isn’t.--audio-extract,-wExtract a separate audio file (currently always a WAV
file) from each video.--camera-save-dirDIRPATH,-dDIRPATHThe directory on the remote device where the camera
app saves videos. Record a video and look at the
information about the video to find the path. Defaults
to the OpenCamera default save directory.--camera-package-namePACKAGENAME,-cPACKAGENAMEThe Android package name of the camera app. Defaults
to “net.sourceforge.opencamera”, the OpenCamera
package name. Look in the URL of the app’s PlayStore
web site to find this string.--config-conditionalSTRINGThe.recdroidvid_rc.pyconfig file contains
interpreted Python code, so conditionals can be set
for different use-cases. This option allows one to set
a string value from the command line which can then be
used to choose a case in the config file. To set such
a variable, pass the value to this option. The default
value is the string “default”. To access this
variable, usefrom recdroidvid import
config_conditionalat the top of the config file.