ffmpeg工具使用笔记
播放RTSP
ffplay.exe -fflags nobuffer -analyzeduration 100000 -i rtsp://xxx
推送视频流(mpegts封装 UDP推送)
ffmpeg -f lavfi -re -i smptebars=duration=300:size=1280x720:rate=30 -f lavfi -re -i sine=frequency=1000:duration=60:sample_rate=44100 -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 -profile:v baseline -preset veryfast -f mpegts "udp://127.0.0.1:1234?pkt_size=1316"
搭建RTSP SERVER
#服务器参数设置 RTSPPort 8080 RTSPBindAddress 0.0.0.0 HTTPPPort 8080 HTTPBindAddress 0.0.0.0 MaxClients 1000 MaxBandwidth 100000 CustomLog – #源设置 <Feed feed1.ffm> File /tmp/feed1.ffm FileMaxSize 40K #从硬件设备加载流 Launch ./ffmpeg -i /dev/video0 -an ACL allow localhost </Feed> #流设置 <Stream out.mp4> Format rtp NoAudio Feed feed1.ffm VideoCodec libx264 VideoSize 480*272 </Stream>
开启SERVER
ffserver –f ffserver.con
编译
1, X264
源码 https://github.com/mirror/x264.git
./configure --cross-prefix=/opt/hi3559a/aarch64-himix100-linux/bin/aarch64-himix100-linux- --prefix=/opt/hi3559a/aarch64-himix100-linux/ --enable-static --host=arm-linux --disable-asm
make
2,FFMPEG
https://ffmpeg.org/releases/ffmpeg-4.2.1.tar.bz2
./configure --cc=/opt/hi3559a/aarch64-himix100-linux/bin/aarch64-himix100-linux-gcc --enable-libx264 --enable-static --disable-asm --enable-gpl --enable-cross-compile --disable-stripping --extra-cflags="-DHAVE_STRUCT_IP_MREQ_SOURCE=0"