{
  "id": "task_libraries:video-processing/python",
  "path": "/exapedia/python-video-processing-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "Python video processing libraries",
  "answer": [
    {
      "t": "text",
      "text": "Python video processing libraries decode, edit, and encode video files frame by frame. Most rely on FFmpeg, either through bindings to its libraries or by building commands for its executable. These libraries let media pipelines, computer vision models, and editing tools read and write video in code."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "Python video processing libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#opencv-python-headless",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F137"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F141"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F139"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#av",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F157"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F158"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F161"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#imageio",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F178"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#imageio-ffmpeg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F193"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F197"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F195"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#torchvision",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F212"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F213"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F216"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F214"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#ffmpeg-python",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F232"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F233"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F239"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F236"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F234"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#moviepy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F249"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F250"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F256"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F253"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F251"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#torchcodec",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F266"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F267"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F275"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F270"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F268"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "PyPI"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#opencv-python-headless",
          "label": [
            {
              "t": "text",
              "text": "opencv-python-headless"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F138"
        },
        {
          "t": "text",
          "text": ", a count that covers all its computer vision work."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Video encoding",
            "Audio/video muxing",
            "NumPy frame output"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#opencv-python-headless",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F137"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#av",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F157"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F168"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F169"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#imageio",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F184"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F185"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F186"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#imageio-ffmpeg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F193"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F203"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F204"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F205"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#torchvision",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F212"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F222"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F223"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F224"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#ffmpeg-python",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F232"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F240"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F241"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F242"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#moviepy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F249"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F257"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F258"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F259"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#torchcodec",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F266"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F276"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F277"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F278"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "opencv-python-headless",
          "name": [
            {
              "t": "fact",
              "fact": "F137"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/opencv/opencv-python"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/opencv-python-headless"
            },
            {
              "label": "Docs",
              "href": "https://github.com/opencv/opencv-python/blob/4.x/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F144"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F140"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F139"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/opencv/opencv-python/blob/4.x/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F137"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F155"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/Breakthrough/PySceneDetect",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F155"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _open_capture(self, frame_rate: FrameRate | None = None):\n    \"\"\"Opens capture referenced by this object and resets internal state.\"\"\"\n    if self._is_device:\n        assert isinstance(self._path_or_device, int)\n        if self._path_or_device < 0:\n            raise ValueError(\"Invalid/negative device ID specified.\")\n        input_is_video_file = False\n        capture_api = cv2.CAP_ANY\n    else:\n        assert isinstance(self._path_or_device, str)\n        capture_api = _get_capture_api(self._path_or_device)\n        input_is_video_file = not any(\n            identifier in self._path_or_device\n            for identifier in NON_VIDEO_FILE_INPUT_IDENTIFIERS\n        )\n        # We don't have a way of querying why opening a video fails (errors are logged at\n        # least), so provide a better error message if we try to open a missing file.\n        if input_is_video_file and not os.path.exists(self._path_or_device):\n            raise OSError(\"Video file not found.\")\n\n    cap = cv2.VideoCapture(self._path_or_device, capture_api)\n    if not cap.isOpened():\n        raise VideoOpenFailure(\n            \"Ensure file is valid video and system dependencies are up to date.\\n\"\n        )\n\n    # Display an error if the video codec type seems unsupported (#86) as this indicates\n    # potential video corruption, or may explain missing frames. We only perform this check\n    # for video files on-disk (skipped for devices, image sequences, streams, etc...).\n    codec_unsupported: bool = int(abs(cap.get(cv2.CAP_PROP_FOURCC))) == 0\n    if codec_unsupported and input_is_video_file:\n        logger.error(\n            \"Video codec detection failed. If output is incorrect:\\n\"\n            \"  - Re-encode the input video with ffmpeg\\n\"\n            \"  - Update OpenCV (pip install --upgrade opencv-python)\\n\"\n            \"  - Use the PyAV backend (--backend pyav)\\n\"\n            \"For details, see https://github.com/Breakthrough/PySceneDetect/issues/86\"\n        )\n\n    # Ensure the framerate is correct to avoid potential divide by zero errors. This can be\n    # addressed in the PyAV backend if required since it supports integer timebases.\n    assert frame_rate is None or frame_rate > MAX_FPS_DELTA, (\n        \"Frame rate must be validated if set!\"\n    )\n    if frame_rate is None:\n        frame_rate = cap.get(cv2.CAP_PROP_FPS)\n        if frame_rate < MAX_FPS_DELTA:\n            raise FrameRateUnavailable()\n\n    self._cap: cv2.VideoCapture = cap\n    self._frame_rate: Fraction = framerate_to_fraction(frame_rate)\n    self._has_grabbed = False\n    self._eof_timecode: Timecode | None = None\n    cap.set(cv2.CAP_PROP_ORIENTATION_AUTO, 1.0)  # https://github.com/opencv/opencv/issues/26795\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/Breakthrough/PySceneDetect/blob/47f95bd4e2b36164db28d05afa68fdbbfac48153/scenedetect/backends/opencv.py#L373-L426",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F154"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=opencv-python-headless%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F137"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import cv2\n\ncapture = cv2.VideoCapture('input.mp4')\nok, frame = capture.read()\ncapture.release()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/opencv/opencv/blob/5.x/modules/videoio/include/opencv2/videoio.hpp",
                  "label": [
                    {
                      "t": "text",
                      "text": "videoio.hpp"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F142"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "av",
          "name": [
            {
              "t": "fact",
              "fact": "F157"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/PyAV-Org/PyAV"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/av"
            },
            {
              "label": "Docs",
              "href": "https://github.com/PyAV-Org/PyAV/blob/master/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F164"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F158"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F160"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/PyAV-Org/PyAV/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F157"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F174"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F175"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/ManimCommunity/manim",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F174"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def encode_and_write_frame(self, frame: PixelArray, num_frames: int) -> None:\n    \"\"\"\n    For internal use only: takes a given frame in ``np.ndarray`` format and\n    write it to the stream\n    \"\"\"\n    for _ in range(num_frames):\n        # Notes: precomputing reusing packets does not work!\n        # I.e., you cannot do `packets = encode(...)`\n        # and reuse it, as it seems that `mux(...)`\n        # consumes the packet.\n        # The same issue applies for `av_frame`,\n        # reusing it renders weird-looking frames.\n        av_frame = av.VideoFrame.from_ndarray(frame, format=\"rgba\")\n        for packet in self.video_stream.encode(av_frame):\n            self.video_container.mux(packet)\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/ManimCommunity/manim/blob/c2dfb597ff470f0cdb01ce9074edb426f45000bc/manim/scene/scene_file_writer.py#L424-L438",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F173"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=av%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F157"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import av\n\nwith av.open('input.mp4') as container:\n    frame = next(container.decode(video=0))\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://pyav.basswood-io.com/docs/stable/api/_globals.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "core.py"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F162"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "imageio",
          "name": [
            {
              "t": "fact",
              "fact": "F176"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/imageio/imageio"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/imageio"
            },
            {
              "label": "Docs",
              "href": "https://github.com/imageio/imageio/blob/master/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F13"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F178"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/imageio/imageio/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F176"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F20"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F21"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F191"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F192"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/huggingface/diffusers",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F191"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def export_to_video(\n    video_frames: list[np.ndarray] | list[PIL.Image.Image],\n    output_video_path: str = None,\n    fps: int = 10,\n    quality: float = 5.0,\n    bitrate: int | None = None,\n    macro_block_size: int | None = 16,\n) -> str:\n    \"\"\"\n    quality:\n        Video output quality. Default is 5. Uses variable bit rate. Highest quality is 10, lowest is 0. Set to None to\n        prevent variable bitrate flags to FFMPEG so you can manually specify them using output_params instead.\n        Specifying a fixed bitrate using `bitrate` disables this parameter.\n\n    bitrate:\n        Set a constant bitrate for the video encoding. Default is None causing `quality` parameter to be used instead.\n        Better quality videos with smaller file sizes will result from using the `quality` variable bitrate parameter\n        rather than specifying a fixed bitrate with this parameter.\n\n    macro_block_size:\n        Size constraint for video. Width and height, must be divisible by this number. If not divisible by this number\n        imageio will tell ffmpeg to scale the image up to the next closest size divisible by this number. Most codecs\n        are compatible with a macroblock size of 16 (default), some can go smaller (4, 8). To disable this automatic\n        feature set it to None or 1, however be warned many players can't decode videos that are odd in size and some\n        codecs will produce poor results or fail. See https://en.wikipedia.org/wiki/Macroblock.\n    \"\"\"\n    # TODO: Dhruv. Remove by Diffusers release 0.33.0\n    # Added to prevent breaking existing code\n    if not is_imageio_available():\n        logger.warning(\n            (\n                \"It is recommended to use `export_to_video` with `imageio` and `imageio-ffmpeg` as a backend. \\n\"\n                \"These libraries are not present in your environment. Attempting to use legacy OpenCV backend to export video. \\n\"\n                \"Support for the OpenCV backend will be deprecated in a future Diffusers version\"\n            )\n        )\n        return _legacy_export_to_video(video_frames, output_video_path, fps)\n\n    if is_imageio_available():\n        import imageio\n    else:\n        raise ImportError(BACKENDS_MAPPING[\"imageio\"][1].format(\"export_to_video\"))\n\n    try:\n        imageio.plugins.ffmpeg.get_exe()\n    except AttributeError:\n        raise AttributeError(\n            (\n                \"Found an existing imageio backend in your environment. Attempting to export video with imageio. \\n\"\n                \"Unable to find a compatible ffmpeg installation in your environment to use with imageio. Please install via `pip install imageio-ffmpeg\"\n            )\n        )\n\n    if output_video_path is None:\n        output_video_path = tempfile.NamedTemporaryFile(suffix=\".mp4\").name\n\n    if isinstance(video_frames[0], np.ndarray):\n        video_frames = [(frame * 255).astype(np.uint8) for frame in video_frames]\n\n    elif isinstance(video_frames[0], PIL.Image.Image):\n        video_frames = [np.array(frame) for frame in video_frames]\n\n    with imageio.get_writer(\n        output_video_path, fps=fps, quality=quality, bitrate=bitrate, macro_block_size=macro_block_size\n    ) as writer:\n        for frame in video_frames:\n            writer.append_data(frame)\n\n    return output_video_path\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/huggingface/diffusers/blob/d5df05ed2a2d310c2e515f5de55bd9e7eb63235d/src/diffusers/utils/export_utils.py#L150-L218",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F190"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20imageio%20for%20video%20capture%2C%20processing%20and%20encoding&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F176"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import imageio\n\nwith imageio.get_reader('input.mp4', format='FFMPEG') as reader:\n    frame = reader.get_data(0)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/imageio/imageio/blob/master/imageio/v2.py",
                  "label": [
                    {
                      "t": "text",
                      "text": "examples.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F181"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "imageio-ffmpeg",
          "name": [
            {
              "t": "fact",
              "fact": "F193"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/imageio/imageio-ffmpeg"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/imageio-ffmpeg"
            },
            {
              "label": "Docs",
              "href": "https://github.com/imageio/imageio-ffmpeg/blob/main/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F200"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F196"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F195"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/imageio/imageio-ffmpeg/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F193"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F210"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/nvidia-cosmos/cosmos-reason1",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F210"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _write_video(video_tensor, output_path, **ffmpeg_kwargs):\n    # Expected channel order is HWC (input is TCHW).\n    video_tensor = video_tensor.permute(0, 2, 3, 1).contiguous()\n    # This takes the height added for the timestamps into account.\n    height, width = video_tensor.shape[1], video_tensor.shape[2]\n    generator = imageio_ffmpeg.write_frames(\n        output_path,\n        size=(width, height),\n        **ffmpeg_kwargs,\n    )\n    try:\n        # Seed the generator.\n        generator.send(None)\n        generator.send(video_tensor.cpu().numpy())\n    finally:\n        generator.close()\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/nvidia-cosmos/cosmos-reason1/blob/b84a3fae3284c375bb0cefab7b53aeb1d5059ab6/scripts/add_timestamps.py#L146-L161",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F209"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=imageio-ffmpeg%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F193"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from imageio_ffmpeg import read_frames\n\nreader = read_frames('input.mp4')\nmetadata = next(reader)\nframe = next(reader)\nreader.close()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/imageio/imageio-ffmpeg/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F198"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "torchvision",
          "name": [
            {
              "t": "fact",
              "fact": "F212"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/pytorch/vision"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/torchvision"
            },
            {
              "label": "Docs",
              "href": "https://github.com/pytorch/vision/blob/main/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F219"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F213"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F215"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F214"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/pytorch/vision/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F212"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F231"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/open-edge-platform/anomalib",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F230"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def pre_process(self, first_frame: torch.Tensor, last_frame: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:\n    \"\"\"Resize inputs to dimensions required by backbone.\n\n    Args:\n        first_frame (torch.Tensor): Starting frame of optical flow computation.\n        last_frame (torch.Tensor): Last frame of optical flow computation.\n\n    Returns:\n        tuple[torch.Tensor, torch.Tensor]: Preprocessed first and last frame.\n    \"\"\"\n    first_frame = F.resize(first_frame, size=[520, 960], antialias=False)\n    last_frame = F.resize(last_frame, size=[520, 960], antialias=False)\n    return self.transforms(first_frame, last_frame)\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/open-edge-platform/anomalib/blob/c3fa8b5b4326a20b2c6b73d91deec624ddd2c434/src/anomalib/models/video/ai_vad/flow.py#L44-L56",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F229"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=torchvision%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F212"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import torch\nfrom torchvision.transforms.v2 import UniformTemporalSubsample\n\nvideo = torch.zeros(4, 3, 8, 8)\nsampled = UniformTemporalSubsample(num_samples=2)(video)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/pytorch/vision/blob/main/torchvision/transforms/v2/_temporal.py",
                  "label": [
                    {
                      "t": "text",
                      "text": "_temporal.py"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F217"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "ffmpeg-python",
          "name": [
            {
              "t": "fact",
              "fact": "F232"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/kkroening/ffmpeg-python"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/ffmpeg-python"
            },
            {
              "label": "Docs",
              "href": "https://github.com/kkroening/ffmpeg-python/blob/master/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F66"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F233"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F239"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F235"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F234"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/kkroening/ffmpeg-python/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F232"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F69"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F70"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F71"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F72"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F73"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F74"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F247"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F248"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/xinntao/Real-ESRGAN",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F247"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def __init__(self, args, audio, height, width, video_save_path, fps):\n    out_width, out_height = int(width * args.outscale), int(height * args.outscale)\n    if out_height > 2160:\n        print('You are generating video that is larger than 4K, which will be very slow due to IO speed.',\n              'We highly recommend to decrease the outscale(aka, -s).')\n\n    if audio is not None:\n        self.stream_writer = (\n            ffmpeg.input('pipe:', format='rawvideo', pix_fmt='bgr24', s=f'{out_width}x{out_height}',\n                         framerate=fps).output(\n                             audio,\n                             video_save_path,\n                             pix_fmt='yuv420p',\n                             vcodec='libx264',\n                             loglevel='error',\n                             acodec='copy').overwrite_output().run_async(\n                                 pipe_stdin=True, pipe_stdout=True, cmd=args.ffmpeg_bin))\n    else:\n        self.stream_writer = (\n            ffmpeg.input('pipe:', format='rawvideo', pix_fmt='bgr24', s=f'{out_width}x{out_height}',\n                         framerate=fps).output(\n                             video_save_path, pix_fmt='yuv420p', vcodec='libx264',\n                             loglevel='error').overwrite_output().run_async(\n                                 pipe_stdin=True, pipe_stdout=True, cmd=args.ffmpeg_bin))\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/xinntao/Real-ESRGAN/blob/a4abfb2979a7bbff3f69f58f58ae324608821e27/inference_realesrgan_video.py#L139-L162",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F246"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20ffmpeg-python%20for%20video%20capture%2C%20processing%20and%20encoding&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F232"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import ffmpeg\n\nstream = ffmpeg.input('input.mp4')\nstream = ffmpeg.output(stream, 'output.mp4')\nffmpeg.run(stream)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/kkroening/ffmpeg-python/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F237"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "moviepy",
          "name": [
            {
              "t": "fact",
              "fact": "F249"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/Zulko/moviepy"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/moviepy"
            },
            {
              "label": "Docs",
              "href": "https://github.com/Zulko/moviepy/blob/master/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F93"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F250"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F256"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F252"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F251"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/Zulko/moviepy/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F249"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F94"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F95"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F96"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F97"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F98"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F99"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F100"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F101"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F264"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F265"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/harry0703/MoneyPrinterTurbo",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F264"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _fit_clip_to_canvas(\n    clip,\n    *,\n    target_width: int,\n    target_height: int,\n    fit_mode: VideoFitMode | str = VideoFitMode.cover,\n):\n    \"\"\"Resize a clip to an exact canvas using cover/crop or contain/letterbox.\"\"\"\n    source_width, source_height = (int(value) for value in clip.size)\n    target_width = int(target_width)\n    target_height = int(target_height)\n    if min(source_width, source_height, target_width, target_height) <= 0:\n        raise ValueError(\n            \"video dimensions must be positive: \"\n            f\"source={source_width}x{source_height}, \"\n            f\"target={target_width}x{target_height}\"\n        )\n\n    mode = VideoFitMode(fit_mode)\n    if (source_width, source_height) == (target_width, target_height):\n        return clip\n\n    # Exact aspect-ratio matches do not need either a crop or a background.\n    if source_width * target_height == source_height * target_width:\n        return clip.resized(new_size=(target_width, target_height))\n\n    width_scale = target_width / source_width\n    height_scale = target_height / source_height\n\n    if mode == VideoFitMode.cover:\n        # ceil guarantees the resized clip covers the complete canvas despite\n        # floating-point rounding. Any excess is removed symmetrically.\n        scale_factor = max(width_scale, height_scale)\n        resized_width = max(target_width, math.ceil(source_width * scale_factor))\n        resized_height = max(target_height, math.ceil(source_height * scale_factor))\n        resized_clip = clip.resized(new_size=(resized_width, resized_height))\n        crop_x = max(0, (resized_width - target_width) // 2)\n        crop_y = max(0, (resized_height - target_height) // 2)\n        return resized_clip.cropped(\n            x1=crop_x,\n            y1=crop_y,\n            width=target_width,\n            height=target_height,\n        )\n\n    # contain preserves the legacy behavior: show the complete source frame,\n    # centered over a black canvas when the aspect ratios differ.\n    scale_factor = min(width_scale, height_scale)\n    resized_width = max(1, min(target_width, int(source_width * scale_factor)))\n    resized_height = max(1, min(target_height, int(source_height * scale_factor)))\n    background = ColorClip(\n        size=(target_width, target_height), color=(0, 0, 0)\n    ).with_duration(clip.duration)\n    resized_clip = clip.resized(\n        new_size=(resized_width, resized_height)\n    ).with_position(\"center\")\n    # bg_color keeps the composite opaque, so MoviePy does not build and encode\n    # a full-frame transparency mask for every frame.\n    return CompositeVideoClip(\n        [background, resized_clip],\n        size=(target_width, target_height),\n        bg_color=(0, 0, 0),\n    ).with_duration(clip.duration)\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/harry0703/MoneyPrinterTurbo/blob/bdd8d328cc366fe70d9fa67ffd0443ba34b4a3e1/app/services/video.py#L916-L978",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F263"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20moviepy%20for%20video%20capture%2C%20processing%20and%20encoding&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F249"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from moviepy import VideoFileClip\n\nwith VideoFileClip('input.mp4') as clip:\n    frame = clip.get_frame(0)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/Zulko/moviepy/blob/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "quick_presentation.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F254"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "torchcodec",
          "name": [
            {
              "t": "fact",
              "fact": "F266"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/meta-pytorch/torchcodec"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/torchcodec"
            },
            {
              "label": "Docs",
              "href": "https://github.com/meta-pytorch/torchcodec/blob/main/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F273"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F267"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F275"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F269"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F268"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/meta-pytorch/torchcodec/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F266"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F283"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F284"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/nvidia-cosmos/cosmos-reason1",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F283"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _read_video(video_path):\n    decoder = torchcodec.decoders.VideoDecoder(video_path)\n\n    # Pre-allocate output tensor using metadata.\n    metadata = decoder.metadata\n    num_frames = metadata.num_frames\n    height, width = metadata.height, metadata.width\n    channels = 3\n\n    # Preallocate tensor: [T, C, H, W].\n    video_tensor = torch.empty((num_frames, channels, height, width), dtype=torch.uint8)\n\n    for idx, frame in enumerate(decoder):\n        assert frame.shape == (3, height, width)\n        video_tensor[idx, ...] = frame\n\n    return video_tensor\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/nvidia-cosmos/cosmos-reason1/blob/b84a3fae3284c375bb0cefab7b53aeb1d5059ab6/scripts/add_timestamps.py#L112-L128",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F282"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=torchcodec%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F266"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from torchcodec.decoders import VideoDecoder\n\ndecoder = VideoDecoder('input.mp4', device='cpu')\nframe = decoder[0]\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/meta-pytorch/torchcodec/blob/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F271"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which Python video processing library should I use?",
      "a": [
        {
          "t": "link",
          "href": "#av",
          "label": [
            {
              "t": "text",
              "text": "av"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits code that works with FFmpeg's libraries directly from Python. "
        },
        {
          "t": "link",
          "href": "#ffmpeg-python",
          "label": [
            {
              "t": "text",
              "text": "ffmpeg-python"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits complex filter graphs built as a Python pipeline. "
        },
        {
          "t": "link",
          "href": "#moviepy",
          "label": [
            {
              "t": "text",
              "text": "moviepy"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits edits that combine clips, titles, and audio."
        }
      ]
    },
    {
      "q": "How do I use FFmpeg in Python?",
      "a": [
        {
          "t": "link",
          "href": "#ffmpeg-python",
          "label": [
            {
              "t": "text",
              "text": "ffmpeg-python"
            }
          ]
        },
        {
          "t": "text",
          "text": " builds FFmpeg input, output, and filter graphs through a Python interface. It requires a separate FFmpeg install on the machine."
        }
      ]
    },
    {
      "q": "What is MoviePy?",
      "a": [
        {
          "t": "link",
          "href": "#moviepy",
          "label": [
            {
              "t": "text",
              "text": "moviepy"
            }
          ]
        },
        {
          "t": "text",
          "text": " edits and combines video clips, audio, titles, and custom effects. It cannot stream live video such as webcam capture."
        }
      ]
    },
    {
      "q": "What is imageio?",
      "a": [
        {
          "t": "link",
          "href": "#imageio",
          "label": [
            {
              "t": "text",
              "text": "imageio"
            }
          ]
        },
        {
          "t": "text",
          "text": " reads and writes images and video through selectable backend plugins. Video support needs the PyAV or FFmpeg backend installed."
        }
      ]
    },
    {
      "q": "What is PyAV?",
      "a": [
        {
          "t": "link",
          "href": "#av",
          "label": [
            {
              "t": "text",
              "text": "av"
            }
          ]
        },
        {
          "t": "text",
          "text": " provides Pythonic bindings for FFmpeg's libraries."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, imageio",
      "display": "imageio",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, imageio",
      "display": "45.2M",
      "asOf": "2026-11-16"
    },
    "F3": {
      "label": "License, imageio",
      "display": "BSD-2-Clause",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, imageio",
      "display": "2.37.4, Jul 2026",
      "asOf": "2026-07-20"
    },
    "F5": {
      "label": "Package release date, imageio",
      "display": "Jul 2026",
      "asOf": "2026-07-20"
    },
    "F6": {
      "label": "Repository stars, imageio",
      "display": "1.7K",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Reads video, imageio",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Writes video, imageio",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Audio tracks, imageio",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Frame transforms, imageio",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "Output formats, imageio",
      "display": "AVI, MPEG, MP4",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "Install, imageio",
      "display": "pip install imageio av",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "What it does, imageio",
      "display": "Provides image and video reading and writing through selectable backend plugins.",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths lead, imageio",
      "display": "Iterates frames without bulk loading",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths, imageio",
      "display": "Use imiter for videos too large to load together.",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "strengths lead, imageio",
      "display": "Applies filters through PyAV",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "strengths, imageio",
      "display": "Run FFmpeg filter sequences or graphs during video processing.",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations lead, imageio",
      "display": "Video support needs extra packages",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations, imageio",
      "display": "Install the selected PyAV or FFmpeg backend.",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "limitations lead, imageio",
      "display": "Audio can outlast shortened video",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "limitations, imageio",
      "display": "Trim audio separately when using the FFmpeg backend’s audio_path option.",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Quickstart, imageio",
      "display": "import imageio.v3 as iio\n\n# assume this is too large to keep all frames in memory\nsource = \"imageio:cockatoo.mp4\"\ndest = \"reencoded_cockatoo.mkv\"\n\nfps = iio.immeta(source, plugin=\"pyav\")[\"fps\"]\n\nwith iio.imopen(dest, \"w\", plugin=\"pyav\") as out_file:\n    out_file.init_video_stream(\"vp9\", fps=fps)\n\n    for frame in iio.imiter(source, plugin=\"pyav\"):\n        out_file.write_frame(frame)\n\n",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project function, imageio",
      "display": "@requires_duration\n@use_clip_fps_by_default\ndef write_gif_with_imageio(clip, filename, fps=None, loop=0, logger=\"bar\"):\n    \"\"\"Writes the gif with the Python library ImageIO (calls FreeImage).\"\"\"\n    logger = proglog.default_bar_logger(logger)\n\n    with iio.imopen(filename, \"w\", plugin=\"pillow\") as writer:\n        logger(message=\"MoviePy - Building file %s with imageio.\" % filename)\n        for frame in clip.iter_frames(fps=fps, logger=logger, dtype=\"uint8\"):\n            writer.write(\n                frame, duration=1000 / fps, loop=loop\n            )  # Duration is in ms not s\n",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project function reference, imageio",
      "display": "gif_writers.py · write_gif_with_imageio()",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project repository, imageio",
      "display": "Zulko/moviepy",
      "asOf": "2026-11-17"
    },
    "F26": {
      "label": "Project stars, Zulko/moviepy",
      "display": "15.2K",
      "asOf": "2026-11-17"
    },
    "F27": {
      "label": "Project push date, Zulko/moviepy",
      "display": "Aug 2026",
      "asOf": "2026-08-26"
    },
    "F28": {
      "label": "Library name, opencv-python",
      "display": "opencv-python",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "Monthly downloads, opencv-python",
      "display": "33.5M",
      "asOf": "2026-11-16"
    },
    "F30": {
      "label": "License, opencv-python",
      "display": "Apache-2.0",
      "asOf": "2026-11-17"
    },
    "F31": {
      "label": "Package release, opencv-python",
      "display": "5.0.0.93, Jul 2026",
      "asOf": "2026-07-02"
    },
    "F32": {
      "label": "Package release date, opencv-python",
      "display": "Jul 2026",
      "asOf": "2026-07-02"
    },
    "F33": {
      "label": "Repository stars, opencv-python",
      "display": "5.5K",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Reads video, opencv-python",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Writes video, opencv-python",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "Frame transforms, opencv-python",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "Output formats, opencv-python",
      "display": "AVI",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "Install, opencv-python",
      "display": "pip install opencv-python",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "What it does, opencv-python",
      "display": "Packages OpenCV bindings for frame capture, image processing, and video writing.",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths lead, opencv-python",
      "display": "Reads files and camera frames",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "strengths, opencv-python",
      "display": "Use VideoCapture with a filename or device index.",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "strengths lead, opencv-python",
      "display": "Processes frames before writing",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "strengths, opencv-python",
      "display": "Transform each frame before passing it to VideoWriter.",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "limitations lead, opencv-python",
      "display": "Codec availability varies by platform",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "limitations, opencv-python",
      "display": "Check the target system before choosing an encoder.",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "limitations lead, opencv-python",
      "display": "Wheel variants share one namespace",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "limitations, opencv-python",
      "display": "Install one OpenCV wheel variant per environment.",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Quickstart, opencv-python",
      "display": "import numpy as np\nimport cv2 as cv\n\ncap = cv.VideoCapture(0)\n\n# Get camera frame resolution\nframe_width = int(cap.get(cv.CAP_PROP_FRAME_WIDTH))\nframe_height = int(cap.get(cv.CAP_PROP_FRAME_HEIGHT))\n\n# Define the codec and create VideoWriter object\nfourcc = cv.VideoWriter_fourcc(*'XVID')\nout = cv.VideoWriter('output.avi', fourcc, 20.0, (frame_width, frame_height))\n\nwhile cap.isOpened():\n    ret, frame = cap.read()\n    if not ret:\n        print(\"Can't receive frame (stream end?). Exiting ...\")\n        break\n    frame = cv.flip(frame, 0)\n\n    # write the flipped frame\n    out.write(frame)\n\n    cv.imshow('frame', frame)\n    if cv.waitKey(1) == ord('q'):\n        break\n\n# Release everything if job is finished\ncap.release()\nout.release()\ncv.destroyAllWindows()\n",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project function, opencv-python",
      "display": "def _open_capture(self, frame_rate: FrameRate | None = None):\n    \"\"\"Opens capture referenced by this object and resets internal state.\"\"\"\n    if self._is_device:\n        assert isinstance(self._path_or_device, int)\n        if self._path_or_device < 0:\n            raise ValueError(\"Invalid/negative device ID specified.\")\n        input_is_video_file = False\n        capture_api = cv2.CAP_ANY\n    else:\n        assert isinstance(self._path_or_device, str)\n        capture_api = _get_capture_api(self._path_or_device)\n        input_is_video_file = not any(\n            identifier in self._path_or_device\n            for identifier in NON_VIDEO_FILE_INPUT_IDENTIFIERS\n        )\n        # We don't have a way of querying why opening a video fails (errors are logged at\n        # least), so provide a better error message if we try to open a missing file.\n        if input_is_video_file and not os.path.exists(self._path_or_device):\n            raise OSError(\"Video file not found.\")\n\n    cap = cv2.VideoCapture(self._path_or_device, capture_api)\n    if not cap.isOpened():\n        raise VideoOpenFailure(\n            \"Ensure file is valid video and system dependencies are up to date.\\n\"\n        )\n\n    # Display an error if the video codec type seems unsupported (#86) as this indicates\n    # potential video corruption, or may explain missing frames. We only perform this check\n    # for video files on-disk (skipped for devices, image sequences, streams, etc...).\n    codec_unsupported: bool = int(abs(cap.get(cv2.CAP_PROP_FOURCC))) == 0\n    if codec_unsupported and input_is_video_file:\n        logger.error(\n            \"Video codec detection failed. If output is incorrect:\\n\"\n            \"  - Re-encode the input video with ffmpeg\\n\"\n            \"  - Update OpenCV (pip install --upgrade opencv-python)\\n\"\n            \"  - Use the PyAV backend (--backend pyav)\\n\"\n            \"For details, see https://github.com/Breakthrough/PySceneDetect/issues/86\"\n        )\n\n    # Ensure the framerate is correct to avoid potential divide by zero errors. This can be\n    # addressed in the PyAV backend if required since it supports integer timebases.\n    assert frame_rate is None or frame_rate > MAX_FPS_DELTA, (\n        \"Frame rate must be validated if set!\"\n    )\n    if frame_rate is None:\n        frame_rate = cap.get(cv2.CAP_PROP_FPS)\n        if frame_rate < MAX_FPS_DELTA:\n            raise FrameRateUnavailable()\n\n    self._cap: cv2.VideoCapture = cap\n    self._frame_rate: Fraction = framerate_to_fraction(frame_rate)\n    self._has_grabbed = False\n    self._eof_timecode: Timecode | None = None\n    cap.set(cv2.CAP_PROP_ORIENTATION_AUTO, 1.0)  # https://github.com/opencv/opencv/issues/26795\n",
      "asOf": "2026-11-17"
    },
    "F50": {
      "label": "Project function reference, opencv-python",
      "display": "opencv.py · _open_capture()",
      "asOf": "2026-11-17"
    },
    "F51": {
      "label": "Project repository, opencv-python",
      "display": "Breakthrough/PySceneDetect",
      "asOf": "2026-11-17"
    },
    "F52": {
      "label": "Project stars, Breakthrough/PySceneDetect",
      "display": "5.5K",
      "asOf": "2026-11-17"
    },
    "F53": {
      "label": "Project push date, Breakthrough/PySceneDetect",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F54": {
      "label": "Library name, ffmpeg-python",
      "display": "ffmpeg-python",
      "asOf": "2026-11-17"
    },
    "F55": {
      "label": "Monthly downloads, ffmpeg-python",
      "display": "10.5M",
      "asOf": "2026-11-16"
    },
    "F56": {
      "label": "License, ffmpeg-python",
      "display": "Apache",
      "asOf": "2026-11-17"
    },
    "F57": {
      "label": "Package release, ffmpeg-python",
      "display": "0.2.0, Jul 2019",
      "asOf": "2019-07-06"
    },
    "F58": {
      "label": "Package release date, ffmpeg-python",
      "display": "Jul 2019",
      "asOf": "2019-07-06"
    },
    "F59": {
      "label": "Repository stars, ffmpeg-python",
      "display": "11.0K",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "Reads video, ffmpeg-python",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "Writes video, ffmpeg-python",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "Audio tracks, ffmpeg-python",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "Frame transforms, ffmpeg-python",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "Output formats, ffmpeg-python",
      "display": "MP4",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "Install, ffmpeg-python",
      "display": "pip install ffmpeg-python",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "What it does, ffmpeg-python",
      "display": "Builds FFmpeg input, output, and filter graphs through a Python interface.",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "strengths lead, ffmpeg-python",
      "display": "Builds complex filter graphs",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "strengths, ffmpeg-python",
      "display": "Connect trimming, overlays, and other filters in a Python pipeline.",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "strengths lead, ffmpeg-python",
      "display": "Exposes the generated command",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "strengths, ffmpeg-python",
      "display": "Inspect get_args or compile before running the pipeline.",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "limitations lead, ffmpeg-python",
      "display": "Requires a separate FFmpeg install",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "limitations, ffmpeg-python",
      "display": "Install FFmpeg and make its executable accessible before running pipelines.",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "limitations lead, ffmpeg-python",
      "display": "Filters can drop audio",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "limitations, ffmpeg-python",
      "display": "Select and recombine audio explicitly when the filter pipeline drops it.",
      "asOf": "2026-11-17"
    },
    "F75": {
      "label": "Quickstart, ffmpeg-python",
      "display": "import ffmpeg\n\nin_file = ffmpeg.input('input.mp4')\noverlay_file = ffmpeg.input('overlay.png')\n(\n    ffmpeg\n    .concat(\n        in_file.trim(start_frame=10, end_frame=20),\n        in_file.trim(start_frame=30, end_frame=40),\n    )\n    .overlay(overlay_file.hflip())\n    .drawbox(50, 50, 120, 120, color='red', thickness=5)\n    .output('out.mp4')\n    .run()\n)\n",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Project function, ffmpeg-python",
      "display": "def __init__(self, args, audio, height, width, video_save_path, fps):\n    out_width, out_height = int(width * args.outscale), int(height * args.outscale)\n    if out_height > 2160:\n        print('You are generating video that is larger than 4K, which will be very slow due to IO speed.',\n              'We highly recommend to decrease the outscale(aka, -s).')\n\n    if audio is not None:\n        self.stream_writer = (\n            ffmpeg.input('pipe:', format='rawvideo', pix_fmt='bgr24', s=f'{out_width}x{out_height}',\n                         framerate=fps).output(\n                             audio,\n                             video_save_path,\n                             pix_fmt='yuv420p',\n                             vcodec='libx264',\n                             loglevel='error',\n                             acodec='copy').overwrite_output().run_async(\n                                 pipe_stdin=True, pipe_stdout=True, cmd=args.ffmpeg_bin))\n    else:\n        self.stream_writer = (\n            ffmpeg.input('pipe:', format='rawvideo', pix_fmt='bgr24', s=f'{out_width}x{out_height}',\n                         framerate=fps).output(\n                             video_save_path, pix_fmt='yuv420p', vcodec='libx264',\n                             loglevel='error').overwrite_output().run_async(\n                                 pipe_stdin=True, pipe_stdout=True, cmd=args.ffmpeg_bin))\n",
      "asOf": "2026-11-17"
    },
    "F77": {
      "label": "Project function reference, ffmpeg-python",
      "display": "inference_realesrgan_video.py · __init__()",
      "asOf": "2026-11-17"
    },
    "F78": {
      "label": "Project repository, ffmpeg-python",
      "display": "xinntao/Real-ESRGAN",
      "asOf": "2026-11-17"
    },
    "F79": {
      "label": "Project stars, xinntao/Real-ESRGAN",
      "display": "37.5K",
      "asOf": "2026-11-17"
    },
    "F80": {
      "label": "Project push date, xinntao/Real-ESRGAN",
      "display": "Aug 2024",
      "asOf": "2024-08-06"
    },
    "F81": {
      "label": "Library name, moviepy",
      "display": "MoviePy",
      "asOf": "2026-11-17"
    },
    "F82": {
      "label": "Monthly downloads, moviepy",
      "display": "5.4M",
      "asOf": "2026-11-16"
    },
    "F83": {
      "label": "License, moviepy",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "Package release, moviepy",
      "display": "2.2.1, May 2025",
      "asOf": "2025-05-21"
    },
    "F85": {
      "label": "Package release date, moviepy",
      "display": "May 2025",
      "asOf": "2025-05-21"
    },
    "F86": {
      "label": "Repository stars, moviepy",
      "display": "15.2K",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "Reads video, moviepy",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "Writes video, moviepy",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "Audio tracks, moviepy",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "Frame transforms, moviepy",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "Output formats, moviepy",
      "display": "GIF",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "Install, moviepy",
      "display": "pip install moviepy",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "What it does, moviepy",
      "display": "Edits and combines video clips, audio, titles, and custom effects.",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "strengths lead, moviepy",
      "display": "Combines clips, titles, and audio",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "strengths, moviepy",
      "display": "Build an edited video from separate media clips.",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "strengths lead, moviepy",
      "display": "Supports custom frame effects",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "strengths, moviepy",
      "display": "Control video frames and audio when creating effects.",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "limitations lead, moviepy",
      "display": "Cannot stream live video",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "limitations, moviepy",
      "display": "Use another tool for webcam capture or live remote rendering.",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "limitations lead, moviepy",
      "display": "Pure conversion adds overhead",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "limitations, moviepy",
      "display": "Call FFmpeg directly when the task only converts video formats.",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Quickstart, moviepy",
      "display": "# Import everything needed to edit video clips\nfrom moviepy import *\n\n# Load file example.mp4 and extract only the subclip from 00:00:10 to 00:00:20\nclip = VideoFileClip(\"long_examples/example2.mp4\").subclipped(10, 20)\n\n# Reduce the audio volume to 80% of his original volume\nclip = clip.with_volume_scaled(0.8)\n\n# Generate a text clip. You can customize the font, color, etc.\ntxt_clip = TextClip(\n    font=\"example.ttf\", text=\"Big Buck Bunny\", font_size=70, color=\"white\"\n)\n\n# Say that you want it to appear for 10s at the center of the screen\ntxt_clip = txt_clip.with_position(\"center\").with_duration(10)\n\n# Overlay the text clip on the first video clip\nvideo = CompositeVideoClip([clip, txt_clip])\n\n# Write the result to a file (many options available!)\nvideo.write_videofile(\"result.mp4\")\n\n",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Developer need",
      "display": "Clip composition and titles",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "Why choose moviepy",
      "display": "combining separate media clips",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "Developer need in introduction",
      "display": "clip composition and titles",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Developer need",
      "display": "Frame-by-frame computer vision",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Why choose opencv-python",
      "display": "reading file or camera frames",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "Developer need in introduction",
      "display": "frame-by-frame computer vision",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "When to consider moviepy",
      "display": "the task combines clips, titles, and audio",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "Developer need",
      "display": "Explicit FFmpeg pipelines",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "Why choose ffmpeg-python",
      "display": "complex filter graphs",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "Developer need in introduction",
      "display": "explicit FFmpeg pipelines",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "Developer need",
      "display": "Incremental frame I/O",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "Why choose imageio",
      "display": "iterating large videos",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "Developer need in introduction",
      "display": "incremental frame I/O",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "Page introduction",
      "display": "Python video processing libraries let application developers read, transform, and write video frames.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: Which Python video library should I choose?",
      "display": "MoviePy composes video, audio, and titles.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: Which Python video library should I choose?",
      "display": "OpenCV captures frames from a video file or a device.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: Which Python video library should I choose?",
      "display": "ffmpeg-python builds complex FFmpeg signal graphs.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: Which Python video library should I choose?",
      "display": "ImageIO can iterate frames without reading the entire video together.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Does installing ffmpeg-python also install FFmpeg?",
      "display": "The Python wrapper does not download or install FFmpeg.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: Does installing ffmpeg-python also install FFmpeg?",
      "display": "Install FFmpeg separately and make it accessible on the executable path.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: Why does a filtered ffmpeg-python output lose its audio?",
      "display": "Some FFmpeg filters drop audio streams; select audio and video separately and recombine them.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "FAQ: Can I inspect an ffmpeg-python command before running it?",
      "display": "get_args returns command-line arguments, while compile also includes the executable.",
      "asOf": "2026-11-17"
    },
    "F125": {
      "label": "FAQ: Can MoviePy capture a webcam or stream a live render?",
      "display": "MoviePy does not stream video from a webcam or render live to a remote machine.",
      "asOf": "2026-11-17"
    },
    "F126": {
      "label": "FAQ: Should I use MoviePy only to convert a file format?",
      "display": "Its own task guidance recommends calling FFmpeg directly for conversion-only jobs.",
      "asOf": "2026-11-17"
    },
    "F127": {
      "label": "FAQ: Does MoviePy need a manually installed FFmpeg binary?",
      "display": "MoviePy uses FFmpeg for video reading and writing.",
      "asOf": "2026-11-17"
    },
    "F128": {
      "label": "FAQ: Does MoviePy need a manually installed FFmpeg binary?",
      "display": "Its installation guidance says ImageIO normally provisions FFmpeg automatically.",
      "asOf": "2026-11-17"
    },
    "F129": {
      "label": "FAQ: Does MoviePy need a manually installed FFmpeg binary?",
      "display": "Previewing separately requires an accessible ffplay installation.",
      "asOf": "2026-11-17"
    },
    "F130": {
      "label": "FAQ: Can multiple OpenCV wheel variants share an environment?",
      "display": "Install only one wheel variant because the packages share the cv2 namespace.",
      "asOf": "2026-11-17"
    },
    "F131": {
      "label": "FAQ: Will the same OpenCV encoder work on every platform?",
      "display": "Available video codecs depend on the platform.",
      "asOf": "2026-11-17"
    },
    "F132": {
      "label": "FAQ: How can ImageIO process videos that exceed memory?",
      "display": "Iterate frames with imiter instead of loading all frames together.",
      "asOf": "2026-11-17"
    },
    "F133": {
      "label": "FAQ: How can ImageIO process videos that exceed memory?",
      "display": "The own incremental encoder opens an output stream and writes each frame as it arrives.",
      "asOf": "2026-11-17"
    },
    "F134": {
      "label": "FAQ: Does ImageIO include its video backend by default?",
      "display": "The PyAV plugin requires PyAV to be installed.",
      "asOf": "2026-11-17"
    },
    "F135": {
      "label": "FAQ: Does ImageIO include its video backend by default?",
      "display": "The FFmpeg plugin also requires its separately installed backend.",
      "asOf": "2026-11-17"
    },
    "F136": {
      "label": "FAQ: Does shortening an ImageIO video also shorten its attached audio?",
      "display": "The FFmpeg backend’s audio_path option keeps the original audio length when the video is shorter.",
      "asOf": "2026-11-17"
    },
    "F137": {
      "label": "Library name, opencv-python-headless",
      "display": "opencv-python-headless",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Monthly downloads, opencv-python-headless",
      "display": "64.1M",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "License, opencv-python-headless",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "Package release, opencv-python-headless",
      "display": "5.1.0.95",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Package release date, opencv-python-headless",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Install, opencv-python-headless",
      "display": "pip install opencv-python-headless",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Quickstart, opencv-python-headless",
      "display": "import cv2\n\ncapture = cv2.VideoCapture('input.mp4')\nok, frame = capture.read()\ncapture.release()\n",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Official description, opencv-python-headless",
      "display": "Wraps the OpenCV Python bindings.",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Quickstart source file, opencv-python-headless",
      "display": "modules/videoio/include/opencv2/videoio.hpp",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Repository stars, opencv-python-headless",
      "display": "5.5K",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Video encoding, opencv-python-headless",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "Audio/video muxing, opencv-python-headless",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "NumPy frame output, opencv-python-headless",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Native video role, opencv-python-headless",
      "display": "Headless OpenCV frame capture, frame transforms, and video-only encoding; standard cv2 build variant.",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Setup and host requirements, opencv-python-headless",
      "display": "Existing decodable local video and functioning video backend. Install only one cv2 wheel variant. Headless lacks GUI windows; ok must be checked before consuming frame.",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Wheel license scopes, opencv-python-headless",
      "display": "{\"packaging\": \"MIT\", \"OpenCV\": \"Apache-2.0\", \"bundled_FFmpeg\": \"LGPL-2.1\"}",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Project function, opencv-python-headless",
      "display": "def _open_capture(self, frame_rate: FrameRate | None = None):\n    \"\"\"Opens capture referenced by this object and resets internal state.\"\"\"\n    if self._is_device:\n        assert isinstance(self._path_or_device, int)\n        if self._path_or_device < 0:\n            raise ValueError(\"Invalid/negative device ID specified.\")\n        input_is_video_file = False\n        capture_api = cv2.CAP_ANY\n    else:\n        assert isinstance(self._path_or_device, str)\n        capture_api = _get_capture_api(self._path_or_device)\n        input_is_video_file = not any(\n            identifier in self._path_or_device\n            for identifier in NON_VIDEO_FILE_INPUT_IDENTIFIERS\n        )\n        # We don't have a way of querying why opening a video fails (errors are logged at\n        # least), so provide a better error message if we try to open a missing file.\n        if input_is_video_file and not os.path.exists(self._path_or_device):\n            raise OSError(\"Video file not found.\")\n\n    cap = cv2.VideoCapture(self._path_or_device, capture_api)\n    if not cap.isOpened():\n        raise VideoOpenFailure(\n            \"Ensure file is valid video and system dependencies are up to date.\\n\"\n        )\n\n    # Display an error if the video codec type seems unsupported (#86) as this indicates\n    # potential video corruption, or may explain missing frames. We only perform this check\n    # for video files on-disk (skipped for devices, image sequences, streams, etc...).\n    codec_unsupported: bool = int(abs(cap.get(cv2.CAP_PROP_FOURCC))) == 0\n    if codec_unsupported and input_is_video_file:\n        logger.error(\n            \"Video codec detection failed. If output is incorrect:\\n\"\n            \"  - Re-encode the input video with ffmpeg\\n\"\n            \"  - Update OpenCV (pip install --upgrade opencv-python)\\n\"\n            \"  - Use the PyAV backend (--backend pyav)\\n\"\n            \"For details, see https://github.com/Breakthrough/PySceneDetect/issues/86\"\n        )\n\n    # Ensure the framerate is correct to avoid potential divide by zero errors. This can be\n    # addressed in the PyAV backend if required since it supports integer timebases.\n    assert frame_rate is None or frame_rate > MAX_FPS_DELTA, (\n        \"Frame rate must be validated if set!\"\n    )\n    if frame_rate is None:\n        frame_rate = cap.get(cv2.CAP_PROP_FPS)\n        if frame_rate < MAX_FPS_DELTA:\n            raise FrameRateUnavailable()\n\n    self._cap: cv2.VideoCapture = cap\n    self._frame_rate: Fraction = framerate_to_fraction(frame_rate)\n    self._has_grabbed = False\n    self._eof_timecode: Timecode | None = None\n    cap.set(cv2.CAP_PROP_ORIENTATION_AUTO, 1.0)  # https://github.com/opencv/opencv/issues/26795\n",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Project source file, opencv-python-headless",
      "display": "scenedetect/backends/opencv.py",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Project full_name, opencv-python-headless",
      "display": "Breakthrough/PySceneDetect",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Project stargazers_count, opencv-python-headless",
      "display": "5.5K",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Library name, av",
      "display": "av",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Monthly downloads, av",
      "display": "52.3M",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "License, av",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Package release, av",
      "display": "19.0.2",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Package release date, av",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Install, av",
      "display": "pip install av",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Quickstart, av",
      "display": "import av\n\nwith av.open('input.mp4') as container:\n    frame = next(container.decode(video=0))\n",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Official description, av",
      "display": "Provides Pythonic bindings for FFmpeg's libraries.",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "Quickstart source file, av",
      "display": "av/container/core.py",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Repository stars, av",
      "display": "3.3K",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Video encoding, av",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Audio/video muxing, av",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "NumPy frame output, av",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Native video role, av",
      "display": "Containers, streams, packets, decoded frames, and encoding through native FFmpeg libraries.",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Setup and host requirements, av",
      "display": "Existing nonempty local video with a video stream at index0; FFmpeg-backed PyAV wheel/runtime. Frame is a PyAV VideoFrame; use to_ndarray for NumPy.",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Project function, av",
      "display": "def encode_and_write_frame(self, frame: PixelArray, num_frames: int) -> None:\n    \"\"\"\n    For internal use only: takes a given frame in ``np.ndarray`` format and\n    write it to the stream\n    \"\"\"\n    for _ in range(num_frames):\n        # Notes: precomputing reusing packets does not work!\n        # I.e., you cannot do `packets = encode(...)`\n        # and reuse it, as it seems that `mux(...)`\n        # consumes the packet.\n        # The same issue applies for `av_frame`,\n        # reusing it renders weird-looking frames.\n        av_frame = av.VideoFrame.from_ndarray(frame, format=\"rgba\")\n        for packet in self.video_stream.encode(av_frame):\n            self.video_container.mux(packet)\n",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Project source file, av",
      "display": "manim/scene/scene_file_writer.py",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Project full_name, av",
      "display": "ManimCommunity/manim",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Project stargazers_count, av",
      "display": "42.6K",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Library name, imageio",
      "display": "imageio",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Monthly downloads, imageio",
      "display": "47.4M",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "License, imageio",
      "display": "BSD-2-Clause",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Package release, imageio",
      "display": "2.38.2",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "Package release date, imageio",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Install, imageio",
      "display": "pip install imageio imageio-ffmpeg",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Quickstart, imageio",
      "display": "import imageio\n\nwith imageio.get_reader('input.mp4', format='FFMPEG') as reader:\n    frame = reader.get_data(0)\n",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "Repository stars, imageio",
      "display": "1.7K",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Video encoding, imageio",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Audio/video muxing, imageio",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "NumPy frame output, imageio",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "Native video role, imageio",
      "display": "High-level image/video frame I/O with explicitly installed format backends.",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Setup and host requirements, imageio",
      "display": "Existing nonempty local video and installed imageio-ffmpeg/FFmpeg backend. format=FFMPEG deliberately selects that backend.",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Project function, imageio",
      "display": "def export_to_video(\n    video_frames: list[np.ndarray] | list[PIL.Image.Image],\n    output_video_path: str = None,\n    fps: int = 10,\n    quality: float = 5.0,\n    bitrate: int | None = None,\n    macro_block_size: int | None = 16,\n) -> str:\n    \"\"\"\n    quality:\n        Video output quality. Default is 5. Uses variable bit rate. Highest quality is 10, lowest is 0. Set to None to\n        prevent variable bitrate flags to FFMPEG so you can manually specify them using output_params instead.\n        Specifying a fixed bitrate using `bitrate` disables this parameter.\n\n    bitrate:\n        Set a constant bitrate for the video encoding. Default is None causing `quality` parameter to be used instead.\n        Better quality videos with smaller file sizes will result from using the `quality` variable bitrate parameter\n        rather than specifying a fixed bitrate with this parameter.\n\n    macro_block_size:\n        Size constraint for video. Width and height, must be divisible by this number. If not divisible by this number\n        imageio will tell ffmpeg to scale the image up to the next closest size divisible by this number. Most codecs\n        are compatible with a macroblock size of 16 (default), some can go smaller (4, 8). To disable this automatic\n        feature set it to None or 1, however be warned many players can't decode videos that are odd in size and some\n        codecs will produce poor results or fail. See https://en.wikipedia.org/wiki/Macroblock.\n    \"\"\"\n    # TODO: Dhruv. Remove by Diffusers release 0.33.0\n    # Added to prevent breaking existing code\n    if not is_imageio_available():\n        logger.warning(\n            (\n                \"It is recommended to use `export_to_video` with `imageio` and `imageio-ffmpeg` as a backend. \\n\"\n                \"These libraries are not present in your environment. Attempting to use legacy OpenCV backend to export video. \\n\"\n                \"Support for the OpenCV backend will be deprecated in a future Diffusers version\"\n            )\n        )\n        return _legacy_export_to_video(video_frames, output_video_path, fps)\n\n    if is_imageio_available():\n        import imageio\n    else:\n        raise ImportError(BACKENDS_MAPPING[\"imageio\"][1].format(\"export_to_video\"))\n\n    try:\n        imageio.plugins.ffmpeg.get_exe()\n    except AttributeError:\n        raise AttributeError(\n            (\n                \"Found an existing imageio backend in your environment. Attempting to export video with imageio. \\n\"\n                \"Unable to find a compatible ffmpeg installation in your environment to use with imageio. Please install via `pip install imageio-ffmpeg\"\n            )\n        )\n\n    if output_video_path is None:\n        output_video_path = tempfile.NamedTemporaryFile(suffix=\".mp4\").name\n\n    if isinstance(video_frames[0], np.ndarray):\n        video_frames = [(frame * 255).astype(np.uint8) for frame in video_frames]\n\n    elif isinstance(video_frames[0], PIL.Image.Image):\n        video_frames = [np.array(frame) for frame in video_frames]\n\n    with imageio.get_writer(\n        output_video_path, fps=fps, quality=quality, bitrate=bitrate, macro_block_size=macro_block_size\n    ) as writer:\n        for frame in video_frames:\n            writer.append_data(frame)\n\n    return output_video_path\n",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Project source file, imageio",
      "display": "src/diffusers/utils/export_utils.py",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Project full_name, imageio",
      "display": "huggingface/diffusers",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Project stargazers_count, imageio",
      "display": "34.9K",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Library name, imageio-ffmpeg",
      "display": "imageio-ffmpeg",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "Monthly downloads, imageio-ffmpeg",
      "display": "27.1M",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "License, imageio-ffmpeg",
      "display": "BSD-2-Clause",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Package release, imageio-ffmpeg",
      "display": "0.8.1",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Package release date, imageio-ffmpeg",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Install, imageio-ffmpeg",
      "display": "pip install imageio-ffmpeg",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Quickstart, imageio-ffmpeg",
      "display": "from imageio_ffmpeg import read_frames\n\nreader = read_frames('input.mp4')\nmetadata = next(reader)\nframe = next(reader)\nreader.close()\n",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Official description, imageio-ffmpeg",
      "display": "Wraps FFmpeg for Python.",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Quickstart source file, imageio-ffmpeg",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "Repository stars, imageio-ffmpeg",
      "display": "306",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Video encoding, imageio-ffmpeg",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Audio/video muxing, imageio-ffmpeg",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "NumPy frame output, imageio-ffmpeg",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "Native video role, imageio-ffmpeg",
      "display": "Direct FFmpeg subprocess frame generators and byte/buffer I/O; lower-level than ImageIO.",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Setup and host requirements, imageio-ffmpeg",
      "display": "Existing nonempty local video and available FFmpeg executable. First yield is metadata; later yields are bytes, not automatically NumPy arrays.",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Project function, imageio-ffmpeg",
      "display": "def _write_video(video_tensor, output_path, **ffmpeg_kwargs):\n    # Expected channel order is HWC (input is TCHW).\n    video_tensor = video_tensor.permute(0, 2, 3, 1).contiguous()\n    # This takes the height added for the timestamps into account.\n    height, width = video_tensor.shape[1], video_tensor.shape[2]\n    generator = imageio_ffmpeg.write_frames(\n        output_path,\n        size=(width, height),\n        **ffmpeg_kwargs,\n    )\n    try:\n        # Seed the generator.\n        generator.send(None)\n        generator.send(video_tensor.cpu().numpy())\n    finally:\n        generator.close()\n",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Project source file, imageio-ffmpeg",
      "display": "scripts/add_timestamps.py",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Project full_name, imageio-ffmpeg",
      "display": "nvidia-cosmos/cosmos-reason1",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Project stargazers_count, imageio-ffmpeg",
      "display": "964",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Library name, torchvision",
      "display": "torchvision",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Monthly downloads, torchvision",
      "display": "18.0M",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "License, torchvision",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Package release, torchvision",
      "display": "0.29.2",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Package release date, torchvision",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Install, torchvision",
      "display": "pip install torch torchvision",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Quickstart, torchvision",
      "display": "import torch\nfrom torchvision.transforms.v2 import UniformTemporalSubsample\n\nvideo = torch.zeros(4, 3, 8, 8)\nsampled = UniformTemporalSubsample(num_samples=2)(video)\n",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Official description, torchvision",
      "display": "Provides image and video datasets and models for PyTorch deep learning.",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "Quickstart source file, torchvision",
      "display": "torchvision/transforms/v2/_temporal.py",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "Repository stars, torchvision",
      "display": "18.0K",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Video encoding, torchvision",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Audio/video muxing, torchvision",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "NumPy frame output, torchvision",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Native video role, torchvision",
      "display": "Video models, optical flow, and tensor transforms; current open-source IO excludes its former video reader/writer.",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Setup and host requirements, torchvision",
      "display": "Compatible PyTorch/Torchvision wheel pair and CPU tensor shaped T,C,H,W. This samples already decoded video tensors; no file, model weights, GPU, or network asset is required.",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Pretrained model terms, torchvision",
      "display": "Individual weights can have separate dataset-derived terms; SWAG is noncommercial.",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Project function, torchvision",
      "display": "def pre_process(self, first_frame: torch.Tensor, last_frame: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:\n    \"\"\"Resize inputs to dimensions required by backbone.\n\n    Args:\n        first_frame (torch.Tensor): Starting frame of optical flow computation.\n        last_frame (torch.Tensor): Last frame of optical flow computation.\n\n    Returns:\n        tuple[torch.Tensor, torch.Tensor]: Preprocessed first and last frame.\n    \"\"\"\n    first_frame = F.resize(first_frame, size=[520, 960], antialias=False)\n    last_frame = F.resize(last_frame, size=[520, 960], antialias=False)\n    return self.transforms(first_frame, last_frame)\n",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Project source file, torchvision",
      "display": "src/anomalib/models/video/ai_vad/flow.py",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "Project full_name, torchvision",
      "display": "open-edge-platform/anomalib",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Project stargazers_count, torchvision",
      "display": "6.4K",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "Library name, ffmpeg-python",
      "display": "ffmpeg-python",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "Monthly downloads, ffmpeg-python",
      "display": "11.1M",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "License, ffmpeg-python",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Package release, ffmpeg-python",
      "display": "0.2.0",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Package release date, ffmpeg-python",
      "display": "Jul 2019",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "Install, ffmpeg-python",
      "display": "pip install ffmpeg-python",
      "asOf": "2026-11-20"
    },
    "F238": {
      "label": "Quickstart, ffmpeg-python",
      "display": "import ffmpeg\n\nstream = ffmpeg.input('input.mp4')\nstream = ffmpeg.output(stream, 'output.mp4')\nffmpeg.run(stream)\n",
      "asOf": "2026-11-20"
    },
    "F239": {
      "label": "Repository stars, ffmpeg-python",
      "display": "11.0K",
      "asOf": "2026-11-20"
    },
    "F240": {
      "label": "Video encoding, ffmpeg-python",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F241": {
      "label": "Audio/video muxing, ffmpeg-python",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F242": {
      "label": "NumPy frame output, ffmpeg-python",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F243": {
      "label": "Native video role, ffmpeg-python",
      "display": "FFmpeg input/filter/output graph construction and process execution.",
      "asOf": "2026-11-20"
    },
    "F244": {
      "label": "Setup and host requirements, ffmpeg-python",
      "display": "A separately installed FFmpeg executable on PATH, existing input, and a writable new output path. The similarly named ffmpeg/python-ffmpeg packages are different APIs.",
      "asOf": "2026-11-20"
    },
    "F245": {
      "label": "Project function, ffmpeg-python",
      "display": "def __init__(self, args, audio, height, width, video_save_path, fps):\n    out_width, out_height = int(width * args.outscale), int(height * args.outscale)\n    if out_height > 2160:\n        print('You are generating video that is larger than 4K, which will be very slow due to IO speed.',\n              'We highly recommend to decrease the outscale(aka, -s).')\n\n    if audio is not None:\n        self.stream_writer = (\n            ffmpeg.input('pipe:', format='rawvideo', pix_fmt='bgr24', s=f'{out_width}x{out_height}',\n                         framerate=fps).output(\n                             audio,\n                             video_save_path,\n                             pix_fmt='yuv420p',\n                             vcodec='libx264',\n                             loglevel='error',\n                             acodec='copy').overwrite_output().run_async(\n                                 pipe_stdin=True, pipe_stdout=True, cmd=args.ffmpeg_bin))\n    else:\n        self.stream_writer = (\n            ffmpeg.input('pipe:', format='rawvideo', pix_fmt='bgr24', s=f'{out_width}x{out_height}',\n                         framerate=fps).output(\n                             video_save_path, pix_fmt='yuv420p', vcodec='libx264',\n                             loglevel='error').overwrite_output().run_async(\n                                 pipe_stdin=True, pipe_stdout=True, cmd=args.ffmpeg_bin))\n",
      "asOf": "2026-11-20"
    },
    "F246": {
      "label": "Project source file, ffmpeg-python",
      "display": "inference_realesrgan_video.py",
      "asOf": "2026-11-20"
    },
    "F247": {
      "label": "Project full_name, ffmpeg-python",
      "display": "xinntao/Real-ESRGAN",
      "asOf": "2026-11-20"
    },
    "F248": {
      "label": "Project stargazers_count, ffmpeg-python",
      "display": "37.5K",
      "asOf": "2026-11-20"
    },
    "F249": {
      "label": "Library name, moviepy",
      "display": "moviepy",
      "asOf": "2026-11-20"
    },
    "F250": {
      "label": "Monthly downloads, moviepy",
      "display": "5.5M",
      "asOf": "2026-11-20"
    },
    "F251": {
      "label": "License, moviepy",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F252": {
      "label": "Package release, moviepy",
      "display": "2.2.1",
      "asOf": "2026-11-20"
    },
    "F253": {
      "label": "Package release date, moviepy",
      "display": "May 2025",
      "asOf": "2026-11-20"
    },
    "F254": {
      "label": "Install, moviepy",
      "display": "pip install moviepy",
      "asOf": "2026-11-20"
    },
    "F255": {
      "label": "Quickstart, moviepy",
      "display": "from moviepy import VideoFileClip\n\nwith VideoFileClip('input.mp4') as clip:\n    frame = clip.get_frame(0)\n",
      "asOf": "2026-11-20"
    },
    "F256": {
      "label": "Repository stars, moviepy",
      "display": "15.2K",
      "asOf": "2026-11-20"
    },
    "F257": {
      "label": "Video encoding, moviepy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F258": {
      "label": "Audio/video muxing, moviepy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F259": {
      "label": "NumPy frame output, moviepy",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F260": {
      "label": "Native video role, moviepy",
      "display": "Time-indexed video/audio clips, composition, editing, and rendered output.",
      "asOf": "2026-11-20"
    },
    "F261": {
      "label": "Setup and host requirements, moviepy",
      "display": "Existing nonempty local video and MoviePy FFmpeg dependencies. Context manager releases the file reader; get_frame returns a NumPy frame.",
      "asOf": "2026-11-20"
    },
    "F262": {
      "label": "Project function, moviepy",
      "display": "def _fit_clip_to_canvas(\n    clip,\n    *,\n    target_width: int,\n    target_height: int,\n    fit_mode: VideoFitMode | str = VideoFitMode.cover,\n):\n    \"\"\"Resize a clip to an exact canvas using cover/crop or contain/letterbox.\"\"\"\n    source_width, source_height = (int(value) for value in clip.size)\n    target_width = int(target_width)\n    target_height = int(target_height)\n    if min(source_width, source_height, target_width, target_height) <= 0:\n        raise ValueError(\n            \"video dimensions must be positive: \"\n            f\"source={source_width}x{source_height}, \"\n            f\"target={target_width}x{target_height}\"\n        )\n\n    mode = VideoFitMode(fit_mode)\n    if (source_width, source_height) == (target_width, target_height):\n        return clip\n\n    # Exact aspect-ratio matches do not need either a crop or a background.\n    if source_width * target_height == source_height * target_width:\n        return clip.resized(new_size=(target_width, target_height))\n\n    width_scale = target_width / source_width\n    height_scale = target_height / source_height\n\n    if mode == VideoFitMode.cover:\n        # ceil guarantees the resized clip covers the complete canvas despite\n        # floating-point rounding. Any excess is removed symmetrically.\n        scale_factor = max(width_scale, height_scale)\n        resized_width = max(target_width, math.ceil(source_width * scale_factor))\n        resized_height = max(target_height, math.ceil(source_height * scale_factor))\n        resized_clip = clip.resized(new_size=(resized_width, resized_height))\n        crop_x = max(0, (resized_width - target_width) // 2)\n        crop_y = max(0, (resized_height - target_height) // 2)\n        return resized_clip.cropped(\n            x1=crop_x,\n            y1=crop_y,\n            width=target_width,\n            height=target_height,\n        )\n\n    # contain preserves the legacy behavior: show the complete source frame,\n    # centered over a black canvas when the aspect ratios differ.\n    scale_factor = min(width_scale, height_scale)\n    resized_width = max(1, min(target_width, int(source_width * scale_factor)))\n    resized_height = max(1, min(target_height, int(source_height * scale_factor)))\n    background = ColorClip(\n        size=(target_width, target_height), color=(0, 0, 0)\n    ).with_duration(clip.duration)\n    resized_clip = clip.resized(\n        new_size=(resized_width, resized_height)\n    ).with_position(\"center\")\n    # bg_color keeps the composite opaque, so MoviePy does not build and encode\n    # a full-frame transparency mask for every frame.\n    return CompositeVideoClip(\n        [background, resized_clip],\n        size=(target_width, target_height),\n        bg_color=(0, 0, 0),\n    ).with_duration(clip.duration)\n",
      "asOf": "2026-11-20"
    },
    "F263": {
      "label": "Project source file, moviepy",
      "display": "app/services/video.py",
      "asOf": "2026-11-20"
    },
    "F264": {
      "label": "Project full_name, moviepy",
      "display": "harry0703/MoneyPrinterTurbo",
      "asOf": "2026-11-20"
    },
    "F265": {
      "label": "Project stargazers_count, moviepy",
      "display": "144.6K",
      "asOf": "2026-11-20"
    },
    "F266": {
      "label": "Library name, torchcodec",
      "display": "torchcodec",
      "asOf": "2026-11-20"
    },
    "F267": {
      "label": "Monthly downloads, torchcodec",
      "display": "4.5M",
      "asOf": "2026-11-20"
    },
    "F268": {
      "label": "License, torchcodec",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F269": {
      "label": "Package release, torchcodec",
      "display": "0.17.0",
      "asOf": "2026-11-20"
    },
    "F270": {
      "label": "Package release date, torchcodec",
      "display": "Sep 2026",
      "asOf": "2026-11-20"
    },
    "F271": {
      "label": "Install, torchcodec",
      "display": "pip install torch torchcodec",
      "asOf": "2026-11-20"
    },
    "F272": {
      "label": "Quickstart, torchcodec",
      "display": "from torchcodec.decoders import VideoDecoder\n\ndecoder = VideoDecoder('input.mp4', device='cpu')\nframe = decoder[0]\n",
      "asOf": "2026-11-20"
    },
    "F273": {
      "label": "Official description, torchcodec",
      "display": "Decodes video for PyTorch.",
      "asOf": "2026-11-20"
    },
    "F274": {
      "label": "Quickstart source file, torchcodec",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F275": {
      "label": "Repository stars, torchcodec",
      "display": "1.2K",
      "asOf": "2026-11-20"
    },
    "F276": {
      "label": "Video encoding, torchcodec",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F277": {
      "label": "Audio/video muxing, torchcodec",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F278": {
      "label": "NumPy frame output, torchcodec",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F279": {
      "label": "Native video role, torchcodec",
      "display": "PyTorch tensor decoding and encoding with CPU/GPU paths and explicit FFmpeg/runtime requirements.",
      "asOf": "2026-11-20"
    },
    "F280": {
      "label": "Setup and host requirements, torchcodec",
      "display": "Compatible PyTorch/TorchCodec wheels and supported FFmpeg runtime, existing nonempty video. CPU explicitly selected; output frame is a PyTorch C,H,W tensor.",
      "asOf": "2026-11-20"
    },
    "F281": {
      "label": "Project function, torchcodec",
      "display": "def _read_video(video_path):\n    decoder = torchcodec.decoders.VideoDecoder(video_path)\n\n    # Pre-allocate output tensor using metadata.\n    metadata = decoder.metadata\n    num_frames = metadata.num_frames\n    height, width = metadata.height, metadata.width\n    channels = 3\n\n    # Preallocate tensor: [T, C, H, W].\n    video_tensor = torch.empty((num_frames, channels, height, width), dtype=torch.uint8)\n\n    for idx, frame in enumerate(decoder):\n        assert frame.shape == (3, height, width)\n        video_tensor[idx, ...] = frame\n\n    return video_tensor\n",
      "asOf": "2026-11-20"
    },
    "F282": {
      "label": "Project source file, torchcodec",
      "display": "scripts/add_timestamps.py",
      "asOf": "2026-11-20"
    },
    "F283": {
      "label": "Project full_name, torchcodec",
      "display": "nvidia-cosmos/cosmos-reason1",
      "asOf": "2026-11-20"
    },
    "F284": {
      "label": "Project stargazers_count, torchcodec",
      "display": "964",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best Python video processing libraries MoviePy OpenCV ffmpeg-python ImageIO code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
