Certainly! The Python code you provided builds an ffmpeg command to capture the screen on an X11 display, with specific options. Here's how you can translate that into a normal shell command.
User
why is this command running so fast if my segment time is 30s?
-f x11grab: grab video from X11 display (Linux screen capture)
-framerate: set capture frame rate
-use_wallclock_as_timestamps 1: use system wallclock for timestamps
-draw_mouse 1: capture the mouse cursor
-vsync vfr: variable frame rate
-i :0+0,0: input from display :0 starting at offset +0,0 (top-left corner)
-c:v libx264: encode video with H.264
-g 15: GOP size 15 (keyframe interval)
-c:a aac: encode audio with AAC codec
-preset veryfast: x264 encoding preset
-crf 17: constant rate factor 17 (high quality)
-copyts: copy timestamps
-muxdelay 0: minimize mux delay
-f segment: output format is segmented files
-segment_time 3600: each segment is 3600 seconds
output_%03d.mp4: output file pattern with number padding
If you want me to plug in specific values or further customize, just let me know!
The issue you're encountering — seeing more segments saved than expected with -segment_time 30 — is a common one when using -f segment combined with live screen capture and variable frame timing.
Why is this happening?
-vsync vfr + -use_wallclock_as_timestamps 1
You are telling ffmpeg to use variable frame rate and system clock timestamps for frames. While this helps sync timestamps, variable frame rate means frames can have irregular timestamps, sometimes causing the segment muxer to think it has reached the segment duration prematurely multiple times.
Segmenter uses RTP/MPEGTS timestamps for cutting
The segment muxer cuts segments where input timestamps cross segment boundaries (segment_time).
But if timestamps are irregular or jump unexpectedly, it may trigger multiple cuts within your expected 30s window.
Lack of audio or irregular audio timestamps
If your input has no audio or audio timestamps aren't consistent, timestamp handling may cause more segments.
Using -copyts
Copying raw timestamps in a live capture scenario can sometimes produce confusing timestamp jumps that prompt new segments.
How to fix or reduce the extra segments?
1. Drop -copyts if possible
-copyts tells ffmpeg to preserve input timestamps unchanged rather than adjusting to continuous output timestamps. This can cause segments to split unexpectedly when timestamps have gaps or jumps: