https://blog.csdn.net/fantasy_ARM9/article/details/79648837
在我之前实现的基础上改造,之前只是录制到目录下。
本次支持的功能有通过query_video接口实现查询一段时间的录像,并
生成新的m3u8文件,并返回url。
例如
curl "http://127.0.0.1/query_video?streamid=fan&starttime=20201227150222&endtime=2020122715055" "
response:
{
"code" : 0,
"data" :
{
"fan" : "http://127.0.0.1/hls/fan/fan_20201227150222_20201227150553.m3u8"
},
"msg" : "success"
}
curl http://127.0.0.1/hls/fan/fan_20201227150222_20201227150553.m3u8
response:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:00010
#EXT_X_TOTAL_DURATION:00999.000
#EXTINF: 2
20201227/20201227150202/fan-20201227150222-2.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150232-3.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150242-4.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150252-5.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150302-6.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150312-7.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150322-8.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150332-9.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150343-10.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150352-11.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150403-12.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150412-13.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150423-14.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150432-15.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150443-16.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150452-17.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150502-18.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150513-19.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150522-20.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150533-21.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150542-22.ts
#EXTINF: 2
20201227/20201227150202/fan-20201227150553-23.ts
#EXT-X-ENDLIST
也可以支持指定格式输出mp4文件,
curl "http://127.0.0.1/query_video?streamid=fan&starttime=20201227150222&endtime=20201227150553&format=mp4"
response
{
"code" : 0,
"data" :
{
"fan" : "http://127.0.0.1/fan_20201227150222_20201227150553.mp4"
},
"msg" : "success"
}