User Tools

Site Tools


doc:appunti:linux:video:avidemux

Appunti Avidemux

Precompiled binariers

I suggest to download and install the Debian package from this deb repository:

deb ftp://ftp.nerim.net/debian-marillat  etch  main

Compiling Avidemux

To get the source tree from CVS, configure and compile the program:

cvs -d:pserver:anonymous@cvs.berlios.de:/cvsroot/avidemux login
cvs -d:pserver:anonymous@cvs.berlios.de:/cvsroot/avidemux co avidemux
cd avidemux
make -f Makefile.dist
./configure
make

To build the Makefile you need at least these Debian packages:

  • cvs
  • autoconf
  • libxml2-dev

Several packages are needed to compile support for various video and audio formats into Avidemux. Most of this packages are provided for Debian by Marillat at ftp://ftp.nerim.net/debian-marillat/.

Package Reported by Avidemux as Function Provided by
Xvid 0.9 Codec Video Codec XviD (obsolete)
*libxvidcore4-dev* Xvid 1.0 Codec Video Codec XviD Marillat
*libvorbis-dev* Ogg Vorbis Audio Codec Ogg Vorbis Debian
*liblame-dev* Lame Audio Codec MP3 Marillat
*libfaac-dev* Faac (encoder) Audio Encoder AAC Marillat
*libfaad2-dev* Faad2(decoder) Audio Decoder AAC Marillat
*libmad0-dev* Mad decoder Audio Decoder MPEG Debian
*liba52-0.7.4-dev* A52/AC3 Audio Decoder A52/AC3 Debian
Xvideo
SDL
ALSA
ARTS

Video Codecs Availables in Avidemux

For creating .avi files, my suggestion is to use the XviD video encoder. It is based on Free Software and it gives amazing quality also at low bitrates. Movies encoded with the two pass method can fit in a single CD with minimal quality loss respect a VHS tape. Support by players seems rather good, but beware of some advanced options like Q-PEL.

Xvid4

It produces XviD (ISO MPEG-4 compliant) video files. Requires libxvidcore.so.4 provided by the libxvidcore4 package by Marillat. The code is Free Software released under the GPL license, see http://www.videocoding.de/. Patent issues on some XviD features, prevent the package to be included in Debian.

Mjpeg
VCD
SVCD
DVD
XVCD
XSVCD
SVCD (lavc)
DVD (lavc)
Lav Mpeg4

It produces ISO MPEG-4 compliant video files. Requires the libavcodec library provided by the libavcodec2 or the libavcodeccvs packages by Marillat. Also known as lavc, it is another Open Source MPEG4 compliant video codec which is superior in performance and quality to DivX 5 and even to XviD. This codec starts to support b-frames*. It is part of the ffmpeg project.

H263
H263+
Huffyuv
FFV1
Snow

Audio Codecs Availables in Avidemux

After installing Avidemux on my Debian GNU/Linux system, several audio codecs were availables. For creating .avi files, my suggestion is to use the Lame encoder; for its quality and the wide support by players. If you are concerned about patent issues on mp3 format, choose Ogg Vorbis instead.

A brief summary to help choose one.

Lame

It produces MPEG-1 Layer 3 (mp3) files. Requires libmp3lame.so, provided by the liblame0 package by Marillat. The program can also pipe to an external lame program (menu Misc, Preferences, LAME). The source code is from the lame package, released under the GPL license, see http://www.mp3dev.org/. It seems that there are some patent issues that prevent the package to be included into the Debian distribution. See a discussion about including Lame into Debian.

Supported modes: Mono, Stereo and Joint Stereo. Supported rates: 48-384 kbits CBR, ABR and Extreme (aggressive VBR).

Vorbis

It produces Ogg Vorbis audio files. Requires libvorbisenc.so.2, provided by the libvorbisenc2 Debian package. This audio format was developed as a Free Software replacement for mp3, where some patent issues perist. Sound quality is comparable (if not better) than mp3, support from players is less ubiquitous, but increasing.

Supported modes: Stereo and Joint Stereo. Supported rates: 48-384 kbits. CBR? ABR?

FAAC

It produces AAC audio files. Requires libfaac.so.0 and libfaad.so.0 (encoder and decoder), provided by the libfaac0 and libfaad2-0 packages by Marillat. The site is http://www.audiocoding.com/ .Source code is available under the GPL or LGPL license so it is Free Software, but some patent issues exist on this audio format.

Supported modes: Stereo and Joint Stereo. Supported rates: 48-384 kbits. CBR.

FFm MP2

