ffmpeg定时存储华为摄像头视频流

1、正常MP4
sudo ffmpeg -i "rtsp://..." -c copy -f segment -strftime 1 -segment_time 20 %Y/%m/%d/%H-%M-%S.mp4

Could not find tag for codec pcm_mulaw in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

问题:
https://stackoverflow.com/questions/47495713/could-not-find-tag-for-codec-pcm-alaw-in-stream-1-codec-not-currently-supporte
2、改为存储mkv
sudo ffmpeg -i "rtsp://..." -c copy -f segment -strftime 1 -segment_time 20 %Y/%m/%d/%H-%M-%S.mkv
出现视频时间累加问题:
https://stackoverflow.com/questions/58909322/ffmpeg-copy-live-stream-limit-to-60s-file

解决参考:https://ffmpeg.org/ffmpeg-formats.html

image.png

sudo ffmpeg -i "rtsp://..." -c copy -f segment -reset_timestamps 1 -strftime 1 -segment_time 20 %Y/%m/%d/%H-%M-%S.mkv

你可能感兴趣的:(ffmpeg定时存储华为摄像头视频流)