【Linux】Linux下MIPS平台交叉编译FFmpeg库 及使用库截取视频中的某一帧
2013-04-07 10:36
811 查看
一.Linux下MIPS平台交叉编译FFmpeg库:
1.下载ffmpeg库的源代码(http://sourceforge.net/project/showfiles.php?group_id=205275&package_id=248632):
[root@localhost ffmpeg]# ls
ffmpeg-laster.tar.gz
2.解压:
[root@localhost ffmpeg]# tar zxvf ffmpeg-laster.tar.gz
3.开始配置,并编译:
[root@localhost ffmpeg]# mkdir ffmpeg-release
[root@localhost ffmpeg]# cd ffmpeg
[root@localhost ffmpeg]# ./configure --enable-cross-compile --target-os=linux --cross-prefix=mipsel-linux- --cc=mipsel-linux-gcc --enable-shared --arch=mips --prefix=/opt/brcm/ffmpeg/ffmpeg-release
[root@localhost ffmpeg]# make
[root@localhost ffmpeg]# make install
[root@localhost ffmpeg]# cd ../ffmpeg-release
[root@localhost ffmpeg-release]# tar -zcvf ffjpeg_lib.tar.gz ./lib
板子上运行:
# cp ffjpeg_lib.tar.gz /usr/local/lib/
# cd /usr/local/lib/
# tar -zxvf ffjpeg_lib.tar.gz -C ../
# rm ffjpeg_lib.tar.gz
# cp ffmpeg-release/bin/* /bin/
# ffmpeg
FFmpeg version SVN-r21694, Copyright (c) 2000-2010 Fabrice Bellard, et al.
built on Nov 17 2012 02:25:17 with gcc 4.5.3
configuration: --enable-cross-compile --target-os=linux --cross-prefix=mipsel-linux- --cc=mipsel-linux-gcc --enable-shared --arch=mips --prefix=/opt/brcm/ffmpeg/ffmpeg-release
libavutil 50. 9. 0 / 50. 9. 0
libavcodec 52.52. 0 / 52.52. 0
libavformat 52.51. 0 / 52.51. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.10. 0 / 0.10. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
#
到现在为止, 我们就成功的将 ffmpeg 移植到我们的开发板上了。
二.Linux下使用ffmpeg库:
1.命令行使用:ffmpeg -i test.mp4 -y -f image2 -ss 30 -s 95*95 -vframes 1 a.jpg
找一个MP4文件:test.mp4,然后使用上面的命令就可以取得30秒时视频的图像,保存为
95*95像素的JPG文件。
ffmpeg -i 000094.mp4 -vframes 30 -pix_fmt rgb24 -y -f gif a.gif
把前30帧转化为GIF文件。
2.在程序中调用函数截获视频图片:
首先加入库支持,在我们的可执行程序的Makefile文件中,加入:
CFLAGS += -I/opt/brcm/ffmpeg/ffmpeg-release/include/
LFLAGS += -L/opt/brcm/ffmpeg/ffmpeg-release/lib/ -lavutil -lavformat -lavcodec -lswscale
(记住,后面最后四个参数缺一不可,否则编译不通过)
然后关于在编程中使用FFMPEG库的方法,附带一个成熟的Demo。
(test_snap.c和Makefile)
附带几个我自己看过的网站:
http://ray.imiddle.net/2008/10/ffmpeg-install-and-usage/
/article/7945679.html
http://bbs.chinaunix.net/thread-1932536-1-1.html
相关文章推荐
- Linux下MIPS平台交叉编译FFMpeg库 及使用库截取视频中的某一帧
- Linux下MIPS平台交叉编译FFMpeg库 及使用库截取视频中的某一帧
- [转载] 在Linux下用buildroot搭建mips/arm的交叉编译平台
- 在Linux平台上使用Cmake进行交叉编译替代嵌入式平台所使用的Makefile
- iOS开发 Mac 平台 一步编译 使用 ffmpeg库 ios8 arm64 都可以
- linux下交叉编译arm平台二进制elf文件
- Android 运行 C/C++程序 (使用 arm-linux-gcc 交叉编译环境)
- Ubuntu安装mips平台交叉编译环境
- 如何交叉编译Python到ARM-Linux平台
- iperf for Linux 在TOP6410上的交叉编译和使用
- QT环境搭建: QT玩转在linux的x86平台或者ARM平台上 - (2)交叉编译移植到ARM下
- linux 7z命令安装使用及其交叉编译移植到arm linux平台
- Windows平台交叉编译Arm Linux平台的QT5.7库
- linux中使用NDK编译ffmpeg的android平台的可执行文件
- mips-linux-gcc交叉编译工具链搭建小结【转】
- Linux系统平台下关于GCC编译及使用的方法
- linux平台上搭建交叉编译环境
- 使用uclibc的buildroot制作交叉编译工具链 ,arm-linux-gcc
- 视频编解码之windows平台下编译ffmpeg的方法和使用教程
- OneNET视频推流------使用树莓派交叉编译工具