How to Transcode Video Files on Linux with HandBrake or FFmpeg

To transcode video files on Linux, you can use HandBrake for a straightforward graphical workflow or FFmpeg when you want precise command-line control. HandBrake is easier for one-off conversions; FFmpeg is better for repeatable commands, automation, and advanced codec choices.

One important distinction: transcoding decodes a video or audio stream and encodes it again, which takes time and can reduce quality. If you only need to change the container, such as MKV to MP4, and the existing codecs are compatible, a remux can copy the streams without re-encoding. The official FFmpeg documentation recommends stream copying when transcoding is unnecessary.

Method 1: Transcode video with HandBrake

HandBrake is the simpler choice if you prefer a GUI. For Linux, the HandBrake project recommends its Flatpak release from Flathub as the most convenient supported installation. See the official HandBrake Linux installation guide. If Flatpak and Flathub are already enabled, install it with:

flatpak install fr.handbrake.ghb

1. Open the source video

Launch HandBrake and choose Open Source, then select the video you want to convert. HandBrake also supports drag and drop for many file types. After scanning the source, it shows the title, resolution, frame rate, audio tracks, and other details.

HandBrake on Linux opening sample-video.mp4 from the Videos folder
Select the source file you want HandBrake to encode.

2. Choose a preset

Select a preset that matches the device or playback software you plan to use. HandBrake's current documentation says Fast 1080p30 is a good general starting point for broad compatibility. A preset can change the maximum resolution, frame rate, video codec, audio settings, and container.

HandBrake preset menu showing Fast 1080p30 with an MP4 source preview
Presets provide a practical starting point for compatible output settings.

3. Set the output name and location

Review the settings you care about, then set the destination filename and folder. Do not assume HandBrake will save the file to your Videos folder automatically: the output is written to the Destination you specify. The HandBrake quick-start guide specifically recommends checking this before you begin.

HandBrake destination fields with an MP4 output filename and Videos folder selected
Choose a clear output filename and verify the destination folder.

4. Start the encode

Click Start Encode. HandBrake displays progress while it works and notifies you when the job finishes. Encoding speed depends on the source, resolution, selected encoder, quality settings, filters, and your hardware, so there is no fixed completion time.

HandBrake encoding progress bar showing an MP4 conversion in progress
HandBrake reports progress and estimated time while transcoding.

Method 2: Transcode video with FFmpeg

FFmpeg is ideal when you want a reproducible command or need to process many files. Install the ffmpeg package from your Linux distribution, or follow the package links on the official FFmpeg download page. Package versions and enabled encoders can differ by distribution.

1. Verify FFmpeg is available

Open a terminal and run:

ffmpeg -version
Ubuntu terminal showing FFmpeg version and build information
The installed FFmpeg build determines which codecs and hardware encoders are available.

2. Inspect the input file

Move to the folder containing your video and inspect the streams before converting it:

cd ~/Videos
ffmpeg -i sample-video.mkv
Linux terminal showing FFmpeg input details for an MKV video with H.264 video and AAC audio
Checking the input reveals its current codecs, resolution, frame rate, and audio format.

3. Transcode to H.264 video and AAC audio in MP4

For a predictable, broadly compatible MP4, specify the codecs instead of relying only on the output extension:

ffmpeg -i sample-video.mkv -c:v libx264 -crf 22 -preset medium -c:a aac -b:a 160k sample-video-transcoded.mp4

Here, libx264 encodes H.264 video, crf 22 controls quality, medium balances speed and compression, and AAC is used for audio. Lower CRF values generally mean higher H.264 quality and larger files. If your FFmpeg build does not include a requested encoder, choose one that your build supports.

Linux terminal running an FFmpeg H.264 and AAC transcode command with progress output
FFmpeg prints frame, time, bitrate, and other progress information during the encode.

4. Use stream copy when you only need a new container

If the source already contains codecs supported by the target container, avoid a full transcode and remux instead:

ffmpeg -i sample-video.mkv -c copy sample-video-remuxed.mp4

-c copy copies compatible streams without decoding and re-encoding them. This is usually much faster and avoids generational quality loss, but it will fail or produce an unsuitable file when the source codecs are not valid for the chosen container.

Linux terminal using FFmpeg stream copy to remux an MKV file into MP4
Stream copy changes the container without re-encoding compatible audio and video streams.

Which option should you use?

  • Use HandBrake when you want a guided GUI, device presets, and easy quality controls.
  • Use FFmpeg when you need explicit codecs, batch processing, scripts, filters, or repeatable commands.
  • Use remuxing when the codecs are already suitable and you only need a different container.

For most desktop playback, an MP4 file with H.264 video and AAC audio remains a practical compatibility choice. If your target device or service has its own upload specification, follow that specification first rather than converting by extension alone.

Leave a Comment

How to Record Speaker Output on Linux with Audacity

How to Record Speaker Output on Linux with Audacity

Capture Linux desktop audio in Audacity by routing its recording stream to your output device’s monitor source. Follow PulseAudio and PipeWire steps, export tips, and fixes for silent tracks.

How to Use Dropbox on Linux: Install and Sync Your Files

How to Use Dropbox on Linux: Install and Sync Your Files

Install Dropbox on Linux from the official package, sign in, sync a local folder, manage selective sync, and check status from the command line.

How to Install Inkscape on Linux: Ubuntu, Fedora, Arch, and More

How to Install Inkscape on Linux: Ubuntu, Fedora, Arch, and More

Install Inkscape from your Linux distribution’s repositories, the Ubuntu stable PPA, Snap, or Flathub, with current commands and notes for choosing a package source.

How to Find and Remove Duplicate Files on Linux With FSlint

How to Find and Remove Duplicate Files on Linux With FSlint

Use FSlint to scan selected Linux folders, review duplicate groups, and safely delete redundant files or learn when hard-link merging is appropriate.

How to Install SABnzbd on Linux and Configure It

How to Install SABnzbd on Linux and Configure It

Install SABnzbd on Ubuntu or Debian, or run it in Docker on another Linux host. Then open the web interface and configure your provider and download folders.

How to Install the Paper GTK Theme on Linux

How to Install the Paper GTK Theme on Linux

Install the Paper GTK theme from supported Linux repositories, enable it for GTK apps in GNOME Tweaks, and see what the legacy theme can and cannot change.

How to Install and Set Up Plex on OpenMediaVault with Compose

How to Install and Set Up Plex on OpenMediaVault with Compose

The old OpenMediaVault Plex plugin is archived. Set up Plex on OMV 8 with OMV-Extras, the Compose plugin, persistent storage, and Plex’s official container.

How to Clean and Speed Up Ubuntu Safely

How to Clean and Speed Up Ubuntu Safely

Clean and speed up Ubuntu with safe APT cleanup, storage checks, and startup controls that help free space and troubleshoot a sluggish desktop.

How to Install the Hiri Email Client on Linux

How to Install the Hiri Email Client on Linux

Install Hiri on Linux with its Snap package or official tarball, add a desktop launcher, and check supported accounts plus a warning about Hiri’s old Snap release.

How to Get System Specifications for a Linux PC

How to Get System Specifications for a Linux PC

Use Fastfetch and built-in Linux commands to check your distro, kernel, CPU, memory, graphics, storage, and connected devices, then save a clear report.