# Video Output fail

**URL:** <https://forum.opencv.org/t/video-output-fail/13795>\
**Category:** Python\
**Created:** [July 9, 2023, 8:35am UTC](https://forum.opencv.org/t/video-output-fail/13795 "2023-07-09T08:35:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Optymize\_Official](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/optymize_official/32/8242_2.png) [@Optymize\_Official](https://forum.opencv.org/u/Optymize_Official)\
**Post date:** [July 9, 2023, 8:35am UTC](https://forum.opencv.org/t/video-output-fail/13795/1 "2023-07-09T08:35:31Z")

</div>

I use the normal code to read video and output video

when i use fourCC = cv2.VideoWriter\_fourcc(\*‘h264’), it show  
OpenCV: FFMPEG: tag 0x34363268/‘h264’ is not supported with codec id 27 and format ‘mp4 / MP4 (MPEG-4 Part 14)’  
OpenCV: FFMPEG: fallback to use tag 0x31637661/‘avc1’  
[ERROR:0@670.249] global cap\_ffmpeg\_impl.hpp:2991 open Could not find encoder for codec\_id=27, error: Encoder not found  
[ERROR:0@670.249] global cap\_ffmpeg\_impl.hpp:3066 open VIDEOIO/FFMPEG: Failed to initialize VideoWriter  
QObject::moveToThread: Current thread (0x56281fe72f10) is not the object’s thread (0x56281fc61690).

And the output file didn’t appear.

And when i use fourCC = cv2.VideoWriter\_fourcc(\*‘mp4v’)  
the output video is only 258kb. why is it

i do need the video encodec is h264, how can i achieve it

---

<div class="post-metadata">

**Author:** ![Optymize\_Official](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/optymize_official/32/8242_2.png) [@Optymize\_Official](https://forum.opencv.org/u/Optymize_Official)\
**Post date:** [July 9, 2023, 8:40am UTC](https://forum.opencv.org/t/video-output-fail/13795/2 "2023-07-09T08:40:28Z")

</div>

[ERROR:0@112.957] global cap\_ffmpeg\_impl.hpp:2991 open Could not find encoder for codec\_id=27, error: Encoder not found  
[ERROR:0@112.957] global cap\_ffmpeg\_impl.hpp:3066 open VIDEOIO/FFMPEG: Failed to initialize VideoWriter
