I'm building a screen recording software for Windows using Python. I use FFmpeg for recording and psutil to pause and resume the process. Here is a sample of my code: import psutil import subprocess process = subprocess.Popen([ 'ffmpeg', '-y', '-rtbufsize', '100M', '-f', 'gdigrab', '-thread_queue_size', '1024', '-probesize', '50M', '-r', '24', '-draw_mouse', '1', '-video_size', '1920x1080', '-i', 'desktop', '-f', 'dshow', '-channel_layout', 'stereo', '-thread_queue_size', '1024', '-i', 'audio=Microphone (2- High Definition Audio Device)', # my audio device '-c:v', 'h264_nvenc', # encoding via Nvidia '-r', '24', '-preset', 'p1', '-pix_fmt', 'yuv444p', '-fps_mode', 'cfr', '-c:a', 'aac', '-ac', '2', '-b:a', '128k', 'output.mp4']) ffmpeg_proc = psutil.Process(process.pid) # pause ffmpeg_proc.suspend() # resume ffmpeg_proc.resume() The issue is that after resuming, the audio becomes choppy and delayed, while the video continues smoothly. I have tried using following flags, but they didn't solve the issue: -analyzeduration -fflags +genpts -async -use_wallclock_as_timestamps -af aresample=async=1 How can I properly pause and resume FFmpeg without causing audio delay? Is there any other method to handle this properly? Thanks for any suggestions. Continue reading...