LinuxCommandLibrary

mencoder

Encode video and audio files

SYNOPSIS

mencoder [options] [input_file | input_URL] [-o output_file] [-oac <codec>] [-ovc <codec>] [filter_options]

PARAMETERS

-o <filename>
    Specifies the name of the output file. This option is mandatory for encoding.

-oac <codec>
    Sets the audio codec for encoding. Common codecs include mp3lame, pcm, copy (for direct stream copy).

-ovc <codec>
    Sets the video codec for encoding. Common codecs include xvid, lavc (libavcodec for H.264/MPEG-4), copy (for direct stream copy).

-of <format>
    Specifies the output container format (e.g., avi, mpeg, mp4, ogm).

-srate <Hz>
    Sets the audio sample rate in Hz (e.g., 44100, 48000).

-vf <filter1,filter2,...>
    Applies video filters. Examples include scale=W:H (resize), crop=W:H:X:Y (crop), denoise3d, expand, eq2.

-af <filter1,filter2,...>
    Applies audio filters. Examples include channels=N (change channels), resample=rate, volumedetect.

-fps <float>
    Sets the output frames per second for video.

-ss <seconds|HH:MM:SS>
    Starts encoding at the specified time offset from the beginning of the input.

-endpos <seconds|HH:MM:SS>
    Encodes only up to the specified end position relative to the -ss position.

-aspect <ratio>
    Sets the output display aspect ratio (e.g., 4:3, 16:9).

-pass <1|2>
    Enables two-pass encoding for better quality and file size control (first pass generates statistics, second pass uses them).

-lavcopts <options>
    Passes specific options directly to the libavcodec video encoder (e.g., vbitrate=1500, keyint=250).

-xvidencopts <options>
    Passes specific options directly to the XviD video encoder.

-mc <0|1>
    Controls motion compensation; 0 disables it, which can be useful for problematic inputs.

DESCRIPTION

mencoder is a free and open-source command-line tool for encoding video and audio. It is a sister project to MPlayer, a widely used media player.

mencoder is capable of reading from a vast array of input formats and sources, including local files, DVDs, network streams, and more. It can then encode these into various output formats and codecs, providing extensive control over the encoding process through a rich set of options and filters for both video and audio.

While highly popular in its prime for its versatility in tasks like video editing, filtering, format conversion, and re-encoding, its development has largely ceased. Most of its functionalities have been absorbed and significantly expanded upon by FFmpeg, which has become the de facto standard for multimedia processing. Despite this, mencoder still holds relevance for specific legacy workflows or users familiar with its powerful, albeit complex, command-line interface.

CAVEATS

mencoder is largely considered a legacy tool; its development has ceased. This means it may lack support for newer codecs, formats, and hardware accelerations found in actively maintained projects like FFmpeg. Its complex command-line syntax can also be challenging for new users. For most modern multimedia tasks, FFmpeg is the recommended and more robust alternative.

EXTENSIVE INPUT/OUTPUT FLEXIBILITY

mencoder excels at handling a vast array of input sources, from local files to DVDs, VCDs, and network streams. It can also output to numerous container formats (AVI, MPEG, MP4, OGM, Matroska, etc.) and supports a wide range of video and audio codecs, providing immense flexibility for conversion and transcoding tasks.

FOCUS ON CONTROL AND FILTERING

One of mencoder's key strengths was its powerful filtering system. Users could chain multiple video and audio filters directly from the command line, enabling complex operations like resizing, cropping, deinterlacing, denoising, color correction, and audio normalization, all within a single command.

HISTORY

mencoder originated as part of the MPlayer project, which began development in the late 1990s. It quickly gained popularity in the early 2000s, especially among Linux users, as a powerful and highly customizable command-line tool for video and audio encoding. Its ability to handle a wide range of formats and apply complex filters made it indispensable for many. However, with the rapid and extensive development of FFmpeg, which offers a more unified and comprehensive set of multimedia capabilities, mencoder's active development tapered off significantly. Today, while still functional, it is widely considered a mature, but no longer actively maintained, legacy tool.

SEE ALSO

mplayer(1): The media player component of the MPlayer project, often used in conjunction with mencoder., ffmpeg(1): A comprehensive, cross-platform solution for recording, converting, and streaming audio and video, now the industry standard that has largely superseded mencoder., vlc(1): A versatile multimedia player that also offers robust conversion and streaming capabilities.

Copied to clipboard