when ffmpeg stream some input
and show option press [q] to stop
how to implement in code.
thankyou
import ffmpeg, time
#Setup for recording windows desktop to mp4 file
process = (
ffmpeg
.input(format='gdigrab',framerate=25,filename="desktop")
.output(crf="0",preset="ultrafast",filename="./output.mp4",c= "libx264" )
.overwrite_output()
)
#Launch video recording
process = process.run_async(pipe_stdin=True)
#Stop video recording
process.communicate(str.encode("q")) #Equivalent to send a Q
# To be sure that the process ends I wait 3 seconds and then terminate de process (wich is more like kill -9)
time.sleep(3)
process.terminate()
Please consider add a wrapper/function to stop the process, or at least add some notes one this line to the readme or api documentation
@kkroening
Anyway Thank you very much
Most helpful comment
This work for me: and took me a lot of time to find a proper way to stop gracefully the ffmpeg process