Hi,
I set “[sink1] type 3=file” to save ouput file ,and using opencv to read the saved mp4 file while running “detecting(deepstream-app -c deepstream_app_config_yoloV3.txt”.
I get a error number of total frame by “cap.get(cv2.CAP_PROP_FRAME_COUNT)”
–count_frame= -9.223372036854776e+18
But it’s correct after quit the process of “detecting(deepstream-app -c deepstream_app_config_yoloV3.txt”.
Why it’s incorrect while running the project? How to solve it?
config file
[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=4
uri=rtsp://admin:admin@192.168.1.64:554/cam/realmonitor?channel=1&subtype=2
num-sources=1
gpu-id=0
# (0): memtype_device - Memory type Device
# (1): memtype_pinned - Memory type Host Pinned
# (2): memtype_unified - Memory type Unified
cudadec-memtype=0
[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File
type=2
sync=0
source-id=0
gpu-id=0
nvbuf-memory-type=0
[sink1]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File
type=3
#1=mp4 2=mkv 3=mpeg4
container=2
#1=h264 2=h265
codec=1
sync=0
bitrate=10000000
#1=cbr 2=vbr
# rc-mode=2
iframeinterval=30
#1=baseline 2=main 3=high
#profile=3
#output-file=file:///home/nvidia/TX2/tensorRT/deepstream_reference_apps-AI/output/out.mp4
output-file=../../output/out.mp4
source-id=0
code:
[code]import cv2
print(cv2.version)
cap = cv2.VideoCapture(“/home/nvidia/TX2/tensorRT/deepstream_sdk_v4.0_v5/output/out.mp4”)
count = cap.get(cv2.CAP_PROP_FRAME_COUNT)
print(“count_frame=”, count)
print(“CAP_PROP_POS_FRAMES=”, cap.set(cv2.CAP_PROP_POS_FRAMES, 22))
position=cap.get(cv2.CAP_PROP_POS_FRAMES)
print(position)