All notes
Avidemux

# Intro

Avidemux tutorial on batch processing.  

REM pity that we could not specify filters here such as Rotating.
set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe"
set videocodec=Xvid
set audiocodec=MP3
for %%f in (*.mp4) do %avidemux% --video-codec %videocodec% --audio-codec %audiocodec% --force-alt-h264 --load "%%f" --save "%%f.avi" --quit

 

## Video Compression

ezs3.

Among MP4, MOV, FLV, WMV and AVI containers, MP4 is the best option.

• MOV too complex.
• FLV only supported by the flash plugin.
• WMV requires specialized plugins and is generally only supported by Microsoft.
• AVI is not meant for web distribution, as it is targeted at desktop players.
• MP4 is almost universally supported, and can use the H.264 video codec and the AAC audio codec, compatibility wise they are the best choices for compressing your video.

• Set the overall bitrate (video+audio) to be under the download speed to achieve a streaming playback. File size (kb) = bitrate (kilobits per second) x duration (s).
• The contributing factors that will lead to a higher video bitrate are the amount of pixels (the resolution of the video), the frame rate, and the amount of motion present.
• Lower the resolution to fit end screen. Keep your resolution in a value evenly divisible by 16 as more as you can.
• Frame Rate. typical film rate: 24fps. screen cast: 5fps. footage of video games: 60fps. PAL (common in Europe and some parts of Asia) uses 25fps. NTSC standard (used in the US and Japan) uses 29.97fps.
• You should never exceed the frame rate of the source video.
• When lowering your frame rate make sure to accomplish it in even increments (such as splitting the amount in half) to avoid de-syncing of the video and audio streams.
• VBR (Variable Bit Rate) allows you to set a maximum and minimum bitrate. CBR (Constant Bit Rate encoding). As a general rule VBR is for progressive or standard downloads and CBR is for use when using a streaming cloudfront. This Encoding.com page recommneds VBR over CBR.

Screencast example
Assume your video is a low motion 5fps screen cast in a 1280 x 720 frame size you would have a formula like this: (1 = Low Motion, multiply by 0.07 to get the bit rate in bps)
(1280 x 720 x 5) x 1 x 0.07 = 322,560 bps / 1000 = 322 kbps bitrate

High action video example
Another example on the other side of the spectrum would be a 24 fps high action shot of an action scene with multiple quick cuts in a 1920 x 1080 frame size: (4 = High Motion)
(1920 x 1080 x 24) x 4 x 0.07 = 13,934,592 bps / 1000 = 13,934 kbps bitrate


## Audio encoders

• For creating AVI files, the general practice rule is to use the LAME MP3 (MPEG-1 Layer 3) encoder. The reason being is that it is very high quality and is widely supported by nearly every video player.
• If you are concerned about patent issues on MP3 format or want audio of even higher accoustic quality, choose Vorbis instead. Note that Vorbis raw audio streams are unplayable as they need a proper container (Ogg or Matroska).
• AAC audio files, this type of audio is not recommended under any circumstances for use with video files (and containers) other than specifically and literally the MP4 container. In the case of the MP4 container, AAC is the best choice you can have, since the only other option is MP3 audio. AAC audio for video files (even MP4 videos) is still fairly poorly supported and often causes players to crash on certain platforms.
• MPEG-1 layer 2 (MP2)
• WAV PCM. It produces uncompressed Microsoft RIFF WAV PCM audio files. This is lossless fully decompressed audio data, very large, but you can be assured of no quality loss. Normal PCM cannot be used with MPEG files, but LPCM can.
• WAV LPCM. Linear Pulse Code Modulation (or LPCM) is a format that is a popular choice in music production. It can have up to 8 channels of audio at 48(nbsp)kHz or 96(nbsp)kHz sampling frequency and 16, 20 or 24 bits per sample. It has a maximum bit rate of 6.144(nbsp)MB/s. The format, without compressing the sound data, simultaneously samples and captures analog signals and transforms them into digital signals. It's generally limited to use with MPEG files.

## Video encode

• Two-pass is recommended.

# ffmpeg

 

# bitrate of 1000000 bits/sec.
ffmpeg -i input.mp4 -b 1000000 output.mp4

# slhck.
# Basically, the CRF ranges from 0 (lossless, best) to 51 (worst). Steps of ±6 roughly egal double or half the bitrate.
# The default for x264 is 23.
ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4

# SuperUser.
for i in $(seq 0 5 51); do ffmpeg -i input.mkv -c:v libx264 -crf$i -c:a copy output-\$i.mkv
done