Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yzld2002 committed Sep 6, 2024
1 parent c00a3d1 commit f35ce7b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions vision_agent/utils/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import List, Optional, Tuple

import cv2
import av
import av # type: ignore
import numpy as np
from decord import VideoReader # type: ignore

Expand Down Expand Up @@ -58,8 +58,9 @@ def video_writer(
filename = tempfile.NamedTemporaryFile(delete=False, suffix=".mp4").name
container = av.open(filename, mode="w")
stream = container.add_stream("h264", rate=fps)
stream.width = frames[0].shape[1]
stream.height = frames[0].shape[0]
height, width = frames[0].shape[:1]
stream.height = height - (height % 2)
stream.width = width - (width % 2)
stream.pix_fmt = "yuv420p"
for frame in frames:
# Remove the alpha channel (convert RGBA to RGB)
Expand Down

0 comments on commit f35ce7b

Please sign in to comment.