I measure ip camera latency by Xavier and LED.
When I changed power mode by nvpmodel and jetson_clock.sh, the latency on Mode 2 was lower than on Mode 0.
Why is this? Intuitively, the latency on Mode 0 seems to be lower than Mode 2.
This event happened when using H.264. When using MJPEG, the latency was no difference between MODE 0 and MODE 2.
import numpy as np import cv2 import argparse import time import RPi.GPIO as GPIO output_pin1 = 18 # BOARD pin 12, BCM pin 18 #pixel = (1335, 335) #(x,y) def main(): url = "rtsp://******@193.168.0.**/axis-media/media.amp?rate=0&videocodec=h264&resolution=1920x1080&fps=30&clock=0&camera=1&compression=0" test_result = np.loadtxt("pixel_index.txt") pixel = (int(test_result), int(test_result)) cap = cv2.VideoCapture() cap.set(cv2.CAP_PROP_BUFFERSIZE,1) cap.open(url) GPIO.setmode(GPIO.BCM) # set pin as an output pin with optional initial state of HIGH GPIO.setup(output_pin1, GPIO.OUT, initial=GPIO.LOW) start = -1000000 i = 0 j = 0 try: while(True): ret, frame = cap.read() if frame[pixel, pixel] > 100: stop = time.time() print(stop*1000 - start*1000) GPIO.output(output_pin1, GPIO.LOW) break i = i+1 if i >= 100 and j == 0 : #start = time.time() GPIO.output(output_pin1, GPIO.HIGH) start = time.time() i = 0 j = 1 finally: GPIO.cleanup() if __name__ == '__main__': main()