De-identifying your ultrasound videos:Step-by-step instructions for cropping videos on Windows using FFmpeg


batch crop all files in folder

  1. place videos and images in a folder
  2. copy crop_all.bat to your folder
  3. double click crop_all.bat
  4. enter number of pixels to crop from top, hit enter

batch crop as droplet

  1. select multiple video files and still images
  2. drag and drop them onto the crop_all.bat icon
  3. enter number of pixels to crop from top, hit enter

Note: FFmpeg must be installed for the batch file to work. A value of 28 pixels to crop works well for Sonosite video. Cropped videos will be saved to same directory, leaving original files alone. The cropped videos will have original name with _cropped added. Example: will be saved as can also place still images in the folder to be batch cropped. If your still images are upside down and flipped after cropping (GE images) see this page.

single file crop

You can also and use the ffmpeg command line in a command prompt to crop one file at a time:
  1. Place your video in a folder
  2. Open command prompt (Hit START>Run, type cmd and hit enter)
  3. Change to your directory with this command: cd "c:\your\folder\here"
  4. To crop video use this command:

ffmpeg.exe -i INVIDEO.MP4 -sameq -b 8000k -vf crop=in_w:in_h-28:0:28 OUTVIDEO.MP4

replace text in red:
  • INVIDEO.MP4: replace with the name of your uncropped video, e.g. or cardiac.avi or pneumothorax.mp4
  • OUTVIDEO.MP4: replace with the name you want your cropped video to be, e.g. or cardiac1.avi or pneumothorax1.mp4
  • 28: Replace both instances of 28 with the same number as needed to crop more/fewer pixels. This is the number of pixels to crop from top of the invideo, 28 works well for Sonosite clips.

Note: FFmpeg must be installed for this to work. It doesn’t matter if you use upper or lower case for filename (it will still crop if your video is name and your “invideo” is; keep the output filetype the same as the input to avoid problems with playback (mp4, mov, avi, wmv etc). Lastly, the -b 8000k flag means that the output video will be 8000 kbps (or 1MB/s). This can be increased if the output quality is not sufficient, decreased to save space.


  • Crop 50 pixels off top of gallbladder.mp4, save as gallbladder1.mp4
ffmpeg -i gallbladder.mp4 -sameq -vf crop=in_w:in_h-50:0:50 gallbladder1.mp4

  • Crop 75 pixels off top of echo.avi, save as echo_cropped.avi
ffmpeg -i echo.avi -sameq -vf crop=in_w:in_h-75:0:75 echo_cropped.avi

Other Resources

  • Much more detail than you ever wanted to know about the ffmpeg crop nomenclature and usage here.
  • A Windows GUI frontend to ffmpeg can be downloaded WinFF that supports batch encoding, just make sure you are using the flags above to maintain video quality. The GUI hides the command line often times, making it difficult to know exactly what options are being used.


Ben C Smith, MD, FACEP