High-Quality Video Importing with FFmpegSource

Written by

in

FFmpegSource vs. LSMASH: Choosing the Best Source Filter When working with AviSynth or VapourSynth for video encoding, selecting the right source filter is critical. It determines not just how quickly you can load a file, but whether your frames are accurate, how seeking behaves, and whether you encounter errors later in the script.

The two titans of modern indexing filters are FFmpegSource2 (FFMS2) and LSMASHSource. Both are excellent, but they shine in different scenarios. 1. FFmpegSource2 (FFMS2)

FFMS2 is the tried-and-true workhorse of video indexing. It relies on the robust FFmpeg library to demux and decode virtually any format.

Key Advantage: Versatility. FFMS2 is highly reliable for a wide array of containers, including AVI, MKV, FLV, and complex TS files.

Indexing Behavior: It creates an index file (.ffindex) on the first pass. This ensures frame-accurate seeking later in the script.

Best For: Unfamiliar file formats, complex MKVs, and scenarios where you need high compatibility over raw speed. 2. LSMASHSource

LSMASH (specifically LSMASHVideoSource or LWLibavVideoSource) is often preferred for modern, hardware-friendly containers.

Key Advantage: MP4/MOV Native. LSMASH is specifically recommended for MP4, MOV, and ISO Base Media files. It excels at handling modern video streams.

Speed & Indexing: A major advantage is that LSMASH often doesn’t need to create a heavy index file for supported formats, allowing for faster loading times.

Best For: MP4/MOV files, H.264/H.265 streams, and scenarios where you want fast indexing or no index file at all. Head-to-Head: Choosing the Best Filter FFmpegSource2 (FFMS2) LSMASHSource Primary Use Case General purpose (MKV, TS) MP4, MOV, ISO Base Media Indexing Requires .ffindex Optional/No index needed Speed Moderate (initial indexing pass) Fast (direct decoding) Accuracy Excellent (frame accurate) Excellent (frame accurate) Compatibility Extremely High (via FFmpeg) High (focus on modern) Verdict: Which Should You Use? Choose FFmpegSource2 (FFMS2) if:

You are dealing with MKV containers, especially with complex subtitles or subtitle tracks that need to be ignored.

You are loading M2TS/TS transport streams, which often have index errors in LSMASH.

You need the highest likelihood of opening a weird or damaged file. Choose LSMASHSource if: Your source is an MP4 or MOV file.

You are working with high-resolution H.264/H.265 that requires fast seeking. You want to avoid waiting for index file generation. A Note on Alternatives

While these two dominate, other options exist. DirectShowSource() is fast but not frame-accurate, and new tools like BestSource (for VapourSynth) are gaining popularity for superior RFF handling and faster hashing.

Final Advice: Try LSMASHSource first for MP4s. If it fails or acts up, fall back to FFmpegSource2.

If you are looking for advice on how to handle specific file containers (like MKV) or are struggling with a “frame-accurate” issue, LSMASHSource – Avisynth wiki