{
  "id": "opencv/videowriter-codec-not-supported-linux",
  "signature": "OpenCV: FFMPEG: tag 0x3234504d/'MP42' is not supported with codec id 12",
  "signature_zh": "OpenCV: FFMPEG: 标签 0x3234504d/'MP42' 不受代码 ID 12 支持",
  "regex": "tag 0x[0-9a-fA-F]+/[A-Za-z0-9]+ is not supported with codec id \\d+",
  "domain": "opencv",
  "category": "encoding_error",
  "subcategory": null,
  "root_cause": "The specified video codec (MP42) is not supported by the FFMPEG backend on the current system, often due to missing codec libraries or incompatible FFMPEG build.",
  "root_cause_type": "generic",
  "root_cause_zh": "指定的视频编解码器 (MP42) 不被当前系统上的 FFMPEG 后端支持，通常是因为缺少编解码器库或 FFMPEG 构建不兼容。",
  "versions": [
    {
      "version": "4.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.6.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.7.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "4.9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The codec is still MP42, which may not be supported regardless of container format.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Without FFMPEG, OpenCV uses a different backend (e.g., VFW on Windows) which may have its own limitations.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "XVID might also be unsupported if the codec is not installed; the fix is to use a codec known to work on the system.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use a widely supported codec like 'avc1' or 'H264' with FFMPEG: `fourcc = cv2.VideoWriter_fourcc(*'avc1')` and verify with `cv2.VideoWriter.isOpened()`.",
      "success_rate": 0.75,
      "how": "Use a widely supported codec like 'avc1' or 'H264' with FFMPEG: `fourcc = cv2.VideoWriter_fourcc(*'avc1')` and verify with `cv2.VideoWriter.isOpened()`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Install the necessary codec libraries: `sudo apt-get install libavcodec-extra` on Ubuntu/Debian or `brew install ffmpeg` on macOS.",
      "success_rate": 0.8,
      "how": "Install the necessary codec libraries: `sudo apt-get install libavcodec-extra` on Ubuntu/Debian or `brew install ffmpeg` on macOS.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Fall back to a raw video codec like 'I420' (uncompressed) for debugging: `fourcc = cv2.VideoWriter_fourcc(*'I420')`.",
      "success_rate": 0.7,
      "how": "Fall back to a raw video codec like 'I420' (uncompressed) for debugging: `fourcc = cv2.VideoWriter_fourcc(*'I420')`.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use a widely supported codec like 'avc1' or 'H264' with FFMPEG: `fourcc = cv2.VideoWriter_fourcc(*'avc1')` and verify with `cv2.VideoWriter.isOpened()`.",
    "Install the necessary codec libraries: `sudo apt-get install libavcodec-extra` on Ubuntu/Debian or `brew install ffmpeg` on macOS.",
    "Fall back to a raw video codec like 'I420' (uncompressed) for debugging: `fourcc = cv2.VideoWriter_fourcc(*'I420')`."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.opencv.org/4.x/dd/d9e/classcv_1_1VideoWriter.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.8,
  "fix_success_rate": 0.7,
  "resolvable": "partial",
  "first_seen": "2023-05-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}