Quickly Transcoding Video on OS X

I still have an old digital camera that records video in MPEG format (pretty inefficient), 10 seconds of video takes up 11 megabytes of disk space. Not something that you want to send to a friend via email (I know, I’m not on Vine, but who cares?)

I needed a way to quickly convert this video to a more efficient format and OS X has one built in: avconvert. It’s a command line tool, and it’s pretty easy to use.

Here’s what the command line help says about it:

$ avconvert --help
avconvert -p  -s  -o  []

avconvert is a command line application that will transcode a source or group of 
sources to create a destination file output based on a specified preset and with 
a collection of specified settings modifications.

The following flags are required by avconvert:
	-p 
	-s 
	-o 

avconvert will do the best it can to meet all the settings that are specified. 
It will prioritize the settings and the settings actually used in the export 
will be shown and those that could not match the specification settings clearly
noted.

So all you have to do is open a Terminal, change to the directory where your video is stored, and run something like:

$ avconvert -p PresetAppleM4ViPod -s video.mpg -o video.mov
Audio Settings:
	Audio Channel Count = 1
	Audio Channel Layout = Mono
	Audio Converter Quality = 127
	Audio Data Rate = 96000
	Audio Data Rate Control Mode = 2
	Audio Duration = {1001160/90000 = 11.124}
	Audio Format = aac 
	Audio Sample Rate = 32000
	Audio Stream Basic Description =  1 ch,  32000 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame

Video Settings:
	Frame Reordering = NO
	Image Height = 480
	Image Width = 640
	Track Height = 480
	Track Width = 640
	Video Average Data Rate = 1500
	Video Codec = avc1
	Video Codec Profile Level = H264_Baseline_3_0
	Video Codec Usage Mode = 6
	Video Color Depth = 24
	Video Color Primaries = SMPTE_C
	Video Duration = {999000/90000 = 11.100}
	Video Frame Rate = 0
	Video Key Frame Frequency = 30
	Video Maximum Frame Rate = 30
	Video Scaling Mode = CropSourceToCleanAperture
	Video Transfer Function = ITU_R_709_2
	Video YCbCr Matrix = ITU_R_601_4

=========================================
avconvert completed with error:0.

When the command finishes, your video is transcoded.

There are a number of different presets that you can use to set the size and quality of the video transcoding, which should be mostly self explanatory:

$ avconvert --listPresets
Presets available for use with avconvert:
     PresetAppleM4VCellular
     PresetAppleM4ViPod
     PresetAppleM4VWiFi
     PresetAppleM4VAppleTV
     PresetAppleM4V480pSD
     PresetAppleM4V720pHD
     PresetAppleM4V1080pHD
     PresetAppleM4A
     Preset640x480
     Preset1280x720
     Preset1920x1080
     PresetAppleProRes422LPCM

The actual bitrate and resolution settings for some of these presets are not clear to me, and I’m not sure where Apple has documented them, if at all. (Seems like there’s a Japanese guy who figured it out, though!)