-
Notifications
You must be signed in to change notification settings - Fork 13
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
The selected region seems to have a bit of an issue. #26
Comments
What is your scaling setting? |
My scaling is just 1. |
When scaling is set to 1, it seems that the issue only occurs when the starting point of the region is an odd number. For example, with |
When the scaling is not 1, the same issue persists, but the patterns mentioned above may vary. |
Simple script for generating test background images #!/bin/python
from PIL import Image, ImageDraw
width, height = 2560, 1440
image = Image.new("RGB", (width, height), "black")
draw = ImageDraw.Draw(image)
line_color = (255, 255, 255)
line_y1, line_y2 = 100, 199
draw.line([(0, line_y1), (width, line_y1)], fill=line_color)
draw.line([(0, line_y2), (width, line_y2)], fill=line_color)
line_x1, line_x2 = 100, 199
draw.line([(line_x1, 0), (line_x1, height)], fill=line_color)
draw.line([(line_x2, 0), (line_x2, height)], fill=line_color)
image.save("test_image.png") |
Thanks so much for all the detailed instructions with this bug report. Unfortunately, it seems this is either a ffmpeg or vaapi bug. What hardware are you on (if you're on different hardware, then it's almost certainally a ffmpeg bug). screenrecord.mp4Given this full-sceen capture (I've modified ffmpeg -vaapi_device /dev/dri/renderD129 -i screenrecord.mp4 -vf 'hwupload, crop=200:200:99:99,scale_vaapi=format=nv12:w=200:h=200' -c:v h264_vaapi croped.mp4 ffmpeg -vaapi_device /dev/dri/renderD129 -i screenrecord.mp4 -vf 'hwupload, crop=200:200:100:100,scale_vaapi=format=nv12:w=200:h=200' -c:v h264_vaapi croped.mp4 gives (correctly): ffmpeg -vaapi_device /dev/dri/renderD129 -i screenrecord.mp4 -vf 'hwupload, crop=200:200:101:101,scale_vaapi=format=nv12:w=200:h=200' -c:v h264_vaapi croped.mp4 ffmpeg -vaapi_device /dev/dri/renderD129 -i screenrecord.mp4 -vf 'hwupload, crop=200:200:102:102,scale_vaapi=format=nv12:w=200:h=200' -c:v h264_vaapi croped.mp4 |
Actually, there's an diff --git a/src/main.rs b/src/main.rs
index c9f11f7..b0ba2fb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1633,7 +1633,7 @@ fn video_filter(
.input("out", 0)
.unwrap()
.parse(&format!(
- "crop={roi_w}:{roi_h}:{roi_x}:{roi_y},scale_vaapi=format={output_real_pixfmt_name}:w={enc_w}:h={enc_h}{}",
+ "crop={roi_w}:{roi_h}:{roi_x}:{roi_y}:exact=1,scale_vaapi=format={output_real_pixfmt_name}:w={enc_w}:h={enc_h}{}",
if let EncodePixelFormat::Vaapi(_) = pix_fmt {
""
} else {
`` |
the
it just assumes all HW formats are 2x2 subsampled.... |
Reported upstream to https://trac.ffmpeg.org/ticket/10669 |
This patch indeed works for me. Thank you for addressing the issue I encountered. I hope ffmpeg can fix this bug. |
Thanks for confirming. It's harmless to add (it should make no difference in this situation, but does due to a bug), so I just pushed e0945eb. Again, thanks so much for such a detailed report! Sorry it took me a bit to get to. |
I use wf-info to obtain the region information of the window, and then pass it to wl-screenrec. I've noticed that there seems to be an unexpected border on the left side. However, when I use wf-recorder to record the same region, I don't encounter this issue.
I can't guarantee whether wf-info has obtained the correct region, so I generated a pure black image with a resolution of
2560x1440
, which matches my screen. I then added a white line at the pixel positionsx=99, x=198, y=99, and y=198
on the image.Then, I recorded the
(99,99 100x100)
region separately using wl-screenrec and wf-recorder. In theory, there should have been a white pixel border in the recording. wf-recorder indeed captured it, while wl-screenrec seemed to have a bit of an issue, as shown in the following image.I then attempted to use wl-screenrec to record the
(100,100 100x100)
region to see if it was a simple offset issue. The result is as follows, the image dimensions are indeed100x100
but it appears that it's not just a matter of offset.The text was updated successfully, but these errors were encountered: