ffmpeg直播源录制脚本

2024-02-18 20:04

自用的,录制m3u8直播地址,到本地mp4的脚本


#!/bin/bash
url=http://1.m3u8

size="30M"
while :
do
dirname=`date "+%Y%m%d"`
filename=`date "+%H%M%S.mp4"`
echo 'write in to $dirname'
if [ ! -d $dirname ]; then
mkdir $dirname
fi
ffmpeg -i $url -fs ${size} -vcodec copy -an ${dirname}/${filename}
echo 'write end'
if [[ $filename > "1730" ]]; then
break
fi
done

# 工具配置