Jump to content

stop ffmpeg screen capture video


cdeb
 Share

Recommended Posts


I want to start ffmpeg to make a video screencapure, so far nothing complex
 

FFMPEG EXAMPLE COMMAND:

ffmpeg -f gdigrab -i desktop -framerate 10 -vcodec libx264 YOUR_NAME_HERE.mp4

Example AU3 script: 

Local $cmd_string = "ffmpeg -f gdigrab -i desktop -framerate 10 -vcodec libx264 YOUR_NAME_HERE.mp4"
Local $iPID = Run($cmd_string, @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
ProcessWaitClose($iPID)

 

However, to stop video recording I have to press the ‘q’ key on the keyboard 

How can I send the same command to the $iPID?

Link to comment
Share on other sites


Yes I used StdInWrite($iPID, "Q" & @CRLF) but nothing

Example:

Local $cmd = ""
$cmd_string = "ffmpeg -f gdigrab -i desktop -framerate 10 -vcodec libx264 YOUR_NAME_HERE.mp4"
Local $iPID = Run($cmd_string, @ScriptDir, @SW_HIDE, $STDOUT_CHILD)

Local $max = 100000
Local $count = 0
While ProcessExists ( $iPID )
    $sStderrRead = StderrRead ( $iPID )
    If Not @error And $sStderrRead <> '' Then
        ConsoleWrite ( "! STDERR read : " & $sStderrRead & @Crlf )
    EndIf
    $sStdoutRead = StdoutRead ( $iPID )
    If Not @error And $sStdoutRead <> '' Then
        $sOutput &= $sStdoutRead
        ConsoleWrite ( "+ STDOUT read : " & $sStdoutRead & @Crlf )
    EndIf
    $count += 1
    If $count > $max Then
        ConsoleWrite ( "+ $count > $max: " & @Crlf )
        StdInWrite($iPID, "Q" & @CRLF)
    EndIf

Wend

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...