modules/Camera.py
def start_record(self, unit_uuid: str) -> str:
        """
        unit_uuid: UUID of a unit passport associated with a unit, which assembly
        process is being recorded by the camera

        main method to record video from camera. Uses popen and ffmpeg utility

        :returns: saved video relative path
        """

        # new video filepath. It is to be saved in a separate directory
        # with a UUID and number in case a unit has more than one video associated with it
        filename = f"output/unit_{unit_uuid}_assembly_video_1.mp4"

        # determine a valid video name not to override an existing video
        cnt = 1
        while path.exists(filename):
            filename.replace(f"video_{cnt}", f"video_{cnt + 1}")
            cnt += 1

        program_ffmpeg = \
            f'ffmpeg -rtsp_transport tcp -i "rtsp://{self.login}:{self.password}@{self.ip}:{self.port}\
/Streaming/Channels/101" -r 25 -c copy -map 0 {filename}'
        # the entire line looks like
        # ffmpeg -rtsp_transport tcp -i "rtsp://login:password@ip:port/Streaming/Channels/101" -c copy -map 0 vid.mp4
        # more on ffmpeg.org
        self.process_ffmpeg = subprocess.Popen(
            "exec " + program_ffmpeg,
            shell=True,  # execute in shell
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            stdin=subprocess.PIPE,  # to get access to all the flows
        )
        logging.info(f"Started recording video '{filename}'")

        self.recording_ongoing = True

        return filename

        unit_uuid: UUID of a unit passport associated with a unit, which assembly
        process is being recorded by the camera

        main method to record video from camera. Uses popen and ffmpeg utility

        :returns: saved video relative path
        
UUID of a unit passport associated with a unit, which assembly
process is being recorded by the camera

main method to record video from camera. Uses popen and ffmpeg utility
UUID of a unit passport associated with a unit which assembly process is being recorded by the camera main method to record video from camera . Uses popen and ffmpeg utility
def start_record(self, unit_uuid: str) -> str:
        filename = f"output/unit_{unit_uuid}_assembly_video_1.mp4"
        cnt = 1
        while path.exists(filename):
            filename.replace(f"video_{cnt}", f"video_{cnt + 1}")
            cnt += 1
        program_ffmpeg = \
            f'ffmpeg -rtsp_transport tcp -i "rtsp://{self.login}:{self.password}@{self.ip}:{self.port}\
/Streaming/Channels/101" -r 25 -c copy -map 0 {filename}'
        self.process_ffmpeg = subprocess.Popen(
            "exec " + program_ffmpeg,
            shell=True,  
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            stdin=subprocess.PIPE,  
        )
        logging.info(f"Started recording video '{filename}'")
        self.recording_ongoing = True
        return filename
def start_record ( self , unit_uuid : str ) -> str : filename = f"output/unit_{unit_uuid}_assembly_video_1.mp4" cnt = 1 while path . exists ( filename ) : filename . replace ( f"video_{cnt}" , f"video_{cnt + 1}" ) cnt += 1 program_ffmpeg = f'ffmpeg -rtsp_transport tcp -i "rtsp://{self.login}:{self.password}@{self.ip}:{self.port}\
/Streaming/Channels/101" -r 25 -c copy -map 0 {filename}' self . process_ffmpeg = subprocess . Popen ( "exec " + program_ffmpeg , shell = True , stdout = subprocess . PIPE , stderr = subprocess . PIPE , stdin = subprocess . PIPE , ) logging . info ( f"Started recording video '{filename}'" ) self . recording_ongoing = True return filename
unit_uuid: UUID of a unit passport associated with a unit, which assembly
process is being recorded by the camera
unit_uuid : UUID of a unit passport associated with a unit which assembly process is being recorded by the camera
"""
        unit_uuid: UUID of a unit passport associated with a unit, which assembly
        process is being recorded by the camera

        main method to record video from camera. Uses popen and ffmpeg utility

        :returns: saved video relative path
        """ # new video filepath. It is to be saved in a separate directory # with a UUID and number in case a unit has more than one video associated with it # determine a valid video name not to override an existing video # the entire line looks like # ffmpeg -rtsp_transport tcp -i "rtsp://login:password@ip:port/Streaming/Channels/101" -c copy -map 0 vid.mp4 # more on ffmpeg.org # execute in shell # to get access to all the flows
saved video relative path
saved video relative path
self
unit_uuid
str