Jump to content

UEZ

MVPs
  • Posts

    7,537
  • Joined

  • Last visited

  • Days Won

    95

UEZ last won the day on April 2

UEZ had the most liked content!

About UEZ

  • Birthday 12/03/2007

Profile Information

  • Member Title
    Never say never
  • Location
    Germany
  • Interests
    Computer, watching movies, football (soccer), being lazy :-)

Recent Profile Visitors

12,198 profile views

UEZ's Achievements

  1. Last try - see above. Personally, I don't like this approach of using ffmpeg and mpv to display and record the webcam.
  2. I updated the code above - the latency should be better now.
  3. Made some updates - please try again.
  4. Try this: ;Code by UEZ build 2026-06-27 #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPIError.au3> Global $iW = 1280, $iH = 720 Global $sFFMPEG = '"...\FFMPEG\bin\ffmpeg.exe"' Global $sMPV = '"...\MPV\mpv.exe"' Global $sOutFile = "C:\Temp\WebCamRec.mkv" Global $aVid, $aAud _GetDShowDevices($sFFMPEG, $aVid, $aAud) If $aVid[0] = 0 Then Exit MsgBox(16, "Error", "No video capture device found") Global $sVideo = $aVid[1] ; first WebCam Global $sAudio = ($aAud[0] > 0) ? $aAud[1] : "" ; first micro, if available Global $bHasAudio = ($sAudio <> "") ; Input-Optionen MUESSEN vor dem -i stehen (gelten fuer den folgenden Input) Global $sInput = '-f dshow -rtbufsize 256M -video_size 1280x720 -framerate 30 -pixel_format nv12 ' & _ '-use_wallclock_as_timestamps 1 -i video="' & $sVideo & '"' If $bHasAudio Then $sInput &= ' -f dshow -use_wallclock_as_timestamps 1 -i audio="' & $sAudio & '"' Global $sAudioMap = $bHasAudio ? '-map 1:a -c:a aac -ar 48000 -ac 2 ' : '' Global $hGUI = GUICreate("WebCam + Live Preview + Record", $iW, $iH + 40, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPCHILDREN)) Global $idStop = GUICtrlCreateButton("Stop", 10, $iH + 6, 80, 26) Global $hChild = GUICreate("", $iW, $iH, 0, 0, $WS_CHILD, -1, $hGUI) GUISetState(@SW_SHOW, $hChild) GUISwitch($hGUI) GUISetState(@SW_SHOW, $hGUI) Global $wid = Number($hChild) If FileExists($sOutFile) Then FileDelete($sOutFile) Global $sUDP = "udp://127.0.0.1:1234?pkt_size=1316" Global $sCmd = $sFFMPEG & ' ' & $sInput & ' ' & _ '-filter_complex "[0:v]split[rec][tmp];[tmp]fps=30[prev]" ' & _ '-map "[rec]" -c:v libx264 -pix_fmt yuv420p ' & $sAudioMap & '"' & $sOutFile & '" ' & _ '-map "[prev]" -c:v libx264 -preset ultrafast -tune zerolatency -g 10 -an ' & _ '-fflags +nobuffer -flags +low_delay -muxdelay 0 -muxpreload 0 -flush_packets 1 ' & _ '-f mpegts ' & $sUDP Global $iPID = Run($sCmd, "", @SW_HIDE, $STDIN_CHILD) Global $sMpvPipe = "\\.\pipe\mpv_preview" Global $sMpvCmd = $sMPV & ' --wid=' & $wid & ' --no-audio --no-osc --force-window=yes ' & _ '--profile=low-latency --untimed --no-cache --demuxer-readahead-secs=0 ' & _ '--vd-queue-enable=no --demuxer-lavf-o=fflags=+nobuffer ' & _ '--demuxer-lavf-format=mpegts --input-ipc-server=' & $sMpvPipe & ' "' & $sUDP & '"' Global $iPIDmpv = Run($sMpvCmd, "") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idStop _StopAll($iPID, $iPIDmpv) ExitLoop EndSwitch WEnd GUIDelete($hGUI) Func _GetDShowDevices($sFFMPEG, ByRef $aVideo, ByRef $aAudio) Local $sExe = StringReplace($sFFMPEG, '"', '') Local $iPID = Run('"' & $sExe & '" -hide_banner -list_devices true -f dshow -i dummy', "", @SW_HIDE, $STDERR_CHILD) Local $sOut = "" While 1 $sOut &= StderrRead($iPID) If @error Then ExitLoop WEnd Local $aV[1] = [0], $aA[1] = [0], $sType = "" Local $aLines = StringSplit(StringStripCR($sOut), @LF), $sLine, $aM For $i = 1 To $aLines[0] $sLine = $aLines[$i] If StringInStr($sLine, "(video)") Then $sType = "v" If StringInStr($sLine, "(audio)") Then $sType = "a" If StringInStr($sLine, "Alternative name") Then ContinueLoop $aM = StringRegExp($sLine, '"([^"]+)"', 1) If @error Then ContinueLoop If $sType = "v" Then _ArrayAdd_($aV, $aM[0]) ElseIf $sType = "a" Then _ArrayAdd_($aA, $aM[0]) EndIf Next $aVideo = $aV $aAudio = $aA EndFunc Func _ArrayAdd_(ByRef $a, $v) ReDim $a[$a[0] + 2] $a[0] += 1 $a[$a[0]] = $v EndFunc Func _StopAll($iPID, $iPIDmpv) If ProcessExists($iPID) Then StdinWrite($iPID, "q") StdinWrite($iPID) ProcessWaitClose($iPID, 10) If ProcessExists($iPID) Then ProcessClose($iPID) EndIf Local $h = FileOpen($sMpvPipe, 2) If $h <> -1 Then FileWrite($h, '{"command":["quit"]}' & @LF) FileClose($h) EndIf ProcessWaitClose($iPIDmpv, 2) If ProcessExists($iPIDmpv) Then ProcessClose($iPIDmpv) EndFunc mpv can be found here: https://sourceforge.net/projects/mpv-player-windows/files/ Adjust the pathes to ffmpeg and mpv!
  5. Really nice screensavers. I like the falling hearts. Firework looks great, too. Well done!
  6. Try: ... Local $hPath2 = _GDIPlus_PathCreate() _GDIPlus_PathAddArc($hPath2, $iW - 6, 0, 5, 5, 270, 90) _GDIPlus_PathAddLine($hPath2, $iW - 1, 5, $iW - 1, $iH - 6) ; button border fix <<<< need help with curve here _GDIPlus_PathAddArc($hPath2, $iW - 6, $iH - 6, 5, 5, 0, 90) Local $hPen = _GDIPlus_PenCreate(0xFFa0a0a0, 1) Local $hPen2 = _GDIPlus_PenCreate(0xFF9b9b9b, 1) _GDIPlus_GraphicsDrawPath($hBmpCtxt, $hPath, $hPen) _GDIPlus_GraphicsDrawPath($hBmpCtxt, $hPath2, $hPen2) ...
  7. Nice idea. Let's see who will win...
  8. This is what I expected because what I understood is that "Camera" is also based on Media Foundation (Frame-Server) API.
  9. You can disable "Click-through" in Tray icon -> Recorder -> WebCam settings ->Click-through. The DLL works with Media Foundation (Frame-Server) API which is probably not compatible with generic Microsoft Windows driver. Other apps may use DirectShow to display WebCam. Is Windows "Camera" built-in app working with your WebCam? You may update the drivers if available. Thanks for testing again. Coming soon a trim editor for recorded video inkl. reencode (4:2:0 (YUV) recorded video only).
  10. Salut wakillion, I updated the version to AirCapRec v0.9.3 beta build 2026-06-05. Does your webcam show a picture in the Windows Camera app? Does it work in any other apps? In AirCapRec: enable Debug logging in Settings, then toggle the webcam (Ctrl+Alt+W) and send me the new AirCapRec_debug.log — it now logs the webcam state. Is it a built-in laptop cam or an external USB one? Brand/model? Does the webcam preview window show a black box in the corner (cam initialized but no image), or nothing at all? Any privacy/antivirus camera blocker active (Windows camera privacy setting, or third-party security)? I saw in the logfile a problem with your display info: It should display 4k and 300%. Please update and test again and post the log. MERCI!
  11. You can create the grid manually without loading it from a file: #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) Global $g_hImage, $g_idPic Example() Func Example() Local $iW = 800, $iH = 400 ; Gui client width & height _GDIPlus_Startup() Local $xGrid = 20, $yGrid = 20 Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($xGrid, $yGrid) Local $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), $hPen = _GDIPlus_PenCreate(0xFF000000, 2) _GDIPlus_GraphicsClear($hGfx, 0xFFFFFFFF) _GDIPlus_GraphicsDrawLine($hGfx, 0, 0, $xGrid, 0, $hPen) _GDIPlus_GraphicsDrawLine($hGfx, 0, 1, 0, $yGrid, $hPen) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGfx) Local $hTexture = _GDIPlus_TextureCreate($hBitmap) _GDIPlus_BitmapDispose($hBitmap) $g_hImage = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $hGfx = _GDIPlus_ImageGetGraphicsContext($g_hImage) _GDIPlus_GraphicsClear($hGfx, 0xFFFFFFFF) _GDIPlus_GraphicsFillRect($hGfx, 0, 0, $iW, $iH, $hTexture) _GDIPlus_BrushDispose($hTexture) _GDIPlus_GraphicsDispose($hGfx) Local $hGUI = GUICreate("Test Grid #2", $iW, $iH, -1, -1, $WS_OVERLAPPEDWINDOW, $WS_EX_COMPOSITED) $g_idPic = GUICtrlCreatePic("", 0, 0, $iW, $iH) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ; or $GUI_DOCKBORDERS ? Update_Pic($g_hImage) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GDIPlus_ImageDispose($g_hImage) _GDIPlus_Shutdown() GUIDelete() Exit EndSwitch WEnd EndFunc ;==>Example Func Update_Pic($hHandle) Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hHandle) Local $hPrevImage = GUICtrlSendMsg($g_idPic, 0x0172, 0, $hBitmap) ; $STM_SETIMAGE = 0x0172, $IMAGE_BITMAP = 0 If $hPrevImage Then _WinAPI_DeleteObject($hPrevImage); delete prev image if any (help file) _WinAPI_DeleteObject($hBitmap) EndFunc ;==>Update_Pic Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) Local $hImage_resized = _GDIPlus_ImageResize($g_hImage, BitAND($lParam, 0xFFFF), BitShift($lParam, 16), 2) ; high-quality mode Update_Pic($hImage_resized) _GDIPlus_ImageDispose($hImage_resized) Return "GUI_RUNDEFMSG" EndFunc ;==>WM_SIZE
  12. @wakillon I can't thank you enough—you're the only tester! Indeed, 4:4:4 is flickering for me, too. Seems that I changed something without testing it. Hmmm. It's also strange that I can't see the system info section in the log file, even though you've obviously tested the latest version (AirCapRec v0.9.3 beta build 2026-06-02). I’ll include the app version number in the log so you can see which version was used. === AirCapRec session started 06-03-2026 20:19:02 === Log file: C:\_BZ25LN\Coding\FreeBASIC\__UEZ\_Tools\AirCapRec\AirCapRec_debug.log [sysinfo] Windows 10 Enterprise 25H2 (10.0 Build 26200.8390) [sysinfo] Architecture: x64 / 64-bit process [sysinfo] CPU: Intel(R) Core(TM) Ultra 5 135U (14 logical cores) [sysinfo] RAM: 15.5 GB (15892 MB) free 2.0 GB (2077 MB) (load 86%) [sysinfo] Commit/Pagefile: total 32.6 GB (33414 MB) free 7.3 GB (7504 MB) [sysinfo] Disk (EXE): C:\ free 20.5 GB (21047 MB) of 235.0 GB (240695 MB) [sysinfo] Disk (System): C:\ free 20.5 GB (21047 MB) of 235.0 GB (240695 MB) [sysinfo] Display: primary 1920x1080 virtual 1920x1080 monitors 1 DPI 96 (100%) [sysinfo] GPU: Intel(R) Graphics [sysinfo] Locale: de-DE [sysinfo] Camera(s): 1 [sysinfo] [0] Integrated Webcam [sysinfo] Uptime: 79h 19m [285548187] HighlightClicks=1 Origin=(0,0) MMCSS=1 [285548187] Audio requested: sys=1 mic=0 bitrate=128000 [285549265] Audio_Init OK [285549265] SR_Init OK: C:\_BZ25LN\Coding\FreeBASIC\__UEZ\_Tools\AirCapRec\Capture_20260603_201901.mp4 30fps CRF=32 preset=superfast tune=zerolatency audio=1 [285549265] SR_Start OK [285549281] Recording-Thread started [285549281] MMCSS AvSetMmThreadCharacteristicsW('Capture') = OK [285550609] Opening MP4: C:\_BZ25LN\Coding\FreeBASIC\__UEZ\_Tools\AirCapRec\Capture_20260603_201901.mp4 (1920x1080 @ 30fps) [285550609] MP4Min_Open OK [285555625] Ring stats: produced=72 dropped=60 consumed=70 filled=2 encFrames=149 repeated=50 duped=29 [285560671] Ring stats: produced=191 dropped=130 consumed=189 filled=2 encFrames=300 repeated=73 duped=38 [285561000] SR_Stop called - video frames=310 audio frames=443 [285561000] Final ring stats: produced=198 dropped=132 consumed=197 filled=1 [285561046] Recording-Thread done: total frames=311 repeated=74 realDuration=10.41174930002308s [285567296] HighlightClicks=1 Origin=(0,0) MMCSS=1 [285567296] Audio requested: sys=1 mic=0 bitrate=128000 [285567296] Audio_Init OK [285567296] SR_Init OK: C:\_BZ25LN\Coding\FreeBASIC\__UEZ\_Tools\AirCapRec\Capture_20260603_201922.mp4 30fps CRF=32 preset=superfast tune=zerolatency audio=1 [285567296] SR_Start OK [285567296] Recording-Thread started [285567296] MMCSS AvSetMmThreadCharacteristicsW('Capture') = OK [285567312] Opening MP4: C:\_BZ25LN\Coding\FreeBASIC\__UEZ\_Tools\AirCapRec\Capture_20260603_201922.mp4 (1920x1080 @ 30fps) [285567312] MP4Min_Open OK [285572312] Ring stats: produced=135 dropped=51 consumed=133 filled=2 encFrames=149 repeated=16 duped=0 [285577312] Ring stats: produced=263 dropped=98 consumed=263 filled=0 encFrames=299 repeated=36 duped=0 [285577718] SR_Stop called - video frames=311 audio frames=481 [285577718] Final ring stats: produced=276 dropped=102 consumed=274 filled=2 [285577781] Recording-Thread done: total frames=312 repeated=37 realDuration=10.45726320001995s [285582031] Drained 0 leftover slot(s) before cleanup === session ended === Thanks so much for your feedback! Edit: 4:4:4 flicker bug found and fixed -> new version uploaded
  13. Error return value from __GDIPlus_ImageAttributesSetImageWrapMode() according to MS can be: Global Enum $Ok = 0, $GenericError, $InvalidParameter, $OutOfMemory, $ObjectBusy, $InsufficientBuffer, _ $NotImplemented, $Win32Error, $WrongState, $Aborted, $FileNotFound, $ValueOverflow, $AccessDenied, _ $UnknownImageFormat, $FontFamilyNotFound, $FontStyleNotFound, $NotTrueTypeFont, _ $UnsupportedGdiplusVersion, $GdiplusNotInitialized, $PropertyNotFound, $PropertyNotSupported, $ProfileNotFound
  14. Since I can only test on my own machine I'd really appreciate if you could give it a spin on yours. Please enable "Debug logging" in Settings before testing — if something goes wrong the log now captures system info and detailed errors, which makes it much easier to track down. Things to try: • Start / stop / pause a recording (try different monitors or a custom region if you have multi-monitor) • Toggle the live zoom lens during and outside of recording • If available, enable the webcam overlay and switch corners / sizes (rmb on webcam window) • Take a screenshot while recording • Check behavior at high DPI (scaling > 100%) on different monitors, if available If anything crashes, freezes, or looks off, please post the AirCapRec_debug.log (next to the EXE, or in %TEMP%). Download link: AirCapRec Thanks!
  15. Indeed _GDIPlus_ImageAttributesDispose($hIA) is missing in _GDIPlus_ImageResize() after / before _GDIPlus_GraphicsDispose($hBmpCtxt), which can lead to memory leaks when called multible times. @jpm can you fix it please?
×
×
  • Create New...