Skip to content

TypeError: an integer is required #1664

@raphaelschwinger

Description

@raphaelschwinger

Overview

I would like to output a video but get the follwoing error:

import torch
import torchvision

# Example dummy video tensor
video = torch.randint(0, 255, (30, 720, 1280, 3), dtype=torch.uint8)  # 30 frames of 720p video

# Write the video
torchvision.io.write_video("test_video.mp4", video, fps=30, video_codec="h264")

Error:

File av/video/frame.pyx:193, in av.video.frame.VideoFrame.pict_type.__set__()

TypeError: an integer is required

Expected behavior

Get a video file.

Actual behavior

Error

Versions

python = "^3.10"
torch = "^2.5.1"
torchvision = "^0.20.1"
lightning = "^2.4.0"
torchmetrics = "^1.5.1"
hydra-core = "^1.3.2"
hydra-colorlog = "^1.2.0"
hydra-optuna-sweeper = "^1.2.0"
rootutils = "^1.0.7"
pre-commit = "^4.0.1"
rich = "^13.9.4"
pytest = "^8.3.3"
torchrl = "^0.6.0"
tensordict = "^0.6.2"
ipykernel = "^6.29.5"
gymnasium = {extras = ["atari"], version = "<1.0.0"}
pygame = "^2.6.1"
av = "^14.0.0"

ffmpeg version 4.4.2-0ubuntu0.22.04.1

Research

I have done the following:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions