开启ffmpeg学习之旅

FFMPEG,每个做音视频的人必学的东西,先从下载开始吧。

官方网址:http://ffmpeg.org

因为开源代码是基于GIT管理的,所以最好还是在本地按张git,然后通过git来下载和管理代码。

git的安装:sudo apt-get install git

然后就是用git下载代码:git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

------------------------------初识FFMPEG----------------------------

FFmpeg 是一个多媒体编解码库。它能够实现很多文件格式的编解码,若要知道具体支持什么格式可在编译ffmpeg库之后在命令行输入# ./configure --help 通过帮助信息来查看。像 avi 这种常用的视频格式 ffmpeg 里面已经自带了解码库。像 xvid、x264 等格式的文件需要添加 xvid 和 x264 的库来支持。因为在 ffmpeg里面,xvid 跟 x264 的库只是一个空壳子。
 
当我们调用 ffmpeg里面的库(主要是libavformat和libavcodec文件)来解码视频文件后,我们可以通过 SDL库 或者 QT 库将解码出的数字信息转化成图像画在屏幕上,这样,视频文件就显示出来了(即播放器)。听起来很简单,但制作的过程可非一般。
 
ffmpeg的源码目录下有ffmpeg.c、、ffplar.c、ffserver.c这三个文件。现在通过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有很大的不同,而网上对最新库的资料的讨论可能会比较少,这时我们就可以参考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 来实现文件的编码和解码。
 * 该文件主要包含部分:
 * 1、Audio encoding example
 *    Audio decoding
 * 2、Video encoding example
 *    Video decoding
 * 3、int main(int argc, char **argv) 。1 与 2 的实现
 */
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 讲的是音视频解码函数的使用。
output-example.c 讲的是如何将解码出来的帧转换成一定格式的数据。
 
更多关于FFMPEG的资料可参考http://zh.wikipedia.org/wiki/FFmpeg


提供了一个基于51单片机的RFID门禁系统的完整资源文件,包括PCB图、原理图、论文以及源程序。该系统设计由单片机、RFID-RC522频射卡模块、LCD显示、灯控电路、蜂鸣器报警电路、存储模块和按键组成。系统支持通过密码和刷卡两种方式进行门禁控制,灯亮表示开门成功,蜂鸣器响表示开门失败。 资源内容 PCB图:包含系统的PCB设计图,方便用户进行硬件电路的制作和调试。 原理图:详细展示了系统的电路连接和模块布局,帮助用户理解系统的工作原理。 论文:提供了系统的详细设计思路、实现方法以及测试结果,适合学习和研究使用。 源程序:包含系统的全部源代码,用户可以根据需要进行修改和优化。 系统功能 刷卡开门:用户可以通过刷RFID卡进行门禁控制,系统会自动识别卡片并判断是否允许开门。 密码开门:用户可以通过输入预设密码进行门禁控制,系统会验证密码的正确性。 状态显示:系统通过LCD显示屏显示当前状态,如刷卡成功、密码错误等。 灯光提示:灯亮表示开门成功,灯灭表示开门失败或未操作。 蜂鸣器报警:当刷卡或密码输入错误时,蜂鸣器会发出报警声,提示用户操作失败。 适用人群 电子工程、自动化等相关专业的学生和研究人员。 对单片机和RFID技术感兴趣的爱好者。 需要开发类似门禁系统的工程师和开发者。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值