# OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 12

- **ID:** `opencv/video-writer-fourcc-codec-not-supported`
- **Domain:** opencv
- **Category:** encoding_error
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

The specified FOURCC code for VideoWriter is not supported by the FFMPEG backend on the current system, often due to missing codec or incompatible container format.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 4.5.5 | active | — | — |
| 4.6.0 | active | — | — |
| 4.8.1 | active | — | — |

## Workarounds

1. **Use a widely supported codec like 'avc1' (H.264) with .mp4 container, or 'MJPG' with .avi container. Verify codec availability with: ffmpeg -encoders | grep h264** (85% success)
   ```
   Use a widely supported codec like 'avc1' (H.264) with .mp4 container, or 'MJPG' with .avi container. Verify codec availability with: ffmpeg -encoders | grep h264
   ```
2. **Switch VideoWriter backend to OpenCV's built-in codecs by using cv2.CAP_OPENCV_MJPEG or specify backend via cv2.VideoWriter(filename, apiPreference, fourcc, ...).** (70% success)
   ```
   Switch VideoWriter backend to OpenCV's built-in codecs by using cv2.CAP_OPENCV_MJPEG or specify backend via cv2.VideoWriter(filename, apiPreference, fourcc, ...).
   ```

## Dead Ends

- **Changing FOURCC to 'XVID' without checking container compatibility** — XVID codec may not be installed or may require AVI container; using MP4 container fails. (60% fail)
- **Reinstalling OpenCV with different flags but not installing ffmpeg codecs** — Codec support depends on system ffmpeg libraries, not OpenCV build flags alone. (50% fail)
