参考:
http://hi.baidu.com/zhxust/blog/item/c7b4110077d5cf1b728b6583.htmlhttp://blog.csdn.net/lxzhg/archive/2010/09/01/5854954.aspx<嵌入式linux程序设计案例与实验教程>
1.下载ffmpeg 源码 我下载的是:ffmpeg-0.6.90-cr0
2.解压
3. 执行命令
--prefix=./_install/ ,将生产的文件放置到当前目录的_install下
- root@yuweixian:/home/ywx/yu/src/ffmpeg-0.6.90-rc0# ./configure --prefix=./_install/ --enable-shared --disable-static --enable-gpl --cross-prefix=arm-linux- --enable-cross-compile --arch=arm --disable-stripping --target-os=linux
4.执行make ; make install
5.在/ffmpeg-0.6.90-rc0生成 _install 在 _install有目录
bin include lib share
/bin/ffmpeg ffprobe ffserver lib/ 是一些生成的动态链接库 .so
6.挂载 nfs 到 开发板上
7.将 生成的ffmpeg 复制到 文件系统 /sbin/
注意:不能再 /nfs../挂载的目录下,提示 只读文件系统的
testbiejing.wav: Read-only file system #这里失败,需要在arm目录中,
不能再挂载的nfs 下执行
8.在开发板上:cd /home/yu/,执行视频转换
1.转换视频格式
ffmpeg -i test.avi test.wav
2.这里会提示缺少动态链接库,我们将nfs/../lib/ 提到的.so文件复制到 开发板文件系统系统/lib/下,就可以了,一共8个链接库
libavfilter.so.1 libswscale.so.0
libavcodec.so.52 libavformat.so.52
libavdevice.so.52 libavutil.so.50
libavfilter.so libswscale.so
3.转换文件格式 过程
- [root@yuweixian yu]# ffmpeg -i testbiejing.avi testbiejing.wav
-
FFmpeg version 0.6.90-rc0, Copyright (c) 2000-2011 the FFmpeg developers
-
built on Apr 10 2011 22:35:24 with gcc 4.5.1
-
configuration: --prefix=./_install/ --enable-shared --disable-static --enable-gpl --cross-prefix=arm-linux- --enable-cross-compile --arch=arm --disable-stripping --target-os=linux
-
libavutil 50. 40. 0 / 50. 40. 0
-
libavcodec 52.117. 0 / 52.117. 0
-
libavformat 52.104. 0 / 52.104. 0
-
libavdevice 52. 4. 0 / 52. 4. 0
-
libavfilter 1. 76. 0 / 1. 76. 0
-
libswscale 0. 13. 0 / 0. 13. 0
-
Input #0, avi, from 'testbiejing.avi':
-
Metadata:
-
encoder : Lavf52.20.0
-
Duration: 00:03:10.33, start: 0.000000, bitrate: 281 kb/s
-
Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 15 tbr, 15 tbn, 15 tbc
-
Stream #0.1: Audio: mp2, 44100 Hz, stereo, s16, 64 kb/s
-
Output #0, wav, to 'testbiejing.wav':
-
Metadata:
-
encoder : Lavf52.104.0
-
Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
-
Stream mapping:
-
Stream #0.1 -> #0.0
-
Press [q] to stop encoding
-
size= 32774kB time=190.25 bitrate=1411.2kbits/s
-
video:0kB audio:32774kB global headers:0kB muxing overhead 0.000131%
-
[root@yuweixian yu]#
注意这里:video:0KB 输出,表示没有视频输出 是 wav 格式,音频格式
转换结束
**************************************************
*************************************************************************
9.执行截图功能测试
命令执行
- [root@yuweixian yu]# ffmpeg -i testbiejing.avi -f image2 -ss 12 -t 0.001 test.jpg
-
-
-
FFmpeg version 0.6.90-rc0, Copyright (c) 2000-2011 the FFmpeg developers
-
built on Apr 10 2011 22:35:24 with gcc 4.5.1
-
configuration: --prefix=./_install/ --enable-shared --disable-static --enable-gpl --cross-prefix=arm-linux- --enable-cross-compile --arch=arm --disable-stripping --target-os=linux
-
libavutil 50. 40. 0 / 50. 40. 0
-
libavcodec 52.117. 0 / 52.117. 0
-
libavformat 52.104. 0 / 52.104. 0
-
libavdevice 52. 4. 0 / 52. 4. 0
-
libavfilter 1. 76. 0 / 1. 76. 0
-
libswscale 0. 13. 0 / 0. 13. 0
-
Input #0, avi, from 'testbiejing.avi':
-
Metadata:
-
encoder : Lavf52.20.0
-
Duration: 00:03:10.33, start: 0.000000, bitrate: 281 kb/s
-
Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 15 tbr, 15 tbn, 15 tbc
-
Stream #0.1: Audio: mp2, 44100 Hz, stereo, s16, 64 kb/s
-
Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p'
-
[buffer @ 0x3ad60] w:320 h:240 pixfmt:yuv420p
-
[ffsink @ 0x3b9d0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
-
[scale @ 0x3bd60] w:320 h:240 fmt:yuv420p -> w:320 h:240 fmt:yuvj420p flags:0x4
-
Output #0, image2, to 'test.jpg':
-
Metadata:
-
encoder : Lavf52.104.0
-
Stream #0.0: Video: mjpeg, yuvj420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 15 tbc
-
Stream mapping:
-
Stream #0.0 -> #0.0
-
Press [q] to stop encoding
-
[buffer @ 0x3ad60] Buffering several frames is not supported. Please consume all available frames before adding a new one.
-
Last message repeated 179 times -0kB time=0.07 bitrate= -2.6kbits/s bits/s
-
frame= 1 fps= 0 q=5.4 Lsize= -0kB time=0.07 bitrate= -2.6kbits/s
-
video:13kB audio:0kB global headers:0kB muxing overhead -100.168984%
-
[root@yuweixian yu]# ls
-
test.jpg testbiejing.avi
[root@yuweixian yu]# cp test.jpg /mnt/nfs/
cp: can't create '/mnt/nfs/test.jpg': Read-only file system
#########这里不能复制 文件到nfs 挂载目录下,
通过 sz gz 串口 复制到 xp 系统下
[root@yuweixian yu]# sz test.jpg
rz
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring test.jpg...
100% 12 KB 12 KB/s 00:00:01 0 Errors
奜Osz 3.48 01-27-98 finished.
显示图像test.jpg
320*240
阅读(1886) | 评论(0) | 转发(0) |