1 ffmpeg 推流
1.1 rtsp 推流
::-re 为以流的方式读取;
::-stream_loop 为循环读取视频源的次数,-1为无限循环;
::-i 为输入的文件;
::-vcodec:视频选项,一般后面加copy表示拷贝
:: -an: 去掉音频
::-f 为格式化输出到哪里;
1 默认 UDP推流
ffmpeg -re -i output.h265 -vcodec copy -an -f rtsp rstp:<src_rtsp_ipaddr>:<src_rtsp_port>/live.stream
2 TCP推流
ffmpeg -re -i output.h265 -vcodec copy -rtsp_transport tcp -an -f rtsp rstp:<src_rtsp_ipaddr>:<src_rtsp_port>/live.stream
3 循环推流
ffmpeg -re -stream_loop -1 -i input.mp4 -vcodec copy -an -f rtsp rstp:<src_rtsp_ipaddr>:<src_rtsp_port>/live.stream
1.2 rtp 推流
rtp 推流,默认以UDP方式推流
adb shell "ffmpeg -re -i output.h265 -vcodec copy -an -f rtp rtp:<src_rtp_ipaddr>:<src_rtp_port>
2 将 MP4 转化为 H265裸流
1 将 MP4 转换为 H265
ffmpeg.exe -i input.mp4 -c:v libx265 -r 30 -s 1920x1080 output_low_1920_1080.h265
2 将 MP4 转换为 H265 质量更高
:: -c codec codec name
:: -b bitrate video bitrate (please use -b:v)
:: -r rate set frame rate
:: -s size set frame size (WxH or abbreviation)
:: -b bitrate video bitrate (please use -b:v)
:: -pre preset preset name
ffmpeg -i input.mp4 -c:v libx265 -preset slower -b:v 6M -r 30 -s 480x872 output_high.h265
3 将 h265 H264 文件 转化成MP4
:: ::-vcodec:视频选项,一般后面加copy表示拷贝
:: #ffmpeg -i input.h264 -vcodec copy -f mp4 output.mp4