Closed NareshPrabhu closed 4 years ago
Have this same issue. Referenced in #116
I got this error when trying to use MoviePy to edit video produced by the picamera
library for recording from a Raspberry Pi. It produced a video in h.264
which didn't contain any duration information, which caused MoviePy and other video converters to crash. I was able to solve the problem using MP4Box
to convert the video to mp4:
sudo apt-get install -y gpac
MP4Box -add video.h264 video.mp4
This created an mp4 file with the duration information so MoviePy could process it. I followed this guide: https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspivid.md
This is likely long out-of-date. If the problem reoccurs, please create a new issue.
I use opencv to resave video:
def opencv_video_save_as(video_path, save_path):
"""
video save as video
:param video_path:
:param save_path:
:return:
"""
input_movie = cv2.VideoCapture(video_path)
width = int(input_movie.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(input_movie.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = input_movie.get(5)
fourcc = cv2.VideoWriter_fourcc(*'MP4V')
out = cv2.VideoWriter(save_path, fourcc, fps, (width, height))
while (input_movie.isOpened()):
ret, frame = input_movie.read()
if (ret != True):
break
out.write(frame)
out.release()
I'm using RapberryPi and downloaded MoviePy. Wrote a small sample code (sample.py) below
Is there any issue with my installation? Getting below error. ffmpeg installation was fine.