Quick Drop
How to Remove the macOS Menu Bar from Videos Using FFmpeg?
If you've ever recorded your screen on a Mac, you may have noticed that the macOS menu bar is included in the recorded video. While this may not be an issue in some cases, there are times when you might want to remove the menu bar to create a cleaner and more polished video. Fortunately, FFmpeg, a powerful multimedia framework, provides a simple solution to crop out the menu bar from your videos.
In this blog post, we'll walk through the steps to remove the macOS menu bar from a video using FFmpeg.
Prerequisites:
You can install it via Homebrew by running the following command in your terminal:
brew install ffmpeg
Step 1: Determine the Crop Dimensions
Before we can crop the video, we need to determine the dimensions of the area we want to remove. In this case, we need to find the height of the macOS menu bar.
Open the video file in a media player and pause it at a frame where the menu bar is visible. Take note of the height of the menu bar in pixels. The height of the menu bar might different depending on whether the machine has notch or not, or the accessbility setting of the menu bar. For example, let's assume the menu bar height is 30 pixels.
Step 2: Use FFmpeg to Crop the Video
With the menu bar height determined, we can now use FFmpeg to crop the video and remove the menu bar. Open your terminal and navigate to the directory containing your video file. Then, run the following command:
ffmpeg -i input_video.mp4 -vf "crop=in_w:in_h-30:0:30" -c:v libx264 -c:a copy output_video.mp4
Here's what each part of the command means:
ffmpeg
: Invokes the FFmpeg command-line tool.-i input_video.mp4
: Specifies the input video file.-vf "crop=in_w:in_h-30:0:30"
: This is the video filter that crops the video by removing the top 30 pixels (assuming the macOS menu bar height is 30 pixels).-c:v libx264
: This option specifies the video codec to use for encoding the output video. In this case, we're using the widely-supported H.264 codec (libx264). This is necessary because the cropping operation requires re-encoding the video.-c:a copy
: This option instructs FFmpeg to stream copy the audio channels from the input to the output without re-encoding them. By using this option, all audio channels (stereo, surround, etc.) present in the input video file will be preserved in the output file.output_video.mp4
: This is the output file name for the cropped video.
After running the command, FFmpeg will process the input video and create a new file (output_video.mp4) without the macOS menu bar.
How to Remove the macOS Menu Bar from Videos using FFmpeg with QuickDrop?
QuickDrop offers a seamless integration with FFmpeg. You can add the following script into QuickDrop.
{{ffmpeg}} -hide_banner -i "{{inputFilePath}}" -vf "crop=in_w:in_h-30:0:30" -c:a copy "{{outputFilePath}}"
After that, you can drag and drop video files into the corresponding quick command to crop and remove the menu bar from the videos quickly.
This is side-by-side comparision of 2 video frames before and after removing the menu bar at the top.
Home - Blogs - Change logs
© An Tran - 2024. All rights reserved.