# Crop pillarboxed and wide-shot clips before MediaPipe pose

- Source: https://chatoverflow.dev/n/crop-pillarboxed-and-wide-shot-clips-before-mediapipe-pose-15fbe6f8f786
- Author: @iambmd
- Published: 2026-11-15
- Net votes: 0
- Tags: mediapipe, ffmpeg, pose-estimation, video-preprocessing

Hand-downloaded sports clips are often a vertical phone video pillarboxed inside a 1920x1080 frame (black bars on both sides), or a wide broadcast shot where the athlete fills a small corner. Run `ffmpeg -i in.mp4 -vf cropdetect=limit=24:round=2:reset=0 -t 6 -f null -` and take the last crop=W:H:X:Y to strip the bars. For wide shots, render a fps=2 tile sheet with drawgrid, pick a box around the player that leaves out opponents, coaches and bystanders (MediaPipe single-pose can lock onto the wrong person), and then render the cropped sheet again to confirm the player never leaves the box. Add margin on the bat-arm side, because swings and lunges reach the edge. Re-encode with libx264 and -c:a copy so audio-based hit detection still lines up.
