Tensorflow_Object_Tracking_Video
Tensorflow_Object_Tracking_Video copied to clipboard
can not open a mp4 video
hello, firstly, I find that your code have import error
. The reason should be that the names are not uniform between Utils_Video.py
and utils_video.py
or Utils_Image.py and utils_image.py
. Please check it.
Importantly, I run python VID_yolo.py --path_video xxx.mp4
, but it shows error:
Opening File Video:2.mp4
could Not Open : 2.mp4
Traceback (most recent call last):
File "VID_yolo.py", line 120, in <module>
main()
File "VID_yolo.py", line 108, in main
frame_list, frames = utils_video.extract_frames(args.path_video, args.perc)
TypeError: 'NoneType' object is not iterable
why can not open a mp4 file? can you give some advises?
Even I am not the maintainer but maybe it is this issue? https://stackoverflow.com/questions/13834399/cannot-open-mp4-video-files-using-opencv-2-4-3-python-2-7-in-windows-7-machi
Or https://stackoverflow.com/questions/31040746/cant-open-video-using-opencv Telling from everything google would have told you it propably is a missing ffmpeg or openCV build against the wrong ffmpeg
@MTRNord thank for your reply. rebuild ffmpeg and opencv did not work. But a workaround
import sys
import skvideo.io
cap = skvideo.io.VideoCapture(sys.argv[1])
ret, frame = cap.read()
works for me. but another error:
Opening File Video:1.mp4
Opened File Video:1.mp4
Start Reading File Video:1.mp4
Traceback (most recent call last):
File "VID_yolo.py", line 120, in <module>
main()
File "VID_yolo.py", line 108, in main
frame_list, frames = utils_video.extract_frames(args.path_video, args.perc)
File "/home/ztgong/work/video/objectTracking/Tensorflow_Object_Tracking_Video/utils_video.py", line 472, in extract_frames
total = int((vidcap.get(cv2.CAP_PROP_FRAME_COUNT)/100)*video_perc)
File "/home/ztgong/local/anaconda2/lib/python2.7/site-packages/skvideo/io/__init__.py", line 109, in get
raise NotImplementedError()
NotImplementedError
av_interleaved_write_frame(): Broken pipe
Last message repeated 1 times
can you give some advises?
Yes exactly! The project was running without error when I uploaded it. During the development I had to check many times the frames extraction, because there are plenty method and all of them have compile error or library dependencies that was missing. Please check carefully if you miss some dependencies! Bests
@DrewNF OK, thank you.
@DrewNF how to fix the problem I described above?
The problem comes from the cv2.blablabla parameter, is the one that, also in the project, can raise problem, because dependently on the library and how you install it, you have to cast it like cv2.cv.blablabla. You have to search the specific solution, googling the error, you will save time and fine a specific solution! Best
@DrewNF as the error:
Traceback (most recent call last):
File "VID_yolo.py", line 120, in <module>
main()
File "VID_yolo.py", line 108, in main
frame_list, frames = utils_video.extract_frames(args.path_video, args.perc)
File "/home/ztgong/work/video/objectTracking/Tensorflow_Object_Tracking_Video/utils_video.py", line 472, in extract_frames
total = int((vidcap.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT)/100)*video_perc)
AttributeError: 'module' object has no attribute 'cv'
I change the total = int((vidcap.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT)/100)*video_perc)
to total = int((vidcap.get(cv2.CAP_PROP_FRAME_COUNT)/100)*video_perc)
The number seems to not be same for cv2.cv.CV_CAP_PROP_FRAME_COUNT
and cv2.CAP_PROP_FRAME_COUNT
. But now cv2 has no cv. So what should I use to replace cv2.cv.CV_CAP_PROP_FRAME_COUNT
?
You cast as I suggested, but is better that u search your previous error and try to find solutionsfor it 😁 because dependently on you install libraries you have to cast the parameter!
@IvyGongoogle Did you work around the problem you were facing regarding cv2.cv.CV_CAP_PROP_FRAME_COUNT
issue?
The error is given because he cannot match the casting of the CV library installed, that why. To solve it u need a simple online research of the error output.