Saturday, March 03, 2012

joining, concatenating video files

I was trying to combine four MP4's and had a bit of a learning experience, so I thought I'd share.

Here are the four files I was trying to combine, a total of roughly 1.5GB:
[sodo@computer tmp]$ ll part?.mp4
-rw-------. 1 sodo sodo 282308395 Feb 29 19:19 part1.mp4
-rw-------. 1 sodo sodo 547860894 Feb 29 19:39 part2.mp4
-rw-------. 1 sodo sodo 429237647 Mar  3 13:54 part3.mp4
-rw-------. 1 sodo sodo 428161483 Feb 29 20:12 part4.mp4

The Few, The Proud
After reading some FFmpeg doc (linked in the references), I found out that MP4's can't be concatenated in their native form.  There are only a few video formats that CAN be concatenated in their native form: MPEG-1, MPEG-2 PS, DV.  After some experimentation and viewing the results, I decided to use mpeg2video as my intermediate format with this command:
ffmpeg -threads 8 -i part1.mp4 -sameq -vcodec mpeg2video -acodec mp2 -ac 2 -ar 44100 -ab 256k 1.mpg

Converting en masse
Since I had four of these files to convert, it made sense for me to use some quick shell control flow to get the job done in one shot (input/output streams in bold below):
for i in 1 2 3 4;do ffmpeg -threads 8 -i part$i.mp4 -sameq -vcodec mpeg2video -acodec mp2 -ac 2 -ar 44100 -ab 256k $i.mpg;done

When running, the output looks like this:
[sodo@computer tmp]$ for i in 1 2 3 4;do ffmpeg -threads 8 -i part$i.mp4 -sameq -vcodec mpeg2video -acodec mp2 -ac 2 -ar 44100 -ab 256k $i.mpg;done
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'part1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2012-02-18 19:44:00
  Duration: 00:12:08.29, start: 0.000000, bitrate: 3101 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x720, 2946 kb/s, 29.97 fps, 29.97 tbr, 60k tbn, 59.94 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 151 kb/s
    Metadata:
      creation_time   : 2012-02-18 19:44:26
[buffer @ 0x2329fe0] w:1280 h:720 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
[mpeg @ 0x2322280] VBV buffer size not set, muxing may fail
Output #0, mpeg, to '1.mpg':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2012-02-18 19:44:00
    encoder         : Lavf52.111.0
    Stream #0.0(und): Video: mpeg2video, yuv420p, 1280x720, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0.1(und): Audio: mp2, 44100 Hz, stereo, s16, 256 kb/s
    Metadata:
      creation_time   : 2012-02-18 19:44:26
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1

frame=21827 fps=117 q=0.0 Lsize= 1385478kB time=00:12:08.26 bitrate=15584.8kbits/s  
video:1357365kB audio:22759kB global headers:0kB muxing overhead 0.387953%


The intermediate blues
The file size of the intermediates ballooned, expectedly:
[sodo@computer tmp]$ ll ?.mpg
-rw-rw-r--. 1 sodo sodo 1418729472 Mar  3 12:59 1.mpg
-rw-rw-r--. 1 sodo sodo 2290866176 Mar  3 13:05 2.mpg
-rw-rw-r--. 1 sodo sodo 2143287296 Mar  3 13:06 3.mpg
-rw-rw-r--. 1 sodo sodo 1918547968 Mar  3 13:11 4.mpg

Simple filesystem concatenation
After I converted the base files into files of a type that could be concatenated, I used this command to concatenate the files:
cat 1.mpg 2.mpg 3.mpg 4.mpg > all.mpg


The resulting file is pretty large ~6GB:
[sodo@computer tmp]$ ll all.mpg 
-rw-rw-r--. 1 sodo sodo 6165041152 Mar  3 13:16 all.mpg

This would be a quite serviceable intermediate file, but upon reflection, I thought that I could probably do the concatenation and conversion to a final format in one step, rather than two.  FFmpeg to the rescue!

