# Are any codecs included with opencv?

**URL:** <https://forum.opencv.org/t/are-any-codecs-included-with-opencv/1164>\
**Category:** Uncategorized\
**Created:** [January 27, 2021, 11:43pm UTC](https://forum.opencv.org/t/are-any-codecs-included-with-opencv/1164 "2021-01-27T23:43:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![markworth](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@markworth](https://forum.opencv.org/u/markworth)\
**Post date:** [January 27, 2021, 11:43pm UTC](https://forum.opencv.org/t/are-any-codecs-included-with-opencv/1164/1 "2021-01-27T23:43:58Z")

</div>

I have been unable to write an uncorrupted video file using:

```
fourcc = cv2.VideoWriter_fourcc(*'DIVX')
writer = cv2.VideoWriter(out.avi, fourcc, 30, (width, height), True)	

```

I get a file but it is corrupted. If I try to use ‘MJPG’ or ‘MPV4’ with a mp4 extension I get unsupported codec error. Is there any workable fourcc setting and output for opencv 4.4.0+

---

<div class="post-metadata">

**Author:** ![Supra](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/supra/32/91_2.png) [@Supra](https://forum.opencv.org/u/Supra)\
**Post date:** [January 28, 2021, 2:38pm UTC](https://forum.opencv.org/t/are-any-codecs-included-with-opencv/1164/2 "2021-01-28T14:38:56Z")

</div>

Change this:  
`writer = cv2.VideoWriter(out.avi, fourcc, 30, (width, height), True)`  
to:

> writer = cv2.VideoWriter(out.avi, fourcc, 30, (width, height))

Link: [FOURCC](https://www.fourcc.org/codecs.php)

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [January 28, 2021, 4:40pm UTC](https://forum.opencv.org/t/are-any-codecs-included-with-opencv/1164/3 "2021-01-28T16:40:58Z")

</div>

welcome.

please `print(cv2.getBuildInformation())` and report this back to us.

---

<div class="post-metadata">

**Author:** ![markworth](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@markworth](https://forum.opencv.org/u/markworth)\
**Post date:** [January 30, 2021, 7:49pm UTC](https://forum.opencv.org/t/are-any-codecs-included-with-opencv/1164/4 "2021-01-30T19:49:51Z")

</div>

Thanks Christoph,

reporting back, command worked fine…built from git/bin to get what I needed. Best.

---

<div class="post-metadata">

**Author:** ![markworth](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@markworth](https://forum.opencv.org/u/markworth)\
**Post date:** [January 30, 2021, 7:50pm UTC](https://forum.opencv.org/t/are-any-codecs-included-with-opencv/1164/5 "2021-01-30T19:50:23Z")

</div>

Thank you Supra!..best

---

<div class="post-metadata">

**Author:** ![Supra](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/supra/32/91_2.png) [@Supra](https://forum.opencv.org/u/Supra)\
**Post date:** [January 31, 2021, 2:01pm UTC](https://forum.opencv.org/t/are-any-codecs-included-with-opencv/1164/6 "2021-01-31T14:01:19Z")

</div>

You are welcome, Markworth .
