User Tools

Site Tools


using:command_line_usage

Command line usage

Invoking

Avidemux may be called with many arguments. The most obvious is avidemux(nbsp)myFile.avi, that will load myFile.avi.

You can also provide other commands, each one of them beginning by(nbsp)(ndash) to invoke an action. You won't have the full capabilities of the GUI though.

Warning: When in command line mode, all alert boxes will be skipped and questions will be automatically set to NO.

Warning: It is very important to note that indexes are not saved. For example, if you do avidemux2(nbsp)file.nuv you won't be prompted to save the index.

The arguments are evaluated from left to right and processed one at a time. The command line is far from bullet proof as most of the checks are inside the GUI.

A workbench file is a project file. The term workbench refers to the currently active video and settings in the program. When you save a workbench you are really saving it to a project file.

Commands

To get up to date command list and parameters, just invoke Avidemux with the argument --help.

Audio commands Parameters Description
--audio-bitrate value Set the audio bitrate. Warning: You must enter valid audio bitrate!
--audio-codec Audio codec: MP2 | MP3 | AC3 | TWOLAME Select the audio codec that will be used when you set process mode.
--audio-delay value in ms (milliseconds) Shift the audio/video sync by value.
--audio-downsample none Activate 48 kHz to 44.1 kHz downsampling.
--audio-normalize none Activate audio normalization filter.
--audio-map none Scan the audio to properly handle VBR audio.
--audio-mono2stereo none Channels: convert mono to stereo.
--audio-resample desired resample frequency Resample to 'X' kHz.
--audio-stereo2mono none Channels: convert stereo to mono.
--no-audio none Disable internal audio. Useful if you want to use only external audio files.
Audio output commands Parameters Description
--save-raw-audio filename Save output audio in copy mode, same audio as input audio.
--save-uncompressed-audio filename Save audio as PCM. Default is no filters, but they can be applied.
External audio commands Parameters Description
--external-mp3 filename Load the MPEG audio as soundtrack. Warning: If VBR, you must put a --audio-map afterward.
--external-ac3 filename Load the AC3 file as soundtrack.
--external-wav filename Load the WAV file as soundtrack.
Video commands Parameters Description
--video-codec XVID4 | x264 | FFmpeg4 | VCD | SVCD |DVD | XSVCD | XVCD Select the video codec that will be used when you save in process mode.
--video-conf cq=q | cbr=br | 2pass=xx Select the encoding mode: constant quality (cq=quality), constant bitrate (br=bitrate) or 2 pass mode, in that case, give the final size in megabytes.
--set-pp Two arguments: value (1=hdeblok|2=vdeblock|4=dering) & strength (0-5) Set the default post-processing value.
Filter commands Parameters Description
--filters filename Load a filter set.
--listfilters none List all filters by name.
Codec configuration commands Parameters Description
--codec-conf codec-config-filename Load a codec configuration.
Resolution commands Parameters Description
--dvd-res none Sets DVD resolution by adding needed filters for conversion.
--svcd-res none Sets SVCD resolution by adding needed filters for conversion.
--halfd1-res none Sets 1/2 DVD resolution by adding needed filters for conversion.
--vcd-res none Sets VCD resolution by adding needed filters for conversion.
Start/finish commands Parameters Description
--begin frame number Set the start marker to frame.
--end frame number Set the end marker to frame.
Load commands Parameters Description
--load filename Load a video file.
--load-workbench filename Load a workbench/edit list.
Misc. commands Parameters Description
--append video filename Append a video file to the current video
--autoindex none Try to generate required index files as necessary
--force-b-frame none Force detection of b-frame in next loaded file
--force-alt-h264 none Force use of alternate safe read mode for h264 video. Warning: This argument must be used before --load to be effective.
--force-smart none Engage smart copy mode with CQ=3 at next save
--force-unpack none Force detection of packed VOP in next loaded file
--fps value Set the frame rate per second of the workbench
--index-mpeg MPEG_file INDEX_file TrackNumber Create index for the MPEG file.
--info none Show information about loaded video and audio streams
--rebuild-index none Rebuild index with correct frame type.
--reuse-2pass-log none Reuse the 2-pass logfile if it exists.
--run script filename Load and run a script.
--save-jpg output filename Save current video frame image as a JPEG file.
--save-workbench output filename Save the current workbench into a project file.
--var my_var_name=value Set variable value.
Output save commands Parameters Description
--save filename Save the file. Default output format is AVI.
--save-dvd (two args) Save as DVD MPEG PS.
--save-unpacked-vop filename Save as AVI with unpacked VOP.
--save-ogm filename Save as OGM file.
--save-raw-video none Save elementary video stream and strip the container, you will end up with raw MPEG video!
--output-format AVI | AVI_DUAL | AVI_UNP | ES | MP4 | OGM | PS | TS | MATROSKA Set the output format. ES is for video only, PS for Program Stream (VCD/SVCD/DVD) and TS for Transport Stream.
--auto-split Size in megabytes Avidemux will automatically split the files when they reach the given size and create file.avi, file.avi.1, file.avi.2… The default is 2 GB.

Examples

Converting AVI files to VCD

Encoding the audio with libavcodec:

avidemux2 --load input.avi --audio-process \
--audio-normalize --audio-resample 44100 --audio-codec MP2 \
--audio-bitrate 224 --output-format PS --video-process \
--vcd-res --video-codec VCD --save output.mpg --quit

Encoding the audio with TWOLAME:

avidemux2 --load input.avi --audio-process \
--audio-normalize --audio-resample 44100 \
--audio-codec TWOLAME --audio-bitrate 224 \
--output-format PS --video-process --vcd-res \
--video-codec VCD --save output.mpg --quit

Re-encoding a soundtrack to MP3 VBR

First save the audio in WAV format:

avidemux --load input.avi --audio-process \
--audio-normalize --audio-resample \
--save-uncompressed-audio /tmp/videocd.wav

Then encode it with Lame seperately:

lame /tmp/videocd.wav -vbr -v -V 4 \
/tmp/videocd.mp3

Reload the MP3 and save AVI:

avidemux --load input.avi --external-mp3 /tmp/videocd.mp3 \
--audio-map --save /tmp/new.avi

The audio map is very important as we have generated a VBR MP3. Else expect async big time!

It is just an example as you can encode to MP3 VBR using the GUI directly.

Batch convert MP4 files to AVI

This example will open the MP4 file safely (if it contains H.264 video or anything else, it does not matter). Then it will save the file into an AVI container, with no modification to the video or audio. The command in general is this:

avidemux2 --force-alt-h264 --load "video.mp4" \
--save "video.avi" --output-format AVI --quit

Here is a small script to process all the MP4 files in the current directory:

#!/bin/bash
VAR="files.txt"
ls *.mp4 | sort > $VAR # Collect the files in the current directory
cat $VAR | while read line; do  # Loop read the filenames from the file
  INPUT=$(echo ${line}) # Grab the nxt new filename
  OUTPUT=${INPUT%.*4} # Remove shortest match of characters between the '. ' and the '4' at end of string
  OUTPUT+=".avi" # Append new extension
  avidemux2 --force-alt-h264 --load "$INPUT" --save "$OUTPUT" --output-format AVI --quit 
done
rm $VAR # Remove the text file with the file names
using/command_line_usage.txt · Last modified: 2012/11/11 08:51 (external edit)