FFmpeg's "concat" feature
Because I like my iDevices, I want the file format to be an MP4 container using H264/AAC as my video and audio formats.  So instead of doing a two-step conversion:
1) concatenate the files in the filesystem
2) transcode the video to a file format

I decided to combine both of those steps into one by using the "concat" feature of ffmpeg.  The command looks like this:
ffmpeg -i concat:"/tmp/1.mpg|/tmp/2.mpg|/tmp/3.mpg|/tmp/4.mpg" -acodec libfaac -aq 100 -ac 2 -vcodec libx264 -vpre slow -crf 24 output.mp4

You can change the output specifiers to taste.  Also note that you'll need a presets file defined if you are going to use the "-vpre slow" specifier.

There was no way to tell from FFmpeg's output that the concatenation command was working except for this small line:
Input #0, mpeg, from 'concat:/tmp/1.mpg|/tmp/2.mpg|/tmp/3.mpg|/tmp/4.mpg'
as well as the fact that the "frame=" counter at the bottom of the FFmpeg output incremented beyond the length of the first video.  In this case, 21827.

Verify the total number of frames
Redirecting standard error to standard output
As a sanity check, I like to verify the total number of frames in the output.  I can do this by capturing the text information that FFmpeg outputs when FFmpeg runs.  That text information is not "standard output" in the Unix sense.  The text from an FFmpeg command actually outputs "standard error".  So instead of trying to grep with a command like this:
ffmpeg -i 1.mpg -an -vcodec copy -f mpeg2video -y NUL  | grep 'frame'

You actually need a command like this:
ffmpeg -i 1.mpg -an -vcodec copy -f mpeg2video -y NUL 2>&1 | grep 'frame'

Or save the output to a file and then grep:
ffmpeg -i 1.mpg -an -vcodec copy -f mpeg2video -y NUL 2>&1 | tee test.txt ; grep 'frame' test.txt

The 2>&1 redirects (the ">") standard error (the "2") to standard output (the "1").  For some reason, we need an ampersand in there for the command to work correctly.

Unfortunately, I encountered a nasty little problem when I tried to read the output from that file, explained here:
http://www.techanswerguy.com/2012/03/redirecting-ffmpeg-output-performing.html

If you don't want to worry about the details, here is the solution I used to grab the number of frames in the output:
ffmpeg -i 1.mpg -an -vcodec copy -f mpeg2video -y NUL 2>&1 | awk -F"\015" 'NF > 1 {lf=NF-1;print $lf}' | awk '{print $1}' | awk -F= '{print $2}'

Until then..there you have it!  Appending multiple video files together using FFmpeg's concat feature. Sweet!
*da mule*

References
http://www.ffmpeg.org/faq.html#toc-How-can-I-join-video-files_003f
http://ffmpeg.org/faq.html

get detailed information about a video file

Here are a few ways to get detailed information about a video file using mplayer, ffmpeg or mencoder.  Pardon the format weirdness..blogger tries to overthink things and ends up screwing things up.
- mplayer
- ffmpeg
- mencoder
- ffprobe

1) mplayer: simple inspection
[sodo@computer tmp]$ mplayer -vo null -benchmark part1.mp4 
MPlayer SVN-r33996-4.6.1 (C) 2000-2011 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

# PLAYBACK STARTS
Playing part1.mp4.
# CONTAINER INSPECTION
libavformat file format detected.
# MPLAYER USES libavformat PLAYBACK for this VIDEO STREAM
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  1280x720  24bpp  29.970 fps  2946.5 kbps (359.7 kbyte/s)
Clip info:
 major_brand: mp42
 minor_version: 0
 compatible_brands: isommp42
 creation_time: 2012-02-18 19:44:00
# CHECK FOR SUBTITLES
Load subtitles in ./
# DECODE VIDEO USING FFMPEG
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
# DECODE AUDIO USING FFMPEG

