使用MPlayer获取文件信息
原址:http://blog.csdn.net/songjinshi/article/details/6520696
关键字:mplayerffmpegfaacfaadlamexvidx264
1.使用mplayer分析多媒体文件信息
mplayer-identify-frames5-endpos0-vonullYOU-FILE
MPlayerSVN-r29319-4.3.2(C)2000-2009MPlayerTeam
Playingonepiece.mp4.
libavformatfileformatdetected.
ID_AUDIO_ID=0
[lavf]Audiostreamfound,-aid0
ID_VIDEO_ID=1
[lavf]Videostreamfound,-vid1
VIDEO:[avc1]1280x72024bpp23.976fps0.0kbps(0.0kbyte/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
ID_LENGTH=629.98
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Openingvideodecoder:[ffmpeg]FFmpeg'slibavcodeccodecfamily
Selectedvideocodec:[ffh264]vfm:ffmpeg(FFmpegH.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
==========================================================================
Openingaudiodecoder:[faad]AAC(MPEG2/4AdvancedAudioCoding)
FAAD:compressedinputbitratemissing,assuming128kbit/s!
AUDIO:44100Hz,2ch,s16le,128.0kbit/9.07%(ratio:16000->176400)
ID_AUDIO_BITRATE=128000
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
Selectedaudiocodec:[faad]afm:faad(FAADAAC(MPEG-2/MPEG-4Audio))
以上红色部分就是我们需要的常规视频信息
2.使用ffmpeg获得多媒体视频文件信息
Seemsstream1codecframeratediffersfromcontainerframerate:1000.00(1000/1)->24.00(24/1)
Input#0,asf,from'Ter2_720.wmv':
Duration:00:02:02.94,start:5.000000,bitrate:7590kb/s
Stream#0.0:Audio:wmav2,44100Hz,stereo,s16,192kb/s
Stream#0.1:Video:vc1,yuv420p,1280x544,7078kb/s,24tbr,1ktbn,1ktbc
根据mplayer&ffmpeg的输出,用脚本(python)对输出做分析,既可以获得
多媒体视频文件的常规信息
比如
分辨率,码流,视频格式,音频格式,音频采样率,音频声道,fps,等等