Cmdline Linux multimedia editing

tux_compOften I need to edit multimedia for various reasons. Handbrake is a great friend for quality transcoding but there are frequent instances when I need Swiss-Army knives. For example, removing the non-English audio streams, subtitles from MKV files, extracting audio from one file and inserting into another, saving only a selected region from a video etc. All of these can be done in Linux (resulting in great quality output) with a little bit of understanding of powerful cmdline utilities like mencoder, ffmpeg and mkvtoolnix (in my experience, mencoder and ffmpeg produce better output than mkvtoolnix). You can fine-tune each and every aspect of any multimedia file and control them in the output. They are much faster than any GUI based utility as well. I have used all of these on Ubuntu.

An example of extracting some streams (a video, audio and subtitle) from an MKV file and creating a new file:

$ ffmpeg -i input.mkv -acodec copy -vcodec copy -scodec copy output.mkv -map 0.2 -map 0.3 -map 0.1

Another example of cutting a part of a video file using mencoder:

$ mencoder -ss 01:19:30 -endpos 17:45 -oac copy -ovc copy input.avi -o output.avi

Do the same with ffmpeg:

$ ffmpeg -i input.avi -ss 01:19:30 -t 17:45 -acodec coy -vcodec copy output.avi

Once you use these tools for an hour, you would probably never consider installing bulky GUI applications for multimedia editing once again.

2 thoughts on “Cmdline Linux multimedia editing”


Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s