It worked and the file saved into /home/pi/objectdetection/traffic_detected.avi successfully. However, I have been trying to use ffmpeg to convert from avi to mp4 and I have had no success. I tried to use this command to convert:
[avi @ 0x24af5c0] Could not find codec parameters for stream 0 (Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, avi, from 'traffic_detected.avi':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 20 fps, 20 tbr, 20 tbn, 20 tbc
Output #0, mp4, to 'trafficdetection.mp4':
Output file #0 does not contain any stream
i tried this code to change analyzeduration and probesize " ffmpeg -analyzeduration 2147483647 -probesize 2147483647 -i /home/pi/objectdetection/traffic_detected.avi
" Tried again and got this:
[avi @ 0x21e85c0] Could not find codec parameters for stream 0 (Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, avi, from '/home/pi/objectdetection/traffic_detected.avi':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 20 fps, 20 tbr, 20 tbn, 20 tbc
At least one output file must be specified
Hi,
I have been trying to use your video object detection code as follows:
from imageai.Detection import VideoObjectDetection import os import cv2
execution_path = os.getcwd()
camera = cv2.VideoCapture(0)
detector = VideoObjectDetection() detector.setModelTypeAsYOLOv3() detector.setModelPath(os.path.join(execution_path , "yolo.h5")) detector.loadModel()
video_path = detector.detectObjectsFromVideo(camera_input=camera, output_file_path=os.path.join(execution_path, "camera_detected_video") , frames_per_second=20, log_progress=True, minimum_percentage_probability=30)
print(video_path)
It worked and the file saved into /home/pi/objectdetection/traffic_detected.avi successfully. However, I have been trying to use ffmpeg to convert from avi to mp4 and I have had no success. I tried to use this command to convert:
avconv -i traffic_detected.avi -c:v libx264 -c:a copy trafficdetection.mp4
and got this error:
[avi @ 0x24af5c0] Could not find codec parameters for stream 0 (Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown)): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, avi, from 'traffic_detected.avi': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 20 fps, 20 tbr, 20 tbn, 20 tbc Output #0, mp4, to 'trafficdetection.mp4': Output file #0 does not contain any stream
i tried this code to change analyzeduration and probesize " ffmpeg -analyzeduration 2147483647 -probesize 2147483647 -i /home/pi/objectdetection/traffic_detected.avi " Tried again and got this:
[avi @ 0x21e85c0] Could not find codec parameters for stream 0 (Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown)): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, avi, from '/home/pi/objectdetection/traffic_detected.avi': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 20 fps, 20 tbr, 20 tbn, 20 tbc At least one output file must be specified
Can you help me ?
Thank you,
Chandni.