美文网首页
ffmpeg 测试部分命令说明

ffmpeg 测试部分命令说明

作者: 济夏 | 来源:发表于2019-01-23 15:08 被阅读4次

    视频转码

    ffmpeg -rtsp_transport  tcp -i "rtsp://admin:a1234567@192.168.2.239:554/cam/realmonitor?channel=1&subtype=1" -vcodec libx264 -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1 -f flv "rtmp://192.168.2.251:1935/rtmp-live/239"

    ffmpeg -rtsp_transport  tcp -i "rtsp://admin:a1234567@192.168.2.240:554/cam/realmonitor?channel=1&subtype=1" -vcodec libx264 -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1 -f flv "rtmp://192.168.2.251:1935/rtmp-live/240"

    ffmpeg -rtsp_transport  tcp -i "rtsp://admin:a1234567@192.168.2.223:554/cam/realmonitor?channel=1&subtype=1" -vcodec libx264 -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1 -f flv "rtmp://192.168.2.251:1935/rtmp-live/223"

    ---------------------------------------------------------------------------------------------------------------------------

    frame: 编码的帧数量

    fps:每秒编码的帧数

    q:质量因子

    size/ Lsize:视频和音频编码后的大小,即基本等于视频和音频 之和

    time:输出帧的显示时间

    bitrate:输出视频的帧率

    dup:输入帧重复(dupliate)的数量

    drop:输入帧丢弃(drop)的个数

    speed:编码速度

    ---------------------------------------------------------------------------------------------------------------------------

    视频录制

    ffmpeg -rtsp_transport  tcp -i "rtsp://admin:a1234567@192.168.2.240:554/cam/realmonitor?channel=1&subtype=1"–vcodec copy out.avi

    ---------------------------------------------------------------------------------------------------------------------------

    视频剪切

    ffmpeg -rtsp_transport  tcp -ss 0:0 -t 0:10 -i "rtsp://admin:a1234567@192.168.2.240:554/cam/realmonitor?channel=1&subtype=1" output.mp4

    ---------------------------------------------------------------------------------------------------------------------------

    RTMP

    ————————————————————————————————————————————————————————

    ffmpeg -re -i keep.mp4  -acodec aac -ar 44100  -strict -2 -ac 1 -f flv rtmp://192.168.2.251:1935/hls/keep

    ffmpeg -rtsp_transport tcp -i "rtsp://admin:a1234567@192.168.2.239:554/cam/realmonitor?channel=1&subtype=1"  -ar 44100 -ac 1 -f flv "rtmp://192.168.2.251:1935/hls/itc"

    ————————————————————————————————————————————————————————

    HLS

    ————————————————————————————————————————————————————————

    ffmpeg  -i "rtsp://admin:a1234567@192.168.2.128:554/cam/realmonitor?channel=1&subtype=1"  -vcodec copy -acodec copy  -vbsf h264_mp4toannexb  -f hls -hls_time 2 -hls_wrap 10 "D:\xampp\htdocs\hb.m3u8"

    ————————————————————————————————————————————————————————

    FFMPEG 常见命令和参数说明

    ——————————————————

    -rtsp_transport  tcp 强制使用TCP采集rtsp

    -i 输入文件

    -vcodec 视频编解码格式

    -vprofile H.264有四种画质级别,分别是baseline, extended, main, high:

    1、Baseline Profile:基本画质。支持I/P 帧,只支持无交错(Progressive)和CAVLC;

    2、Extended profile:进阶画质。支持I/P/B/SP/SI 帧,只支持无交错(Progressive)和CAVLC;(用的少)

    3、Main profile:主流画质。提供I/P/B 帧,支持无交错(Progressive)和交错(Interlaced), 也支持CAVLC 和CABAC 的支持;

    4、High profile:高级画质。在main Profile 的基础上增加了8x8内部预测、自定义量化、 无损视频编码和更多的YUV 格式;

    H.264 Baseline profile、Extended profile和Main profile都是针对8位样本数据、4:2:0格式(YUV)的视频序列。

    在相同配置情况下,High profile(HP)可以比Main profile(MP)降低10%的码率。 根据应用领域的不同,Baseline profile多应用于实时通信领域,Main profile多应用于流媒体领域,High profile则多应用于广电和存储领域。

    -acodec 音频编码格式,未设定则和输入相同

    -f 设定输出格式

    -ar 设定采样频率

    -ac 设定声音的channel数

    -an 不处理音频

    -t 时间

    -f 输出格式及路径

    -b 比特率,每秒的比特数

    -s size,分辨率

    -r 帧率,每秒显示多少帧图片

    相关文章

      网友评论

          本文标题:ffmpeg 测试部分命令说明

          本文链接:https://www.haomeiwen.com/subject/fdojjqtx.html