my $RecordingTime = 5; my $WebCamUrl = "http://192.168.178.66/bha-api/video.cgi?sessionid=pYSFU7KtdTu45emxoP05UeIj3rlpVkbqkBVaB5pqSwyUhxXtJmV1HNWx2BOpx"; my $VideoFilePath = "/home/pi/Documents/Video/201910101435-Video.mjpeg"; my $ShellCommand = "nohup (sleep " . $RecordingTime . "; echo quit) | mplayer " . $WebCamUrl . " -dumpstream –dumpfile " . $VideoFilePath; eval { system($ShellCommand) or die "Could not execute" . $ShellCommand; }; ### If error message appeared if ( $@ ) { $ErrorMessage = $@; }