Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4236340
  • 博文数量: 1148
  • 博客积分: 25453
  • 博客等级: 上将
  • 技术积分: 11949
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 21:14
文章分类

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: 嵌入式

2011-04-12 10:03:56

参考:
http://hi.baidu.com/zhxust/blog/item/c7b4110077d5cf1b728b6583.html
http://blog.csdn.net/lxzhg/archive/2010/09/01/5854954.aspx
<嵌入式linux程序设计案例与实验教程>


1.下载ffmpeg 源码  我下载的是:ffmpeg-0.6.90-cr0
     

2.解压

3. 执行命令

   --prefix=./_install/ ,将生产的文件放置到当前目录的_install下
  1. 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.转换文件格式 过程

  1. [root@yuweixian yu]# ffmpeg -i testbiejing.avi testbiejing.wav
  2. FFmpeg version 0.6.90-rc0, Copyright (c) 2000-2011 the FFmpeg developers
  3.   built on Apr 10 2011 22:35:24 with gcc 4.5.1
  4.   configuration: --prefix=./_install/ --enable-shared --disable-static --enable-gpl --cross-prefix=arm-linux- --enable-cross-compile --arch=arm --disable-stripping --target-os=linux
  5.   libavutil 50. 40. 0 / 50. 40. 0
  6.   libavcodec 52.117. 0 / 52.117. 0
  7.   libavformat 52.104. 0 / 52.104. 0
  8.   libavdevice 52. 4. 0 / 52. 4. 0
  9.   libavfilter 1. 76. 0 / 1. 76. 0
  10.   libswscale 0. 13. 0 / 0. 13. 0
  11. Input #0, avi, from 'testbiejing.avi':
  12.   Metadata:
  13.     encoder : Lavf52.20.0
  14.   Duration: 00:03:10.33, start: 0.000000, bitrate: 281 kb/s
  15.     Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 15 tbr, 15 tbn, 15 tbc
  16.     Stream #0.1: Audio: mp2, 44100 Hz, stereo, s16, 64 kb/s
  17. Output #0, wav, to 'testbiejing.wav':
  18.   Metadata:
  19.     encoder : Lavf52.104.0
  20.     Stream #0.0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
  21. Stream mapping:
  22.   Stream #0.1 -> #0.0
  23. Press [q] to stop encoding
  24. size= 32774kB time=190.25 bitrate=1411.2kbits/s
  25. video:0kB audio:32774kB global headers:0kB muxing overhead 0.000131%
  26. [root@yuweixian yu]#


注意这里:video:0KB 输出,表示没有视频输出   是 wav 格式,音频格式

转换结束
**************************************************


 

*************************************************************************
9.执行截图功能测试

命令执行
  1. [root@yuweixian yu]# ffmpeg -i testbiejing.avi -f image2 -ss 12 -t 0.001 test.jpg


  2. FFmpeg version 0.6.90-rc0, Copyright (c) 2000-2011 the FFmpeg developers
  3.   built on Apr 10 2011 22:35:24 with gcc 4.5.1
  4.   configuration: --prefix=./_install/ --enable-shared --disable-static --enable-gpl --cross-prefix=arm-linux- --enable-cross-compile --arch=arm --disable-stripping --target-os=linux
  5.   libavutil 50. 40. 0 / 50. 40. 0
  6.   libavcodec 52.117. 0 / 52.117. 0
  7.   libavformat 52.104. 0 / 52.104. 0
  8.   libavdevice 52. 4. 0 / 52. 4. 0
  9.   libavfilter 1. 76. 0 / 1. 76. 0
  10.   libswscale 0. 13. 0 / 0. 13. 0
  11. Input #0, avi, from 'testbiejing.avi':
  12.   Metadata:
  13.     encoder : Lavf52.20.0
  14.   Duration: 00:03:10.33, start: 0.000000, bitrate: 281 kb/s
  15.     Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 15 tbr, 15 tbn, 15 tbc
  16.     Stream #0.1: Audio: mp2, 44100 Hz, stereo, s16, 64 kb/s
  17. Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p'
  18. [buffer @ 0x3ad60] w:320 h:240 pixfmt:yuv420p
  19. [ffsink @ 0x3b9d0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
  20. [scale @ 0x3bd60] w:320 h:240 fmt:yuv420p -> w:320 h:240 fmt:yuvj420p flags:0x4
  21. Output #0, image2, to 'test.jpg':
  22.   Metadata:
  23.     encoder : Lavf52.104.0
  24.     Stream #0.0: Video: mjpeg, yuvj420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 15 tbc
  25. Stream mapping:
  26.   Stream #0.0 -> #0.0
  27. Press [q] to stop encoding
  28. [buffer @ 0x3ad60] Buffering several frames is not supported. Please consume all available frames before adding a new one.
  29.     Last message repeated 179 times -0kB time=0.07 bitrate= -2.6kbits/s bits/s
  30. frame= 1 fps= 0 q=5.4 Lsize= -0kB time=0.07 bitrate= -2.6kbits/s
  31. video:13kB audio:0kB global headers:0kB muxing overhead -100.168984%
  32. [root@yuweixian yu]# ls
  33. 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





阅读(1836) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~