==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 152.0 kbit/10.77% (ratio: 18997->176400)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
# USE DISCOVERED AUDIO DEVICE
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Movie-Aspect is undefined - no prescaling applied.
VO: [null] 1280x720 => 1280x720 Planar YV12 
A:   1.3 V:   1.3 A-V:  0.001 ct:  0.033   0/  0 23%  0%  0.4% 0 0                                                                                                                
Exiting... (Quit)

2) mplayer: detailed information
[sodo@computer tmp]$ mplayer -v part1.mp4 -frames 0
MPlayer SVN-r33996-4.6.1 (C) 2000-2011 MPlayer Team
# YOUR COMPUTER STATS
CPU vendor name: GenuineIntel  max cpuid level: 10
CPU: Intel(R) Xeon(R) CPU           E5310  @ 1.60GHz (Family: 6, Model: 15, Stepping: 7)
extended cpuid-level: 8
extended cache-info: 268468288
Detected cache-line size is 64 bytes
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNowExt: 0 SSE: 1 SSE2: 1 SSSE3: 1
# MPLAYER BUILD STATS
Compiled with runtime CPU detection.
get_path('codecs.conf') -> '/home/sodo/.mplayer/codecs.conf'
Reading optional codecs config file /home/sodo/.mplayer/codecs.conf: No such file or directory
Reading optional codecs config file /etc/mplayer/codecs.conf: No such file or directory
Using built-in default codecs.conf.
init_freetype
Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
get_path('fonts') -> '/home/sodo/.mplayer/fonts'
Configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/mplayer --mandir=/usr/share/man --confdir=/etc/mplayer --libdir=/usr/lib64 --codecsdir=/usr/lib64/codecs --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic --language=all --enable-joystick --enable-lirc --enable-menu --enable-radio --enable-radio-capture --enable-runtime-cpudetection --enable-unrarexec --disable-dvdread-internal --disable-libdvdcss-internal --disable-nemesi --disable-smb --disable-ffmpeg_a --disable-faac --disable-mad --disable-libmpeg2-internal --disable-tremor-internal --disable-bitmap-font --disable-dga1 --disable-dga2 --disable-directfb --disable-svga --disable-termcap --enable-xvmc --with-xvmclib=XvMCW --disable-arts --disable-esd --disable-jack --disable-openal
CommandLine: '-v' 'part1.mp4' '-nosound' '-frames' '0'
Using nanosleep() timing
# MPLAYER CONFIG PATH SEARCH
get_path('input.conf') -> '/home/sodo/.mplayer/input.conf'
Reading optional input config file /home/sodo/.mplayer/input.conf: No such file or directory
Parsing input config file /etc/mplayer/input.conf
Input config file /etc/mplayer/input.conf parsed: 92 binds
Setting up LIRC support...
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
get_path('part1.mp4.conf') -> '/home/sodo/.mplayer/part1.mp4.conf'

# PLAYBACK STARTS
Playing part1.mp4.
get_path('sub/') -> '/home/sodo/.mplayer/sub/'
[file] File size is 282308395 bytes
# META INFORMATION
STREAM: [file] part1.mp4
STREAM: Description: File
STREAM: Author: Albeu
STREAM: Comment: based on the code from ??? (probably Arpi)
# CONTAINER INSPECTION
LAVF_check: QuickTime/MPEG-4/Motion JPEG 2000 format
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x35a00e4c00]ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x35a00e4c00]All info found
# VIDEO STREAM INSPECTION, frame sizes/compression type
==> Found video stream: 0
======= VIDEO Format ======
  biSize 79
  biWidth 1280
  biHeight 720
  biPlanes 0
  biBitCount 24
  biCompression 875967048='H264'
  biSizeImage 2764800
