Keras-yolo3: Problem with saving video file

Created on 31 Aug 2018  路  5Comments  路  Source: qqwweee/keras-yolo3

I`m having problems saving the video file when I run detections on my own videos.

I`m in the correct folder and specifies:

yolo_video.py MYVIDEO.avi NAMEofOUTPUTvideo.avi

This generates a file named NAMEofOUTPUTvideo.avi, but this file contains no informations. It seems like its just created, and thats all. I tried with different formats; only name without .avi, etc.

Am I doing this part wrong?

Most helpful comment

i had a saving problem, the file itself was not being created.
I added this
video_FourCC = cv2.VideoWriter_fourcc(*'MP4V')
this is a codec issue with opencv, this one works for me for saving the file as .mp4

out.release()
yolo.close_session()

just before closing the session

The frame rate of the recorder was video quality hence it is a bit difficult to see transitions in the detections, hence dropped the frame rate to 10

All 5 comments

Just modify the following code in function detect_video yolo.py
Original

video_FourCC    = int(vid.get(cv2.CAP_PROP_FOURCC))

Modified

video_FourCC    =  cv2.VideoWriter_fourcc(*"XVID")

Thank you!

i had a saving problem, the file itself was not being created.
I added this
video_FourCC = cv2.VideoWriter_fourcc(*'MP4V')
this is a codec issue with opencv, this one works for me for saving the file as .mp4

out.release()
yolo.close_session()

just before closing the session

The frame rate of the recorder was video quality hence it is a bit difficult to see transitions in the detections, hence dropped the frame rate to 10

I wonder if you get some erros
such as
Failed to load OpenH264 library: xxx.dll
if ture, you should download the dll and put it into your python path

@YifengChen94, using abhay8051 works without downloading the dll.

Was this page helpful?
0 / 5 - 0 ratings