我这样做的过程在零上配置lib和ffmpeg文件,然后移到pi 3进行制作和安装(为了速度)。
构建过程:
# x264
git clone git://git.videolan.org/x264.git
cd x264
sudo ./configure --host=arm-unknown-linux-gnueabi --enable-shared --disable-opencl
sudo make
sudo make install
sudo ldconfig
# FFMPEG
git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree
sudo make
sudo make install
我尝试了这个cross compile type build,但抱怨我错过了一个C编译器,但是安装了GCC。所以我只是按照我之前的方法。
尝试运行它的结果:
pi@raspberrypi:~ $ ffmpeg -f v4l2 -i /dev/video0 -c:v libx264 -preset ultrafast -crf 0 http://localhost:8090/feed1.ffm
ffmpeg version N-85747-gc4be288 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.2 (Raspbian 4.9.2-10)
configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree
libavutil 55. 61.100 / 55. 61.100
libavcodec 57. 93.100 / 57. 93.100
libavformat 57. 72.101 / 57. 72.101
libavdevice 57. 7.100 / 57. 7.100
libavfilter 6. 88.100 / 6. 88.100
libswscale 4. 7.101 / 4. 7.101
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 682.500534, bitrate: 110592 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x360, 110592 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
[tcp @ 0x2cba570] Connection to tcp://localhost:8090 failed (Connection refused), trying next address
Wed May 3 12:30:16 2017 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
[tcp @ 0x2cbf1b0] Connection to tcp://localhost:8090 failed (Connection refused), trying next address
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
Wed May 3 12:30:16 2017 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 0
Illegal instruction