Unknown extra header dump: [1] [64] [0] [1f] [ff] [e1] [0] [18] [67] [64] [0] [1f] [ac] [24] [88] [5] [0] [5b] [a1] [0] [0] [3] [3] [e9] [0] [0] [ea] [60] [f] [18] [32] [a0] [1] [0] [4] [68] [ee] [3c] [b0] 
===========================
[lavf] stream 0: video (h264), -vid 0
# AUDIO STREAM INSPECTION
==> Found audio stream: 1
======= WAVE Format =======
Format Tag: 20557 (0x504D)
Channels: 2
Samplerate: 44100
avg byte/sec: 18997
Block align: 1
bits/sample: 16
cbSize: 2
Unknown extra header dump: [12] [10] 
==========================================================================
# MPLAYER USES libavformat PLAYBACK for this VIDEO STREAM
[lavf] stream 1: audio (aac), -aid 0, -alang und
LAVF: 1 audio and 1 video streams found
LAVF: build 3436288
VIDEO:  [H264]  1280x720  24bpp  29.970 fps  2946.5 kbps (359.7 kbyte/s)
[V] filefmt:44  fourcc:0x34363248  size:1280x720  fps:29.970  ftime:=0.0334
Clip info:
 major_brand: mp42
 minor_version: 0
 compatible_brands: isommp42
 creation_time: 2012-02-18 19:44:00
# CHECK FOR SUBTITLES
Load subtitles in ./
get_path('sub/') -> '/home/sodo/.mplayer/sub/'
# CHECK X11 STATS
X11 opening display: :0
vo: X11 color mask:  FFFFFF  (R:FF0000 G:FF00 B:FF)
vo: X11 running at 2560x1024 with depth 24 and 32 bpp (":0" => local display)
[x11] Detected wm supports layers.
[x11] Using workaround for Metacity bugs.
[x11] Detected wm supports NetWM.
[x11] Detected wm supports ABOVE state.
[x11] Detected wm supports BELOW state.
[x11] Detected wm supports FULLSCREEN state.
[x11] Current fstype setting honours FULLSCREEN ABOVE BELOW X atoms
# DECODE VIDEO USING FFMPEG

==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
INFO: libavcodec init OK!
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
# DECODE AUDIO USING FFMPEG
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
dec_audio: Allocating 192000 + 65536 = 257536 bytes for output buffer.
FFmpeg's libavcodec audio codec
INFO: libavcodec "aac" init OK!
AUDIO: 44100 Hz, 2 ch, s16le, 152.0 kbit/10.77% (ratio: 18997->176400)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
# PREPARE TO PLAYBACK AUDIO
Building audio filter chain for 44100Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter dummy 
[dummy] Was reinitialized: 44100Hz/2ch/s16le
[dummy] Was reinitialized: 44100Hz/2ch/s16le
# FIND SUITABLE AUDIO DEVICE
Trying preferred audio driver 'pulse', options '[none]'
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
AO: Description: PulseAudio audio output
AO: Author: Lennart Poettering
Building audio filter chain for 44100Hz/2ch/s16le -> 44100Hz/2ch/s16le...
[dummy] Was reinitialized: 44100Hz/2ch/s16le
[dummy] Was reinitialized: 44100Hz/2ch/s16le
Starting playback...
Increasing filtered audio buffer size from 0 to 46144
Unsupported PixelFormat 61
Unsupported PixelFormat 53
[ffmpeg] aspect_ratio: 0.000000
# FIND SUITABLE PLAYBACK COLORSPACE
VDec: vo config request - 1280 x 720 (preferred colorspace: Planar YV12)
Trying filter chain: vo
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
# VIDEO OUTPUT CONFIGURATION (using NVIDIA)
VO Config (1280x720->1280x720,flags=0,'MPlayer',0x32315659)
VO: [vdpau] 1280x720 => 1280x720 Planar YV12 
VO: Description: VDPAU with X11
VO: Author: Rajib Mahapatra and others
[vdpau] Updating CSC matrix for BT.601
*** [vo] Exporting mp_image_t, 1280x720x12bpp YUV planar, 1382400 bytes
Unicode font: 5179 glyphs.
Unicode font: 5179 glyphs.
A:   1.0 V:   1.0 A-V:  0.002 ct:  0.032   0/  0 33% 10%  0.4% 0 0                                                                                                                
Uninit audio filters...
[libaf] Removing filter dummy 
Uninit audio: ffmpeg
Uninit video: ffmpeg
vo: uninit ..

