将连续的 RTSP 流保存为 5-10 分钟长的 mp4 文件 [英] Save continuous RTSP stream to 5-10 minute long mp4 files

查看:50
本文介绍了将连续的 RTSP 流保存为 5-10 分钟长的 mp4 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将流(协议 rtsp、编解码器 h264)保存在文件(容器 mp4)中?即在输入源源不断的视频流(用闭路电视摄像头)时,输出的mp4格式文件大小为5-10分钟的录音时间.

How can I keep the flow (protocol rtsp, codec h264) in file (container mp4)? That is, on inputting an endless stream (with CCTV camera), and the output files in mp4 format size of 5-10 minutes of recording time.

操作系统:debian、ubuntu软件:vlc、ffmpeg(avconv)

OS: debian, ubuntu Software: vlc, ffmpeg (avconv)

目前使用这个方案:

cvlc rtsp://admin:admin@10.1.1.1:554/ch1-s1 --sout=file/ts:stream.ts
ffmpeg -i stream.ts -vcodec copy -f mp4 stream.mp4

但是它不能连续录制视频(两次重启之间 vlc 丢失了大约 10 秒的实时视频).

But it can not record video continuously (between restarts vlc loses about 10 seconds of live video).

推荐答案

这个问题 并回答服务器故障.简而言之,切换工具.avconv 会做你想做的.(ffmpeg 变成了 avconv.)

See this question and answer on Server Fault. In short, switch tools. avconv will do what you want. (ffmpeg has become avconv.)

您正在寻找的特征称为分段.您的命令行看起来像这样:

The feature you are looking for is called segmentation. Your command line would look something like this:

avconv -i rtsp://10.2.2.19/live/ch01_0 -c copy -map 0 -f segment -segment_time 300 -segment_format mp4 "capture-%03d.mp4"

这篇关于将连续的 RTSP 流保存为 5-10 分钟长的 mp4 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