Unable to record the ui screen while executing the script

HI All…

I would be need to record the UI screen while executing the script and trying to achieve through adb shell commmand as

	String command = "adb shell screenrecord /sdcard/demo.mp4";
	Runtime.getRuntime().exec(command);

when i use above adb command alone thorough the command prompt, its working fine and video get stored in the sd card… but the same not happening with the above command while running the script

can any one give any idea on same to store or record the video while running the script

Appreciate for your support…
Thanks

@kcinman11358 @crujzo @Aleksei @upendraupadhyay @anish10110 @narendarsingam please let me know if there any solution for that…

Thanks