amazon-web-services - 使用 FFmpeg 从受保护的 m3u8 直播流中获取屏幕截图
问题描述
我正在尝试从本地付费电话获取屏幕截图,以便使用图像识别来了解它的拥挤程度。每次从 AWS Lambda 运行命令时,我都尝试使用 ffmpeg 提取屏幕截图。我的问题是我无法从 m3u8 文件中提取任何类型的图像。
http://roads.mk/315/video-kameri
当我打开其中一个摄像头时,直播流正常显示,但是当我右键单击复制地址时,我得到一个 blob 链接
斑点:http ://roads.mk/cb301be0-3e70-4d09-af2b-3f3d44ee8f4f
幸运的是,在该网站的移动版本上,一旦单击链接,它就会立即下载 m3u8 文件。一旦使用命令放入 ffmpeg
ffmpeg -i "gradsko_1.m3u8" -vf fps=1/3600 grad%04d.jpg
我得到回应
[hls @ 000000ce3d26d700] Skip ('#EXT-X-VERSION:3')
[hls @ 000000ce3d26d700] Opening 'gradsko_1-586008.ts' for reading
[hls @ 000000ce3d26d700] Failed to open segment 586008 of playlist 0
[hls @ 000000ce3d26d700] Opening 'gradsko_1-586009.ts' for reading
[hls @ 000000ce3d26d700] Failed to open segment 586009 of playlist 0
[hls @ 000000ce3d26d700] Opening 'gradsko_1-586010.ts' for reading
[hls @ 000000ce3d26d700] Failed to open segment 586010 of playlist 0
[hls @ 000000ce3d26d700] Skip ('#EXT-X-VERSION:3')
Last message repeated 3 times
[hls @ 000000ce3d26d700] Error when loading first segment 'gradsko_1-585991.ts'
gradsko_1.m3u8: Immediate exit requested
Exiting normally, received signal 2.```
From what I could tell, the stream seems to be protected.
Any way to get inside this? I would only need a single screenshot with no audio since the program would run once an hour/on command for a very general estimate. I'm just starting out with ffmpeg so any tips would be greatly appreciated.
解决方案
这对我有用:ffmpeg -i http://streaming1.neotel.net.mk:8080/hls/romanovce_3.m3u8 -vframes 1 -q:v 2 output.jpg
仅供参考:如果您首先将播放列表 (m3u8) 下载到本地驱动器,然后尝试使用它 - 您会遇到两个问题。
- 播放列表中的 URL 现在无效,因为它们是相对于服务器的。
- 播放列表相对很快就过时了,因为它是实时的,并且服务器只保留了几个片段。
推荐阅读
- spring-integration - 如何从上传文件到 sftp 获得响应?
- javascript - 如何在 puppeteer 上拦截下载请求并读取被拦截的文件
- ios - NSAttributedString 和布局的奇怪问题
- python-3.x - 为什么在这里出现 NameError
- python - Python中有二维列表的规范名称吗?
- java - 需要编写一个通用函数来根据用户提供的输入对地图中存在的对象进行类型转换
- airflow - 从 AirFlow 触发大型机作业
- ios - 无法将自定义 UINavigationBar / UIToolbar 传递给 UINavigationController,因为它们不符合 AnyClass
- rxjs - Rxjs - 在 concatMap() 中订阅不会触发点击
- python - 为什么 train、test 和 cv 的形状不同?