Closed ivan94fi closed 4 months ago
Hi, closing this as it is not a bug, I inverted the height and width variables so something bad happened. In fact, the code that I posted in this issue works correctly, as I corrected the mistake just before pasting the code here.
I will edit the issue to highlight this.
Sorry for the confusion, and thank you for the work!
$${\color{red}}$$
${{\color{red}\Huge{\textsf{ [EDIT]: this is not an issue, this code actually works }}}}\$
Overview
I am using a modified version of examples/numpy/generate_video.py to obtain a video with a clear edge.
When converting the numpy frames to video the edge between colors gets blurry, see images below.
Expected behavior
There should be a clear edge between the magenta and the green.
I expect to see something like this:
Actual behavior
[EDIT] The actual behavior is correct.
Old Content
This is what I get instead, there is one pixel which has an interpolated color: ![28-05-2024_15-21-26](https://github.com/PyAV-Org/PyAV/assets/30447023/1c31dbd1-22d1-4bae-bc03-ca7bffc4586a)Investigation
[EDIT]
Old Content
I tried using different colors, encoders, container, color formats, but the issue remains. Even with a yuv444p pixel format the issue persists. When saving the single frame as an image like this (code included in the MRE below): ```python frame = av.VideoFrame.from_ndarray(img, format="rgb24") frame.to_image().save("rgb24.png") for f in ["yuv420p", "yuv422p", "yuv444p"]: frame.reformat(format=f).to_image().save(f"{f}.png") ``` the only one that is wrong is the "yuv420p" version, but this is somehow expected, I think. The 444 and 422 versions are as I expect them to be. Here is how the `yuv420p.png` saved from the script looks: ![28-05-2024_15-48-05](https://github.com/PyAV-Org/PyAV/assets/30447023/d34c34dd-46fb-4259-a2cc-f56aefb9d886) Instead, when saving the video the colors are always blended, no matter what pixel format is used.Reproduction
Save and execute the script and you will find these files in the same directory:
test.mkv
,yuv420p.png
,yuv422p.png
,yuv444p.png
andrgb24.png
.Then use this to generate frames from video:
When using the correct rgb24.png as input to ffmpeg binary, the generated ffv1 video does not contain the color interpolation problem:
Versions
Research
I have done the following:
Additional context
What I was originally trying to accomplish is to generate a video where frames are composed of lines of alternating colors, to test some interlacing issues. But I stopped at the generation phase because I cannot get proper color separation.