首页 > 解决方案 > ffmpeg hls 段在 5300 段后停止分段

问题描述

我正在尝试使用 hls、ffmpeg 和 raspivid 制作 http 视频流,我需要 1 天的重播时间,但在 5300 段 ffmpeg 停止分段并继续将视频写入 5301 段以结束一天(5300/ 5301是一个平均数,+- 50段)我有足够的存储空间,我的相机可以记录一整天。唯一的问题是 ffmpeg 决定在 5300 段之后停止分段

谢谢你,对不起我的英语不好^^

这是我的流媒体脚本:


base="/var/www/html/"

set -x

rm -rf /var/www/html/ppc/saves/live live.h264
mkdir -p /var/www/html/ppc/saves/live

# fifos seem to work more reliably than pipes - and the fact that the
# fifo can be named helps ffmpeg guess the format correctly.
mkfifo live.h264
raspivid -a 1036 -w 1640 -h 1232 -fps 15 -t 37200000 -b 1500000 -o - | psips > live.h264 &

# Letting the buffer fill a little seems to help ffmpeg to id the stream
sleep 2

# Need ffmpeg around 1.0.5 or later. The stock Debian ffmpeg won't work.
# I'm not aware of options apart from building it from source. I have
# Raspbian packags built from Debian Multimedia sources. Available on
# request but I don't want to post them publicly because I haven't cross
# compiled all of Debian Multimedia and conflicts can occur.
ffmpeg -y -r 15 -i live.h264 -f alsa  -i default:CARD=C525 -r:a 48000 -ac 1 -af adelay=32s -c:v copy -c:a aac -b:a 128k -map 0:0 -map 1:0 -r 30 \
 -f segment \
 -segment_time 7 \
 -segment_format mpegts \
 -segment_list /var/www/html/ppc/saves/live/live.m3u8 \
 -segment_list_flags live \
 -segment_list_type m3u8 \
 -initial_offset -9 \
 -strict 2 /var/www/html/ppc/saves/live/%08d.ts < /dev/null```

标签: pythonffmpeghttp-live-streaming

解决方案


推荐阅读