FFMPEG An Intermediate Guide/MPEG

From Wikibooks, open books for an open world
Jump to: navigation, search

FFMPEG: Encoding, Decoding
Full Name: Moving Picture Experts Group
Web sites: Motion Picture Experts Home Page
Description: MPEG is one of the most standard and widely used formats. Its been produced in a number of different iterations and used throughout the film industry from capture, storage to delivery.

Background[edit]

The Moving Pictures Experts Group, is the fore most group on defining and implementing video standards through out the film industry. Operating since 1988 and shaping the development of the entire industry.

MPEG's can be used for all levels of use but understanding how the different formats work will help you decide which is best suited for you needs. Please read through usages to help you decided which are the best settings for you usage.

The basic premise of the Moving Picture Expert Group, is that encoding is done by a few powerful machines and decoding will be done by many weaker systems. So depending on the setting you use, it can be processor intense to encode, but should be fairly light to decode.

FFMPEG Guide[edit]

Usages[edit]

MPEG1[edit]

MPEG1 is a low bit rate format, designed to be used on CD running at a rate of less than 1.5Mb/s. Comparative to MPEG2, MPEG1 will generally out perform MPEG2 at lower bit rates, though MPG4 should out perform MPEG1.

There is no audio encoder for MPEG 1 audio, although there is a decoder. For audio simply use MPEG 2 (mp2) audio as this will work with most high end encoders.

For a single pass mpeg1:[edit]

ffmpeg -i "input_file" -vcodec mpeg1video -acodec mp2 "output_file.mpeg"

For a two pass mpeg1 encoding:[edit]

ffmpeg -i "input_video" -pass 1 -f mpeg1video -an -passlogfile log_file "output_file.mpeg"

ffmpeg -i "input_video" -pass 2 -f mpeg1video -acodec mp2 -passlogfile log_file "output_file.mpeg"


For an optimized two pass mpeg1 encoding:[edit]

ffmpeg -i "input_video" -pass 1 -f mpeg1video -b 750000 -s 320x240 -an -passlogfile log_file "output_file.mpeg"

ffmpeg -i "input_video" -pass 2 -f mpeg1video -b 750000 -s 320x240 -acodec mp2 -ab 128000 -passlogfile log_file "output_file.mpeg"

MPEG2[edit]

MP3[edit]

MP4[edit]

  1. ffmpeg -i source.avi -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -s 320×240 destination.mp4
  1. ffmpeg -v 0 -i in.flv -y -acodec libfaac -ar 22050 -ab 64k -r 25 -vb 384000 -f mp4 -vcodec mpeg4 out.mp4
  1. ffmpeg -i source.mp4 -s 176×144 -vcodec h263 -r 25 -b 12200 -ab 12200 -ac 1 -ar 8000 destination.3gp

Universal Delivery[edit]

mpeg1

CD[edit]

VCD and SVCD

DVD[edit]

DVD-Video are the most used format for final delivery of footage. This section is only looking at standard DVD-Video as a delivery format.

Some useful information to know. DVD decodes tend to work up to a maximum of about 8Mb/s and a minimum of 1.5Mb/s (assuming MPEG2, MPEG1 can go smaller, though we advise you don't use it). Constant bit rate is faster to encode to but variable bit rate will give to much better size and possibly quality. Please see the section on variable bit rate.

For older DVD players you should not go above 6Mb/s, though the rule of thumb is unless its specifically asked for, 8Mb/s should work 90% of the time and buy you grandma a new DVD play.

Constant Bit rate DVDs[edit]

Best quality: 8Mb/s, 55 minutes of video

  • 1 Hour: 7350Kb/s.
  • 2 Hours: 4550Kb/s

(these are guide lines you may need to adjust to the length of your footage.)

You should avoid going below 4500kb/s as the quality become awful.

Variable Bit Rate DVDs[edit]

BLU-RAY and HDDVD[edit]

Broadcast[edit]

15Mb/s

Long Term, High Quality Storage[edit]

50 - 880Mb/s

Streaming[edit]

Interlaced Footage[edit]

Useful links[edit]