3) ffmpeg
This option is nice because it gives you a count of the frames and bitrates.
[sodo@computer tmp]$  ffmpeg -i part1.mp4 -an -vcodec copy -f avi -y NUL
# FFMPEG BUILD STATS
ffmpeg version 0.7.11-rpmfusion, Copyright (c) 2000-2011 the FFmpeg developers
  built on Feb 25 2012 08:39:28 with gcc 4.6.1 20110908 (Red Hat 4.6.1-9)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --extra-version=rpmfusion --enable-bzlib --enable-libcelt --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-nonfree --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.123. 0 / 52.123. 0
  libavformat  52.111. 0 / 52.111. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0

# CONTAINER INSPECTION
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'part1.mp4':
# META INFORMATION: INPUT
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2012-02-18 19:44:00
  Duration: 00:12:08.29, start: 0.000000, bitrate: 3101 kb/s
# VIDEO STREAM INSPECTION: INPUT
    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x720, 2946 kb/s, 29.97 fps, 29.97 tbr, 60k tbn, 59.94 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
# AUDIO STREAM INSPECTION: INPUT
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 151 kb/s
    Metadata:
      creation_time   : 2012-02-18 19:44:26
# META INFORMATION: OUTPUT
Output #0, avi, to 'NUL':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2012-02-18 19:44:00
    ISFT            : Lavf52.111.0
# VIDEO STREAM INSPECTION: OUTPUT
    Stream #0.0(und): Video: libx264, yuv420p, 1280x720, q=2-31, 2946 kb/s, 29.97 tbn, 29.97 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
# SUMMARY STATS: frames, bitrates
frame=21827 fps=  0 q=-1.0 Lsize=  262481kB time=00:12:08.29 bitrate=2952.4kbits/s    
video:261953kB audio:0kB global headers:0kB muxing overhead 0.201505%

4) mencoder
Mencoder's kbit/s differs from ffmpegs..hmmm?
[sodo@computer tmp]$ mencoder -nosound -ovc frameno -vc null -o /dev/null part1.mp4 
MEncoder SVN-r33996-4.6.1 (C) 2000-2011 MPlayer Team
# STARTUP STATUS
success: format: 0  data: 0x0 - 0x10d3af2b
# META INFORMATION: INPUT
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
# VIDEO STREAM INSPECTION: INPUT
VIDEO:  [H264]  1280x720  24bpp  29.970 fps  2946.5 kbps (359.7 kbyte/s)
[V] filefmt:44  fourcc:0x34363248  size:1280x720  fps:29.970  ftime:=0.0334
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Pos: 728.3s  21827f (100%) 7165.79fps Trem:   0min   0mb  A-V:0.000 [0:0]
Writing index...
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

# BITRATE CALCULATIONS FOR MEDIA BURN
Recommended video bitrate for 650MB CD: 7480
Recommended video bitrate for 700MB CD: 8055
Recommended video bitrate for 800MB CD: 9207
Recommended video bitrate for 2 x 650MB CD: 14966
Recommended video bitrate for 2 x 700MB CD: 16118
Recommended video bitrate for 2 x 800MB CD: 18422


# SUMMARY STATS: frames, bitrates
Video stream:    0.959 kbit/s  (119 B/s)  size: 87308 bytes  728.294 secs  21827 frames


5) ffprobe

[sodo@computer tmp]$  ffprobe -loglevel error -show_streams GOPR0078.MP4 
ffprobe version 0.7.13, Copyright (c) 2007-2011 the FFmpeg developers
  built on Aug  1 2012 21:08:35 with clang 3.1 (tags/Apple/clang-318.0.58)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libdirac --enable-libschroedinger --enable-libopenjpeg --enable-libvpx --enable-libspeex --disable-libopencore-amrnb --disable-libopencore-amrwb --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.123. 0 / 52.123. 0
  libavformat  52.111. 0 / 52.111. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