It produces MPEG-1 layer 2 (mp2) files. The support is statically compiled-in using the libavcodec library. The source code of this codec is from the ffmpeg project (http://ffmpeg.sourceforge.net/), licensed under the LGPL license. Some patent issues concern this software, as other MPEG related software. See http://ffmpeg.sourceforge.net/legal.php.

Most ffmpeg codecs were developped from scratch to ensure best performances and high code reusability. Don't know how it compares with TooLAME. Supported modes: Stereo and Joint Stereo. Supported rates: 48-384 kbits. CBR Only?

FFm AC3

It produces AC-3 audio streams. Most DVD have the audio encoded in some AC-3 variant. The support is statically compiled-in using the libavcodec library, see FFm MP2 for some notes about the ffmpeg project.

Toolame

It produces MPEG-1 layer 2 (mp2) files. The support is statically compiled in, or the program can pipe to an external toolame program (menu Misc, Preferences, tooLAME). Because of patent issues surrounding the layer 3 encoder and the ability of most mpeg audio players to play layer 2 files, toolame makes a very good drop-in replacement for lame or other layer 3 encoders under most circumstances. Don't know how it compares with FFm MP2.

Supported modes: Stereo and Joint Stereo. Supported rates: 48-384 kbits CBR.

Wav PCM

It produces uncompressed Microsoft RIFF Wav PCM audio files.

Video filters

Mplayer resize
Resize

Works great. Many DVD movies have rectangular pixels, I use this filter to resize to the proper aspect ratio. It is common practice to have width and height exact multiples of 16.

  • Bilinear: Tends to smooth the picture, but makes the video easier to encode. Appropriate for downsizing.
  • Bicubic: Keeps sharpness and thus makes the video harder to encode (leads more easily to blocking-artifacts). Recommended for enlarging.
  • Lanczos: Produces a very sharp picture and keeps a lot of details. Use it for HQ encodings at high bitrates.
Deinterlace
Lavcodec PP deinterlacer

Works great. Many DVD originating from a PAL video source need to be deinterlaced. Apply the deinterlace filter before the resize one. Cubic Interpolation seems to be the best, Median Deinterlacer also works well.

Filter
Linear Blend Deinterlaces the given block by filtering all lines with a (1 2 1) filter.
Linear interpolation Deinterlaces the given block by linearly interpolating every second line.
Cubic interpolation Deinterlaces the given block by cubically interpolating every second line.
Median Deinterlacer Deinterlaces the given block by applying a median filter to every second line.
FFmpeg Deinterlacer Deinterlaces the given block by filtering every second line with a (-1 4 2 4 -1) filter.

Changing Autolevel setting in Avidemux 2.0.40 may crash, you have to apply this patch: http://www.avidemux.org/phpBB2/viewtopic.php?t=1220.

VobSub

VobSub is a well known subtitle format that saves subtitles nearly in the same format as it appears in DVD subtitle streams. From a technical point of view, VobSub saves subtitles as little images.

This filter overlays subtitles to the video, it takes the subtitles from two files, one .sub and one .idx. Useful when ripping a DVD and you want to get the subtitles overlayed statically. Is otherwise generally preferable to keep subtitles in a separate file, in text or bitmap format, and let the player to overlay them at play time.

See the Transcode page on howto extract VobSub subtitles from a DVD-Video. You can also use mencoder to accomplish the same operation.

Audio filters

Time shift

Playing a video with mplayer you can find that audio and video are not in sync, then you can adjust sync with the + and the - keys.

To fix the sync permanently open the file with Avidemux and apply this filter, this is the only filter to work also in copy mode. This filter shifts the audio by removing the beginning or duplicating to create new sound.

Shift is expressed in ms, note that a negative delay in Mplayer must be expressed as a positive value in Avidemux, and viceversa.

See also avisync for a command line tool to adjust audio/video syncronization.

Resampling

Sometimes resampling the audio is necessary beacuse the destination codec has some restrictions. This is the case of AVI files produced by some cameras, which encode audio in PCM 8 bits, mono, 11024 Hz. Trying to re-encode the audio with Lame into mp3, produces the error message Encoder initialization failed, Not activated. It is necessary to resample the audio to 48000 or 44100 Hz.

Modifica Audio con programmi esterni

Si può usare un programma esterno come Audacity per editare l'audio, bisogna però “estrarlo” dal filmato originale.

Avidemux avrebbe questa funzione dal menu Audio, Save, ma il file salvato è in formato raw e quindi per aprirlo in Audacity bisogna specificare tutti i parametri e soprattutto viene tagliato male alla fine, perdendo alcuni decimi di secondo (Avidemux v. 2.5.4). Per questo motivo è meglio utilizzare mplayer che sembra molto più adatto allo scopo:

mplayer -ao pcm:file=audio.wav -vo null file.avi

Una volta aperto il file con Audacity ricordarsi di impostare il Project Rate (in basso a sinistra) ad una frequenza compatibile con il codec che si vorrà usare, ad esempio per lame mp3 una frequenza compatibile è 44100 Hz. Alla fine esportare il file audio in formato accettato da Avidemux, ad esempio WAV PCM.

Una volta ottenuto il file audio, si provvede a fare il mux con il video e l'encoding nel formato finale con Avidemux:

  1. Aprire il filmato
  2. Dal menu Audio, Main Track caricare la traccia audio elaborata
  3. Impostare il codec video e gli eventuali filtri
  4. Impostare il codec audio
  5. Salvare il nuovo filmato

Frame types

Type What is it
I Intra-coded frames, average 7:1 reduction. Like JPEG, every video frame is broken into blocks of 8×8 pixels of Y, R-Y, and B-Y
P P frames are predicted based on prior I or P frames plus the addition of data for changed macroblocks. Average about 20:1 reduction, or about half the size of I frames.
B Bidirectionally predicted frames based on appearance and positions of past and future frames macroblocks. B frames require less data than P frames, averaging about 50:1 reduction. B frames require more decoder buffer memory because 2 frames are compared during the reconstruction process. B frames also require manipulation of the coding order: frames moving from the coder to the decoder are NOT in presentation sequence.
doc/appunti/linux/video/avidemux.txt · Last modified: 2016/12/12 08:08 by niccolo