检测到静音时暂停或 JumpCut 视频录制

时间:2021-03-28 13:47:31

标签: lua script obs

今天我发表了一个想法,在未来的版本 obs 中添加一些功能。 想法听起来像这样:

1 步 - 我们按下录制按钮。 2 步 - 如果声级大于 ..x.. dB,则它s continue to recording. 3 step - if sound level less <= than ..x.. dB then it 会暂停我们的录音。 *它与过滤器相同 - 压缩器,但包括暂停\取消暂停的功能。

一切都很简单! 因为那个。如果我们记录一些长流,例如3+小时。如果我们使用这种方法(或插件或脚本),我们只会得到 15-45 分钟的视频,没有静音。因为它会被自动切割。沉默的时刻只是没有记录。并且无需在 Sony Vegas 中手动完成(很无聊)。

也许论坛主题已经包含这样的东西。如果是。请告诉我。

ps: 我在互联网上研究了很多。我发现这些东西可以手动自动跳转:

时间螺栓 - 现场 Vegas vegasaur - 插件 AutoJumpCut 1.0 - 程序 后效-脚本 Py autojumpcut - python ffmpeg 脚本

指导如何运行

  1. 打开 obs 并设置热键 https://i.imgur.com/xjuOlIJ.jpg
  2. 在 ahk 论坛上下载声级检测库

我糟糕的ahk代码:

    #Include 3.ahk

;https://autohotkey.com/board/topic/21984-vista-audio-control-functions/

Loop
{

;;;;;;;;;;;;;;;;;
; Get the device which we'll be monitoring.
device := VA_GetDevice("capture") ;playback capture
; Get IAudioClient interface.
VA_IMMDevice_Activate(device, IID_IAudioClient:="{1CB9AD4C-DBFA-4c32-B178-C2F568A703B2}", 7, 0, audioClient)
; Get mixer format to pass to Initialize.
VA_IAudioClient_GetMixFormat(audioClient, format)
; Initialize audio client to ensure peak meter is active.
VA_IAudioClient_Initialize(audioClient, 0, 0, 0, 0, format, 0)

; Get IAudioMeterInformation interface.
audioMeter := VA_GetAudioMeter(device)
; No longer needed, so free it:
MeterLength = 1 ;30
; "The peak value for each channel is recorded over one device
;  period and made available during the subsequent device period."
VA_GetDevicePeriod("capture", devicePeriod)

Loop
{
    VA_IAudioMeterInformation_GetPeakValue(audioMeter, peakValue)
    ;ToolTip, %peakValue%
    
    b := peakValue * 1000
    ;SetFormat, Float, 0.2
    ToolTip, %b%, 887, 944 ;tooooooooooooooooooooltip
    
    ;ToolTip % (peakValue * 1000)
    ;Sleep, %devicePeriod%

    if b >= 20
    {
        ControlSend,, {-}, OBS
    }
    else
    {
        ControlSend,, {=}, OBS
    }
}
;;;;;;;;;;;;;;;;;;;;;;

Sleep, 500
}



2::Pause
return


4::Reload
return

如果我们使用它 - 程序会崩溃。 所以我们需要在obs中使用lua..

0 个答案:

没有答案