Batch Convert MKV/AVI to MP4: Save Time with These Tools

How to Convert MKV or AVI to MP4 Without Quality Loss

Converting MKV or AVI files to MP4 is common when you need broader device compatibility or smaller file sizes while keeping picture and audio quality intact. This guide shows simple, reliable methods for lossless—or near-lossless—conversion using free tools (HandBrake and FFmpeg) and a quick option with VLC. Follow the steps below and use the recommended settings to preserve quality.

Quick notes before you start

  • Lossless vs. visually lossless: Fully lossless conversion requires copying streams without re-encoding (only possible when codecs are already MP4-compatible). When re-encoding, use high-quality settings so degradation is imperceptible (visually lossless).
  • Check codecs first: If your MKV/AVI uses H.264/H.265 (video) and AAC/MP3/AC3 (audio), you can often remux (no re-encode) into MP4. If it uses different codecs (e.g., VP9, DTS), re-encoding or audio conversion may be needed.
  • Make backups of originals before converting.

Method 1 — FFmpeg (best control; can remux without re-encoding)

FFmpeg is the most powerful option for precise, fast, and high-quality results.

  1. Install FFmpeg:

    • Windows/macOS/Linux: download from ffmpeg.org or use a package manager (Homebrew, apt, choco).
  2. Check file codecs:

    Code

    ffprobe -v error -show_entries stream=index,codec_name,codectype -of default=nw=1 input.mkv
  3. Remux (no re-encode) when codecs are compatible:

    Code

    ffmpeg -i input.mkv -c copy output.mp4
    • This is fast and preserves original quality exactly. Use when video codec is H.264/H.265 and audio is AAC/MP3/AC3 (AC3 is supported in many MP4 players, but some devices may not support it).
  4. Re-encode with visually lossless settings if remuxing isn’t possible:

    • High-quality H.264 (very slow preset, high bitrate-quality):

      Code

      ffmpeg -i input.mkv -c:v libx264 -preset veryslow -crf 18 -c:a aac -b:a 192k output.mp4
      • CRF: lower = higher quality; 18–20 is visually lossless for most content.
      • Use -crf 16 for even higher fidelity (bigger file).
    • H.265 (HEVC) for smaller file at same quality:

      Code

      ffmpeg -i input.mkv -c:v libx265 -preset slow -crf 23 -c:a aac -b:a 192k output.mp4
      • H.265 CRF scale differs; ~23 in x265 is similar to CRF 18 in x264.
    • Preserve multiple audio/subtitle streams:

      Code

      ffmpeg -i input.mkv -map 0 -c:v libx264 -crf 18 -preset slow -c:a copy -c:s copy output.mp4
      • -map 0 copies all streams; use -c:a copy if audio is already MP4-compatible.

Tips:

  • Use -c copy when possible for exact preservation.
  • If target device doesn’t support HEVC, choose H.264.
  • Test one short clip to confirm settings before batch processing.

Method 2 — HandBrake (GUI; good presets)

HandBrake is user-friendly and offers strong quality controls.

  1. Install HandBrake from handbrake.fr.
  2. Open HandBrake and drag your MKV/AVI file in.
  3. Choose a preset:
    • For high quality, select “HQ 1080p30 Surround” (or “Matroska -> MP4” then customize).
  4. Container: set to MP4.
  5. Video settings:
    • Encoder: H.264 (x264) or H.265 (x265).
    • Framerate: same as source (select “Same as source” and check “Constant Framerate” for compatibility).
    • Quality: use RF 18 (x264) for visually lossless; lower RF for better quality.
    • Preset: choose slower preset (e.g., “Slow” or “Slower”) for better compression at same quality.
  6. Audio:
    • If audio is compatible, choose “Auto Passthru” (keeps original).
    • Otherwise choose AAC, bitrate 160–256 kbps (or 192k).
  7. Subtitles: add/keep as needed (burn in only if required).
  8. Start Encode.

HandBrake re-encodes video; use RF ~18 for visually lossless results.

Method 3 — VLC (quick, simple; less control)

VLC can convert files without advanced tuning.

  1. Open VLC -> Media -> Convert / Save.
  2. Add file -> Convert / Save.
  3. Profile: select “Video — H.264 + MP3 (MP4)”.
  4. Optionally click the wrench to customize codec and bitrate.
  5. Choose destination and Start.

VLC is convenient but offers fewer quality controls than FFmpeg or HandBrake.

Batch conversion

  • FFmpeg: use a shell loop (bash example):

    Code

    for f in.mkv; do ffmpeg -i “\(f" -c copy "\){f%.mkv}.mp4”; done
    • Replace -c copy with chosen encoding settings if re-encoding.
  • HandBrake: use “Add to Queue” and “Start Queue” for multiple files.

Troubleshooting & tips

  • MP4 container limitations: MP4 doesn’t support some subtitle formats (e.g., certain PGS). Convert subtitles to SRT or burn them in.
  • Audio compatibility: DTS or some lossless audio may not play on all devices. Use -c:a aac -b:a 192k to convert to AAC.
  • Corrupt input: try remuxing to MKV first or use FFmpeg’s -err_detect ignore_err options to salvage.
  • Preserve chapters and metadata: FFmpeg with -map_metadata 0 and -map_chapters 0.

Recommended default settings

  • Try remux first: ffmpeg -i input.mkv -c copy output.mp4
  • If re-encoding needed (H.264 target): ffmpeg -i input.mkv -c:v libx264 -preset slow -crf 18 -c:a aac -b:a 192k output.mp4

Summary

  • Use remuxing (-c copy) when codecs are MP4-compatible for true lossless conversion.
  • Use FFmpeg for maximal control; use HandBrake for an easier GUI; use VLC for quick conversions.
  • For visually lossless re-encoding, target CRF ~18 with x264 and slow preset, or use x265 with appropriate CRF for smaller files.

If you want, tell me your operating system and whether your files use H.264/H.265 or another codec and I’ll give a one-line FFmpeg command tailored to your batch.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *