OKMX6Q ffmpeg & ffserver

通过ltib在根文件系统中增加mplayer和ffmpeg后,拟使用ffmpeg从摄像头(/dev/video0)采集视频。
刚开始使用了:

ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 test.avi

但是出现了错误:

Wrong time base (0)

后来根据网页
https://www.linuxquestions.org/questions/linux-hardware-18/v4l-v4l2-setup-for-ffmpeg-533603/的建议,改成了:
ffmpeg -f video4linux2 -s 320x240 -r 60000/1001 -i /dev/video0 test.avi
之后就能采集了,根据ffmpeg的man page得知-r参数的含义是:

-r rate             set frame rate (Hz value, fraction or abbreviation)

因为ffserver在执行时会出现

bind(port 8090): Address family not supported by protocol

查了一下,是我所使用的ffmpeg版本bug
解决方式是
https://bugs.launchpad.net/ubuntu/+source/libav/+bug/879018
要特别注意,ltib在生成可执行文件过程中是通过litb编译时的rpm包生成的,所以为了使我们的修改生效,需要我们自行编译生成ffserver可执行文件。通过测试,尽量不要通过rpmbuild -bb ffmpeg.spec的方式,因为这个脚本应该是依赖于某个其他文件,如果通过rpmbuild编译,将生成错误的可执行文件。我们找到/opt/freescale/pkgs/ffmpeg-20080916.tar.bz2解压后手动编译,configure命令参考ffmpeg.spec文件,

./configure --cc=arm-linux-gcc --arch=arm --disable-altivec --disable-mmx --disable-mmx2 --enable-cross-compile --prefix=arm-linux-  

然后需要修改config.mak文件的STRIP=arm-linux-strip否则会出现下文错误:
出现如下错误,通常是因为makefile中的STRIP变量设置不对,应该改成arm-linux-strip

strip: Unable to recognise the format of the input file `ffmpeg'
posted @ 2018-01-12 12:33  可乐咸鱼  阅读(385)  评论(0编辑  收藏  举报