Re: [FFmpeg-devel] [PATCH v4 1/1] avdevice/gdigrab add use_captureblt option
在 2020/1/17 10:04, fgodt 写道: On 2020/1/17 上午2:00, Calvin Walton wrote: On Thu, 2020-01-16 at 09:08 +0800, fgodt wrote: By default, this is set to @code{1}, which means that gdigrab will use the CAPTUREBLT flag when grabbing images of a window. With this flag set, gdigrab will capture the entire contents of a window even if it is covered by other windows on the screen. If this option is set to @code{0}, the image captured will match what you see on the screen: the contents of any windows covering the selected window will be visible in the capture. Depending on your Windows version and graphics settings, you may see the mouse cursor flicker on your screen while capturing with this option set to @code{1}. If that happens, you can disable CAPTUREBLT by setting this option to @code{0}. Thanks for you suggestion, but there is issue, without the CAPTUREBLT flag not change any thing for normal window in captured video, the worke same like use CAPTUREBLT flag. So the can capture window even if it is covered. Ah, fun, this is based on a misinterpretation of the windows documentation: CAPTUREBLT Includes any windows that are layered on top of your window in the resulting image. By default, the image only contains your window. But according to this StackOverflow response: https://stackoverflow.com/a/4646999 What that actually means is that CAPTUREBLT includes windows with the "WS_EX_LAYERED" window style that overlap the window, not *any* window. Layered windows are described in: https://docs.microsoft.com/en-us/windows/win32/winmsg/window-features#layered-windows I think we should unconditionally remove the CAPTUREBLT flag, there's no need for any options or documentation changes. Thanks, if we remove CAPTUREBLT flag the user may can't capture layered window(use WS_EX_LAYERED extended), it is ok for this? Judging from this mail, remove CAPTUREBLT flag looks good for solve this issue. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 1/1] avdevice/gdigrab add use_captureblt option
On 2020/1/17 上午2:00, Calvin Walton wrote: On Thu, 2020-01-16 at 09:08 +0800, fgodt wrote: By default, this is set to @code{1}, which means that gdigrab will use the CAPTUREBLT flag when grabbing images of a window. With this flag set, gdigrab will capture the entire contents of a window even if it is covered by other windows on the screen. If this option is set to @code{0}, the image captured will match what you see on the screen: the contents of any windows covering the selected window will be visible in the capture. Depending on your Windows version and graphics settings, you may see the mouse cursor flicker on your screen while capturing with this option set to @code{1}. If that happens, you can disable CAPTUREBLT by setting this option to @code{0}. Thanks for you suggestion, but there is issue, without the CAPTUREBLT flag not change any thing for normal window in captured video, the worke same like use CAPTUREBLT flag. So the can capture window even if it is covered. Ah, fun, this is based on a misinterpretation of the windows documentation: CAPTUREBLT Includes any windows that are layered on top of your window in the resulting image. By default, the image only contains your window. But according to this StackOverflow response: https://stackoverflow.com/a/4646999 What that actually means is that CAPTUREBLT includes windows with the "WS_EX_LAYERED" window style that overlap the window, not *any* window. Layered windows are described in: https://docs.microsoft.com/en-us/windows/win32/winmsg/window-features#layered-windows I think we should unconditionally remove the CAPTUREBLT flag, there's no need for any options or documentation changes. Thanks, if we remove CAPTUREBLT flag the user may can't capture layered window(use WS_EX_LAYERED extended), it is ok for this? fgodt ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 1/1] avdevice/gdigrab add use_captureblt option
On Thu, 2020-01-16 at 09:08 +0800, fgodt wrote: > > By default, this is set to @code{1}, which means that gdigrab will > > use > > the CAPTUREBLT flag when grabbing images of a window. With this > > flag > > set, gdigrab will capture the entire contents of a window even if > > it is > > covered by other windows on the screen. > > > > If this option is set to @code{0}, the image captured will match > > what > > you see on the screen: the contents of any windows covering the > > selected window will be visible in the capture. > > > > Depending on your Windows version and graphics settings, you may > > see > > the mouse cursor flicker on your screen while capturing with this > > option set to @code{1}. If that happens, you can disable CAPTUREBLT > > by > > setting this option to @code{0}. > > > Thanks for you suggestion, but there is issue, without the > CAPTUREBLT > flag not change any thing for normal window in captured video, the > worke > same like use CAPTUREBLT flag. So the can capture window even if it > is > covered. Ah, fun, this is based on a misinterpretation of the windows documentation: CAPTUREBLT Includes any windows that are layered on top of your window in the resulting image. By default, the image only contains your window. But according to this StackOverflow response: https://stackoverflow.com/a/4646999 What that actually means is that CAPTUREBLT includes windows with the "WS_EX_LAYERED" window style that overlap the window, not *any* window. Layered windows are described in: https://docs.microsoft.com/en-us/windows/win32/winmsg/window-features#layered-windows I think we should unconditionally remove the CAPTUREBLT flag, there's no need for any options or documentation changes. -- Calvin Walton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 1/1] avdevice/gdigrab add use_captureblt option
On 2020/1/14 上午7:24, Carl Eugen Hoyos wrote: Am Mo., 13. Jan. 2020 um 17:10 Uhr schrieb Derek Buitenhuis : On 11/01/2020 09:18, fgodt...@hotmail.com wrote: From: FgoDt Add use_captureblt option for disable or use CAPTUREBLT flag, when useing the bitblt function with CAPTUREBLT may caused the Windows mouse cursor flicker. most time we don't need this flag to capture window I tested on Windows 10 works fine Signed-off-by: fgodt --- doc/indevs.texi | 7 +++ libavdevice/gdigrab.c | 10 +- 2 files changed, 16 insertions(+), 1 deletion(-) Does it make sense to name this something like 'capature_layered_windows'? Using the name of the flag is a bit unintuitive from a user perspective. Not sure if "capture_layered_windows" is more intuitive than using the name of an os flag but ... Agree with it Same for the description. Shouldn't the description explain that this option helps against mouse cursor flicker? I think explain is necessary, most people don't know this flag will make mouse flicker. If user find mouse cursor flicker they will find solution on doc fgodt ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 1/1] avdevice/gdigrab add use_captureblt option
On 2020/1/15 上午3:01, Calvin Walton wrote: On Sat, 2020-01-11 at 17:18 +0800, fgodt...@hotmail.com wrote: From: FgoDt Add use_captureblt option for disable or use CAPTUREBLT flag, when useing the bitblt function with CAPTUREBLT may caused the Windows mouse cursor flicker. most time we don't need this flag to capture window I tested on Windows 10 works fine I have a suggestion for improving the documentation, see below. Can you please test for me: If you use use_captureblt=0 and draw_mouse=0 is the mouse cursor visible or not in the recorded video? The mouse cursor not in video +@item use_captureblt +gdigrab use CAPTUREBLT flag to capture window or desktop by default, which may make Windows mouse cursor flickering. +If not capture layered window you can set value @code{0} disable CAPTUREBLT flag, to fix Windows cursor flickering. +Default value is @code{1} + +Note the value @code{1} is essential to capture layered window @item use_captureblt By default, this is set to @code{1}, which means that gdigrab will use the CAPTUREBLT flag when grabbing images of a window. With this flag set, gdigrab will capture the entire contents of a window even if it is covered by other windows on the screen. If this option is set to @code{0}, the image captured will match what you see on the screen: the contents of any windows covering the selected window will be visible in the capture. Depending on your Windows version and graphics settings, you may see the mouse cursor flicker on your screen while capturing with this option set to @code{1}. If that happens, you can disable CAPTUREBLT by setting this option to @code{0}. Thanks for you suggestion, but there is issue, without the CAPTUREBLT flag not change any thing for normal window in captured video, the worke same like use CAPTUREBLT flag. So the can capture window even if it is covered. fgodt ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 1/1] avdevice/gdigrab add use_captureblt option
On Sat, 2020-01-11 at 17:18 +0800, fgodt...@hotmail.com wrote: > From: FgoDt > > Add use_captureblt option for disable or use CAPTUREBLT flag, when > useing the bitblt function with CAPTUREBLT may caused the Windows > mouse cursor flicker. most time we don't need this flag to capture > window > I tested on Windows 10 works fine I have a suggestion for improving the documentation, see below. Can you please test for me: If you use use_captureblt=0 and draw_mouse=0 is the mouse cursor visible or not in the recorded video? > +@item use_captureblt > +gdigrab use CAPTUREBLT flag to capture window or desktop by default, > which may make Windows mouse cursor flickering. > +If not capture layered window you can set value @code{0} disable > CAPTUREBLT flag, to fix Windows cursor flickering. > +Default value is @code{1} > + > +Note the value @code{1} is essential to capture layered window @item use_captureblt By default, this is set to @code{1}, which means that gdigrab will use the CAPTUREBLT flag when grabbing images of a window. With this flag set, gdigrab will capture the entire contents of a window even if it is covered by other windows on the screen. If this option is set to @code{0}, the image captured will match what you see on the screen: the contents of any windows covering the selected window will be visible in the capture. Depending on your Windows version and graphics settings, you may see the mouse cursor flicker on your screen while capturing with this option set to @code{1}. If that happens, you can disable CAPTUREBLT by setting this option to @code{0}. -- Calvin Walton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 1/1] avdevice/gdigrab add use_captureblt option
Am Mo., 13. Jan. 2020 um 17:10 Uhr schrieb Derek Buitenhuis : > > On 11/01/2020 09:18, fgodt...@hotmail.com wrote: > > From: FgoDt > > > > Add use_captureblt option for disable or use CAPTUREBLT flag, when useing > > the bitblt function with CAPTUREBLT may caused the Windows mouse cursor > > flicker. most time we don't need this flag to capture window > > I tested on Windows 10 works fine > > > > Signed-off-by: fgodt > > --- > > doc/indevs.texi | 7 +++ > > libavdevice/gdigrab.c | 10 +- > > 2 files changed, 16 insertions(+), 1 deletion(-) > > Does it make sense to name this something like 'capature_layered_windows'? > > Using the name of the flag is a bit unintuitive from a user perspective. Not sure if "capture_layered_windows" is more intuitive than using the name of an os flag but ... > Same for the description. Shouldn't the description explain that this option helps against mouse cursor flicker? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v4 1/1] avdevice/gdigrab add use_captureblt option
On 11/01/2020 09:18, fgodt...@hotmail.com wrote: > From: FgoDt > > Add use_captureblt option for disable or use CAPTUREBLT flag, when useing the > bitblt function with CAPTUREBLT may caused the Windows mouse cursor flicker. > most time we don't need this flag to capture window > I tested on Windows 10 works fine > > Signed-off-by: fgodt > --- > doc/indevs.texi | 7 +++ > libavdevice/gdigrab.c | 10 +- > 2 files changed, 16 insertions(+), 1 deletion(-) Does it make sense to name this something like 'capature_layered_windows'? Using the name of the flag is a bit unintuitive from a user perspective. Same for the description. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v4 1/1] avdevice/gdigrab add use_captureblt option
From: FgoDt Add use_captureblt option for disable or use CAPTUREBLT flag, when useing the bitblt function with CAPTUREBLT may caused the Windows mouse cursor flicker. most time we don't need this flag to capture window I tested on Windows 10 works fine Signed-off-by: fgodt --- doc/indevs.texi | 7 +++ libavdevice/gdigrab.c | 10 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/indevs.texi b/doc/indevs.texi index 6f5afaf344..967ae22991 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -743,6 +743,13 @@ When capturing a region with @var{video_size}, set the distance from the top edg Note that the offset calculation is from the top left corner of the primary monitor on Windows. If you have a monitor positioned above your primary monitor, you will need to use a negative @var{offset_y} value to move the region to that monitor. +@item use_captureblt +gdigrab use CAPTUREBLT flag to capture window or desktop by default, which may make Windows mouse cursor flickering. +If not capture layered window you can set value @code{0} disable CAPTUREBLT flag, to fix Windows cursor flickering. +Default value is @code{1} + +Note the value @code{1} is essential to capture layered window + @end table @section iec61883 diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c index f406fa..658719e929 100644 --- a/libavdevice/gdigrab.c +++ b/libavdevice/gdigrab.c @@ -53,6 +53,8 @@ struct gdigrab { intoffset_x;/**< Capture x offset (private option) */ intoffset_y;/**< Capture y offset (private option) */ +intuse_captureblt; /**< Capture gdi window with CAPTUREBLT flag (private option) */ + HWND hwnd;/**< Handle of the window for the grab */ HDCsource_hdc; /**< Source device context */ HDCdest_hdc;/**< Destination, source-compatible DC */ @@ -542,6 +544,8 @@ static int gdigrab_read_packet(AVFormatContext *s1, AVPacket *pkt) int64_t curtime, delay; +unsigned long flag = SRCCOPY; + /* Calculate the time of the next frame */ time_frame += INT64_C(100); @@ -570,12 +574,15 @@ static int gdigrab_read_packet(AVFormatContext *s1, AVPacket *pkt) return AVERROR(ENOMEM); pkt->pts = curtime; +if(gdigrab->use_captureblt) +flag |= CAPTUREBLT; + /* Blit screen grab */ if (!BitBlt(dest_hdc, 0, 0, clip_rect.right - clip_rect.left, clip_rect.bottom - clip_rect.top, source_hdc, -clip_rect.left, clip_rect.top, SRCCOPY | CAPTUREBLT)) { +clip_rect.left, clip_rect.top, flag)) { WIN32_API_ERROR("Failed to capture image"); return AVERROR(EIO); } @@ -639,6 +646,7 @@ static const AVOption options[] = { { "video_size", "set video frame size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, DEC }, { "offset_x", "capture area x offset", OFFSET(offset_x), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC }, { "offset_y", "capture area y offset", OFFSET(offset_y), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC }, +{ "use_captureblt", "capture gdi window use CAPTTUREBLT flag", OFFSET(use_captureblt), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, DEC }, { NULL }, }; -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".