Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update load_video node for more accurate color conversion and chroma reconstruction #2532

Merged
merged 3 commits into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from pathlib import Path
from typing import Any

import cv2
import ffmpeg
import numpy as np

Expand Down Expand Up @@ -68,7 +67,12 @@ def load_video_node(

ffmpeg_reader = (
ffmpeg.input(path)
.output("pipe:", format="rawvideo", pix_fmt="rgb24")
.output(
"pipe:",
format="rawvideo",
pix_fmt="bgr24",
sws_flags="lanczos+accurate_rnd+full_chroma_int+full_chroma_inp+bitexact",
)
.run_async(pipe_stdout=True, cmd=ffmpeg_path)
)

Expand Down Expand Up @@ -123,7 +127,6 @@ def iterator():
print("Can't receive frame (stream end?). Exiting ...")
break
in_frame = np.frombuffer(in_bytes, np.uint8).reshape([height, width, 3])
in_frame = cv2.cvtColor(in_frame, cv2.COLOR_RGB2BGR)
yield in_frame, index
index += 1

Expand Down