codec_type=video
codec_time_base=1001/120000
codec_tag_string=avc1
codec_tag=0x31637661
width=1280
height=720
has_b_frames=1
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
r_frame_rate=60000/1001
avg_frame_rate=60000/1001
time_base=1/90000
start_time=0.000000 
duration=489.655833 
nb_frames=29350
TAG:creation_time=2012-01-08 12:43:14
TAG:language=eng
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=Advanced Audio Coding
codec_type=audio
codec_time_base=0/1
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_rate=48000.000000 
channels=2
bits_per_sample=0
r_frame_rate=0/0
avg_frame_rate=375/8
time_base=1/48000
start_time=0.000000 
duration=489.642667 
nb_frames=22952
TAG:creation_time=2012-01-08 12:43:14
TAG:language=eng
[/STREAM]



Appendix
Comparing the meta info of different output video streams
a. get frame and bitrate stats for a video, ffmpeg using -f avi
[sodo@computer tmp]$  ffmpeg -i part1.mp4 -an -vcodec copy -f avi -y NUL
# META INFORMATION: OUTPUT

Output #0, avi, to 'NUL':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2012-02-18 19:44:00
    ISFT            : Lavf52.111.0
    Stream #0.0(und): Video: libx264, yuv420p, 1280x720, q=2-31, 2946 kb/s, 29.97 tbn, 29.97 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
..
frame=21827 fps=  0 q=-1.0 Lsize=  262481kB time=00:12:08.29 bitrate=2952.4kbits/s    
video:261953kB audio:0kB global headers:0kB muxing overhead 0.201505%

b. get frame and bitrate stats for a video, ffmpeg, using -f mpeg2video
Output will be mostly the same as above, but I suspect the differences in Lsize and bitrate is due to my forcing the format of the output stream to mpeg2video
[sodo@computer tmp]$  ffmpeg -i part1.mp4 -an -vcodec copy -f mpeg2video -y NUL
..
# META INFORMATION: OUTPUT
Output #0, mpeg2video, to 'NUL':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2012-02-18 19:44:00
    encoder         : Lavf52.111.0
    Stream #0.0(und): Video: libx264, yuv420p, 1280x720, q=2-31, 2946 kb/s, 90k tbn, 29.97 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00

..
frame=21827 fps=  0 q=-1.0 Lsize=  261953kB time=00:12:08.29 bitrate=2946.5kbits/s    
video:261953kB audio:0kB global headers:0kB muxing overhead 0.000000%

c. ffmpeg, using rawvideo, -f yuv4mpegpipe
This one takes some time, as I've removed the option specifying ffmpeg to copy the same video stream so that ffmpeg actually transcodes the video stream into the raw video format, yuv4mpegpipe.
[sodo@computer tmp]$  ffmpeg -threads 8 -i part1.mp4 -an -f yuv4mpegpipe -y NUL
..
# META INFORMATION: OUTPUT

Output #0, yuv4mpegpipe, to 'NUL':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2012-02-18 19:44:00
    encoder         : Lavf52.111.0
    Stream #0.0(und): Video: rawvideo, yuv420p, 1280x720, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
..
frame=21827 fps= 46 q=0.0 Lsize=29466578kB time=00:12:08.29 bitrate=331446.0kbits/s    
video:0kB audio:0kB global headers:0kB muxing overhead inf%



References
Mplayer FAQ
# convert/transcode a video to rawvideo format, but just inspect the header
ffmpeg -i part1.mp4 -pix_fmt yuv420p -f yuv4mpegpipe - | head -1

# convert/transcode a video to rawvideo format
ffmpeg -i part1.mp4 -an -f yuv4mpegpipe -y NUL

http://ffmpeg.org/faq.html
http://ffmpeg.org/ffprobe.html