8

ffmpeg 分段保存 rtsp 视频数据流

 1 year ago
source link: https://maxqiu.com/article/detail/141
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

ffmpeg 分段保存 rtsp 视频数据流

麦克斯仇 Think different
ffmpeg 分段保存 rtsp 视频数据流

2022/06/12  Linux  ffmpeg

ffmpeg 5.0.1 为例

详细文档见官网:https://ffmpeg.org/ffmpeg-all.html

  1. ffmpeg -use_wallclock_as_timestamps 1 -rtsp_transport tcp -i rtsp://[username]:[password]@[ip]:[port] -vcodec copy -acodec copy -f segment -reset_timestamps 1 -segment_atclocktime 1 -segment_time 60 -strftime 1 /outdir/%Y%m%d%H%M.mp4
  1. ffmpeg [全局设置] {[输入设置] -i 输入路径} ... {[输出设置] output_url} ...

部分参数介绍

参数 可选值 说明
-use_wallclock_as_timestamps 0
1
如果设置为1,则使用系统时间作为时间戳。
默认值为0。
-rtsp_transport udp
tcp
udp_multicast
http
设置 rtsp 传输协议
可以指定多个较低的传输协议,在这种情况下,它们一次尝试一个(如果一个设置失败,则尝试下一个)。
默认值为 udp
-vcodec 设置视频编解码, copy 代表使用输入源的格式
-acodec 设置音频编解码, copy 代表使用输入源的格式
-f 强制输入或输出文件格式。 segment 代表分段
-reset_timestamps 0
1
在每个段的开头重置时间戳,这样每个段将以接近零的时间戳开始。
默认为0。
-segment_atclocktime 0
1
如果设置为“1”,则按从00:00开始的定时时钟间隔分割。
segment_time 中指定的时间值用于设置每段的长度
-segment_time 每段时间的时长,单位:秒
-strftime 0
1
使用 strftime 函数定义要写入的文件的名称。
如果选择此选项,输出段名称必须包含一个strftime函数模板。
默认值为0。
你的随机昵称:母夜叉-孙二娘

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK