将生成的ffmpeg库拷贝到mini2440上,我是用nfs的TCP(参数上加个-o -tcp就可以了,默认是UDP的会断)拷贝的,还好板子闪存够大,近30M东西啊(有空了看能不能精简下)!我是把lib目录下的库文件拷到了板子的默认lib下,所以也就省了export。当然还有ffmpeg程序,保持着nfs,用如下命令试下:#./ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 /mnt/test.avi
补充说明下,我用的是USB摄像头,mini2440支持,生成的是/dev/video0,nfs到主机的跟目录,所以/mnt/test.avi是在主机根目录下生成的。
直接在板子上也使用了(没用nfs连接),输出结果如下:
[root@FriendlyARM /]# ./ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 /test.avi
ffmpeg version 0.8.2.git, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 7 2011 18:15:56 with gcc 4.3.2
configuration: --cross-prefix=arm-linux- --enable-cross-compile --target-os=li
nux --cc=arm-linux-gcc --arch=arm --prefix=/usr/local/ffmpeg --enable-shared --d
isable-static --enable-gpl --enable-nonfree --enable-ffmpeg --disable-ffplay --e
nable-ffserver --enable-swscale --enable-pthreads --disable-armv5te --disable-ar
mv6 --disable-armv6t2 --disable-yasm --disable-stripping
libavutil 51. 16. 0 / 51. 16. 0
libavcodec 53. 13. 0 / 53. 13. 0
libavformat 53. 11. 0 / 53. 11. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 37. 0 / 2. 37. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[video4linux2 @ 0x2eae0] Estimating duration from bitrate, this may be inaccurat
e
Input #0, video4linux2, from '/dev/video0':
Duration: N/A, start: 1331454393.212519, bitrate: 4915 kb/s
Stream #0.0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 4915 kb/
s, 4 fps, 4 tbr, 1000k tbn, 4 tbc
Incompatible pixel format 'yuyv422' for codec 'mpeg4', auto-selecting format 'yu
v420p'
[buffer @ 0x314f0] w:320 h:240 pixfmt:yuyv422 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x2ffa0] auto-inserting filter 'auto-inserted scaler 0' between th
e filter 'src' and the filter 'out'
[scale @ 0x302d0] w:320 h:240 fmt:yuyv422 -> w:320 h:240 fmt:yuv420p flags:0x4
Output #0, avi, to '/test.avi':
Metadata:
ISFT : Lavf53.11.0
Stream #0.0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 320x240, q=2-31, 200
kb/s, 4 tbn, 4 tbc
Stream mapping:
Stream #0.0 -> #0.0 (rawvideo -> mpeg4)
Press [q] to stop, [?] for help
frame= 3 fps= 0 q=2.0 size= 13kB time=00:00:00.75 bitrate= 137.2kbits/s
frame= 5 fps= 3 q=2.0 size= 17kB time=00:00:01.50 bitrate= 91.5kbits/s
frame= 7 fps= 3 q=2.0 size= 21kB time=00:00:02.25 bitrate= 74.9kbits/s
frame= 9 fps= 3 q=2.0 size= 25kB time=00:00:02.75 bitrate= 74.0kbits/s
frame= 11 fps= 3 q=2.0 size= 29kB time=00:00:03.50 bitrate= 68.0kbits/s
frame= 13 fps= 3 q=1.6 size= 37kB time=00:00:04.00 bitrate= 75.2kbits/s
frame= 13 fps= 3 q=1.6 Lsize= 37kB time=00:00:04.00 bitrate= 75.8kbits/
s
video:31kB audio:0kB global headers:0kB muxing overhead 19.076962%
Received signal 2: terminating.
[root@FriendlyARM /]# ls
bin home mnt sbin udisk
dev lib opt sys usr
etc linuxrc proc test.avi var
ffmpeg lost+found root tmp www
可能有些摄像头不支持v4l2或者板子本身不支持造成无法使用,希望注意,找到解决方法的留言告知,十分感谢!
最后想说下的是,我下的ffmpeg中怎么没有网上说的Output_example.c等例程,希望知道的人告诉我一下,谢谢!有问题的请留言!
参考文章: