我们已经创建了从ffmpeg创建IP摄像机HLS视频的节点代码。
现在可以使用基于videojs的React-hls播放器在桌面浏览器和Android设备中工作
它在IOS上不起作用,我已附加了流的示例代码。
我还检查了flowplayer,它正在使用flowplayer样本hls视频在IOS上工作,但没有播放摄像机流。
这是Sample Video hls视频,正在运行IOS
我还附带了编解码器信息的屏幕截图或两个视频。
视频1:我们的摄像机流(不适用于IOS) 视频2:Flowplayer示例视频(不适用于IOS)
这是nodejs示例,用于使用FFMPEG从实时IP摄像机RTSP创建HLS流。
this.ffmpeg = child_process.spawn(`${process.cwd()}/ffmpeg/bin/ffmpeg.exe`,
[
"-fflags", "nobuffer",
"-i", url, "-y",
//"-vcodec", "libx264",
"-c:v", "h264",
"-preset:v", "ultrafast",
"-acodec", "aac",
"-ac", "1",
"-strict", "-2",
"-crf", "30",
"-profile:v", "baseline",
"-maxrate", "400k",
"-bufsize", "535k",
"-pix_fmt", "yuv420p",
"-r", "30",
"-flags", "-global_header",
"-hls_time", "10",
"-hls_list_size", "4",
//"-hls_wrap", "4",
"-hls_flags", "delete_segments+append_list+omit_endlist",
"-hls_base_url", "segment/",
"-start_number", "1",
"-s", (size || '568x320'),
`public/${this.camId}/out_${util.storeId}_${this.camId}_.m3u8`,
//"-vcodec", "libx264",
"-c:v", "h264",
"-preset:v", "ultrafast",
"-acodec", "aac",
"-ac", "1",
"-strict", "-2",
"-crf", "30",
"-profile:v", "baseline",
"-maxrate", "2996k",
"-bufsize", "4200k",
"-pix_fmt", "yuv420p",
"-r", "30",
"-flags", "-global_header",
"-hls_time", "10",
"-hls_list_size", "4",
//"-hls_wrap", "4",
"-hls_flags", "delete_segments+append_list+omit_endlist",
"-hls_base_url", "segment/",
"-start_number", "1",
"-s", (size || '1280x720'),
`public/${this.camId}/out_${util.storeId}_${this.camId}_720.m3u8`
], { detached: true });