关键字: mplayer ffmpeg faac faad lame xvid x264
1. 使用 mplayer分析多媒体文件信息
mplayer -identify -frames 5 -endpos 0 -vo null YOU-FILE
MPlayer SVN-r29319-4.3.2 (C) 2000-2009 MPlayer Team
Playing onepiece.mp4.
libavformat file format detected.
ID_AUDIO_ID=0
[lavf] Audio stream found, -aid 0
ID_VIDEO_ID=1
[lavf] Video stream found, -vid 1
VIDEO: [avc1] 1280x720 24bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
ID_FILENAME=onepiece.mp4
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=avc1
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=1280
ID_VIDEO_HEIGHT=720
ID_VIDEO_FPS=23.976
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_FORMAT=255
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
[color=red]ID_LENGTH=629.98[/color]
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
==========================================================================
Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
FAAD: compressed input bitrate missing, assuming 128kbit/s!
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
ID_AUDIO_BITRATE=128000
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
Selected audio codec: [faad] afm: faad (FAAD AAC (MPEG-2/MPEG-4 Audio))
以上红色部分就是我们需要的常规视频信息
2. 使用 ffmpeg 获得多媒体视频文件信息
Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 24.00 (24/1)
Input #0, asf, from 'Ter2_720.wmv':
Duration: 00:02:02.94, start: 5.000000, bitrate: 7590 kb/s
Stream #0.0: Audio: wmav2, 44100 Hz, stereo, s16, 192 kb/s
Stream #0.1: Video: vc1, yuv420p, 1280x544, 7078 kb/s, 24 tbr, 1k tbn, 1k tbc
根据mplayer&ffmpeg的输出,用脚本(python)对输出做分析,既可以获得
多媒体视频文件的常规信息
比如
分辨率,码流,视频格式,音频格式,音频采样率,音频声道,fps,等等