Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not open a mp4 video #8

Open
PapaMadeleine2022 opened this issue Jun 21, 2017 · 11 comments
Open

can not open a mp4 video #8

PapaMadeleine2022 opened this issue Jun 21, 2017 · 11 comments

Comments

@PapaMadeleine2022
Copy link

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?

@MTRNord
Copy link

MTRNord commented Jun 21, 2017

@MTRNord
Copy link

MTRNord commented Jun 21, 2017

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

@PapaMadeleine2022
Copy link
Author

@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?

@DrewNF
Copy link
Owner

DrewNF commented Jun 21, 2017

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

@PapaMadeleine2022
Copy link
Author

@DrewNF OK, thank you.

@PapaMadeleine2022
Copy link
Author

@DrewNF how to fix the problem I described above?

@DrewNF
Copy link
Owner

DrewNF commented Jun 21, 2017

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

@PapaMadeleine2022
Copy link
Author

PapaMadeleine2022 commented Jun 21, 2017

@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?

@DrewNF
Copy link
Owner

DrewNF commented Jun 21, 2017

You cast as I suggested, but is better that u search your previous error and try to find solutions​for it 😁 because dependently on you install libraries you have to cast the parameter!

@sfarkya
Copy link

sfarkya commented Feb 3, 2018

@IvyGongoogle Did you work around the problem you were facing regarding cv2.cv.CV_CAP_PROP_FRAME_COUNT issue?

@DrewNF
Copy link
Owner

DrewNF commented Mar 1, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants