亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 1189 | 回復: 0
打印 上一主題 下一主題

初識 ffmpeg [復制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2011-02-15 20:03 |只看該作者 |倒序瀏覽
初識 FFmpeg
 
FFmpeg 是一個多媒體編解碼庫。它能夠?qū)崿F(xiàn)很多文件格式的編解碼,若要知道具體支持什么格式可在編譯ffmpeg庫之后在命令行輸入# ./configure --help 通過幫助信息來查看。像 avi 這種常用的視頻格式 ffmpeg 里面已經(jīng)自帶了解碼庫。像 xvid、x264 等格式的文件需要添加 xvid 和 x264 的庫來支持。因為在 ffmpeg里面,xvid 跟 x264 的庫只是一個空殼子。
 
當我們調(diào)用 ffmpeg里面的庫(主要是libavformat和libavcodec文件)來解碼視頻文件后,我們可以通過 SDL庫 或者 QT 庫
將解碼出的數(shù)字信息轉(zhuǎn)化成圖像畫在屏幕上,這樣,視頻文件就顯示出來了(即播放器)。聽起來很簡單,但制作的過程可
非一般。
 
ffmpeg的源碼目錄下有ffmpeg.c、、ffplar.c、ffserver.c這三個文件。現(xiàn)在通過ffmpeg/doc 目錄下的文檔來認識下
這三個文件。
-------------------------------------------------------------------------------------------
 
FFmpeg
    ->FFmpeg is a very fast video and audio converter. It can also grab from a live audio/video source.
      The command line interface is designed to be intuitive, in the sense that FFmpeg tries to figure
      out all parameters that can possibly be derived automatically. You usually only have to specify
      the target bitrate you want.FFmpeg can also convert from any sample rate to any other, and resize
      video on the fly with a high quality polyphase filter.As a general rule, options are applied to the
      next specified file. Therefore, order is important, and you can have the same option on the command
      line multiple times. Each occurrence is then applied to the next input or output file.
  ->如何使用 ffmpeg的命令行?,以下是一些例子。具體可參考ffmpeg/doc/ffmpeg.texi,里面描述的相當詳盡。
    ->ffmpeg [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}...
      ->To set the video bitrate of the output file to 64kbit/s:    
        ffmpeg -i input.avi -b 64k output.avi
      ->To force the frame rate of the output file to 24 fps:
        ffmpeg -i input.avi -r 24 output.avi
      ->To force the frame rate of the input file (valid for raw formats only) to 1 fps and the frame
      rate of the output file to 24 fps:
        ffmpeg -r 1 -i input.m2v -r 24 output.avi
      ......
      ......
     
摘自ffmpeg/doc/ffmpeg.texi
-------------------------------------------------------------------------------------------
 
FFplay
    ->FFplay is a very simple and portable media player using the FFmpeg libraries
      and the SDL library. It is mostly used as a testbed for the various FFmpeg APIs.
    ->ffplay [options] @file{input_file}
摘自ffmpeg/doc/ffplay.texi
-------------------------------------------------------------------------------------------
 
FFserver
      ->FFserver is a streaming server for both audio and video. It supports several live feeds, streaming from
        files and time shifting on live feeds (you can seek to positions in the past on each live feed, provided
        you specify a big enough feed storage in ffserver.conf).FFserver runs in daemon mode by default; that is,
        it puts itself in the background and detaches from its TTY, unless it is launched in debug mode or a
        NoDaemon option is specified in the configuration file.
摘自ffmpeg/doc/ffserver.texi
-----------------------------------------------------------------------------------------
FFMPEG的庫會在不斷的更新,更新之后的一些API是用法可能會跟之前的API有很大的不同,而網(wǎng)上對最新
庫的資料的討論可能會比較少,這時我們就可以參考FFMPEG庫里面自帶的資料。
api-example.c
/**
 * @file
 * avcodec API use example.
 *
 * Note that this library only handles codecs (mpeg, mpeg4, etc...),
 * not file formats (avi, vob, etc...). See library 'libavformat' for the
 * format handling
 */
/*
 * 該文件所在位置 ffmpeg/libavcodec/api-example.c
 * 該文件講的是如何運用庫 libavcodec 來實現(xiàn)文件的編碼和解碼。
 * 該文件主要包含部分:
 * 1、Audio encoding example
 *    Audio decoding
 * 2、Video encoding example
 *    Video decoding
 * 3、int main(int argc, char **argv) 。1 與 2 的實現(xiàn) 
 */
output-example.c
/*
 * Libavformat API example: Output a media file in any supported
 * libavformat format. The default codecs are used.
 */
 
假如我們想自己寫個播放器的時候,主要參考下api-example.c和output-example.c就可以了。
api-example.c 講的是音視頻解碼函數(shù)的使用。
output-example.c 講的是如何將解碼出來的幀轉(zhuǎn)換成一定格式的數(shù)據(jù)。
 
更多關于FFMPEG的資料可參考http://zh.wikipedia.org/wiki/FFmpeg
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP