2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Could not find encoder for codec id 27: Encoder not found | python opencv

Posted at

要旨

pythonのopencv-pythonでmp4形式の動画を書き出そうとした際のエラーです.

エラー内容

Could not find encoder for codec id 27: Encoder not found

エラー原因 (コード抜粋)

video_FourCC = int(vid.get(cv2.CAP_PROP_FOURCC))
output_path = "test.mp4"
out = cv2.VideoWriter(output_path, video_FourCC, video_fps, video_size

video_FourCCの形式が良くなかったのが原因.
なおoutput_pathをmp4形式の際のエラーと思われます.

エラー修正後 (コード抜粋)

video_FourCC = cv2.VideoWriter_fourcc(*"mp4v")
output_path = "test.mp4"
out = cv2.VideoWriter(output_path, video_FourCC, video_fps, video_size

video_FourCCを上記のように書き換えると正しく動きます.

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?