close
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
ID_LENGTH=629.98
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
==========================================================================

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

Opening audio decoder: [faad] AAC (MPEG2/4 Advanced Audio Coding)
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,等等
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 BB 的頭像
    BB

    Welkin小窩

    BB 發表在 痞客邦 留言(0) 人氣()