Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

通过接口api/ctrl/start_relay_pull设置h265的rtsp流地址,flv方式预览加载失败 #190

Closed
zhengzhixiong opened this issue Jun 7, 2022 · 9 comments

Comments

@zhengzhixiong
Copy link

设备是华为SDC,编码格式H265,分辨率2560*1440, 帧率30
前端flv报错:[TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported codec in video frame: 12
lal日志信息: {"stream_name":"ff80808181367aef01813680fdfe00f1","audio_codec":"","video_codec":"H265","video_width":2560,"video_height":1440,"pub":{"session_id":"","protocol":"","base_type":"","start_time":"","remote_addr":"","read_bytes_sum":0,"wrote_bytes_sum":0,"bitrate":0,"read_bitrate":0,"write_bitrate":0},"subs":null,"pull":{"session_id":"RTSPPULL1","protocol":"RTSP","base_type":"PULL","start_time":"2022-06-07 09:27:50.567","remote_addr":"10.8.51.117:554","read_bytes_sum":36634392,"wrote_bytes_sum":5460,"bitrate":1008,"read_bitrate":1008,"write_bitrate":0}}

@echo-LuGuang
Copy link

用ffmpeng推流的时候,如果要flv.js再html能正常播放 (再手机浏览器是必须的,pc浏览器我试过不加这个参数也是能正常播放),需要-pix_fmt yuv420p参数。

http://bilibili.github.io/flv.js/demo/

去试试取消勾选视频,是否有音频播放
image

@echo-LuGuang
Copy link

设备是华为SDC,编码格式H265,分辨率2560*1440, 帧率30 前端flv报错:[TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported codec in video frame: 12 lal日志信息: {"stream_name":"ff80808181367aef01813680fdfe00f1","audio_codec":"","video_codec":"H265","video_width":2560,"video_height":1440,"pub":{"session_id":"","protocol":"","base_type":"","start_time":"","remote_addr":"","read_bytes_sum":0,"wrote_bytes_sum":0,"bitrate":0,"read_bitrate":0,"write_bitrate":0},"subs":null,"pull":{"session_id":"RTSPPULL1","protocol":"RTSP","base_type":"PULL","start_time":"2022-06-07 09:27:50.567","remote_addr":"10.8.51.117:554","read_bytes_sum":36634392,"wrote_bytes_sum":5460,"bitrate":1008,"read_bitrate":1008,"write_bitrate":0}}

你试试ffplay能正常播放吗

@q191201771
Copy link
Owner

lal支持h265 flv/rtmp。

但是由于rtmp官方标准不支持h265,所以原生的ffmpeg和vlc都无法直接播放h265 rtmp/flv。
你可以使用 lalext 项目里thirdparty/build.sh编译一个支持h265的ffmpeg。

另外,据说 EasyPlayer.js 也支持播放h265 rtmp/flv,你也可以试试。

https://pengrl.com/#/FAQ?id=q-%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bd%bf%e7%94%a8vlc%e7%ad%89%e6%92%ad%e6%94%be%e5%99%a8%e6%92%ad%e6%94%beh265-flvrtmp%e5%a4%b1%e8%b4%a5%e4%ba%86%ef%bc%9f

@zhengzhixiong
Copy link
Author

https://pengrl.com/#/FAQ?id=q-%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bd%bf%e7%94%a8vlc%e7%ad%89%e6%92%ad%e6%94%be%e5%99%a8%e6%92%ad%e6%94%beh265-flvrtmp%e5%a4%b1%e8%b4%a5%e4%ba%86%ef%bc%9f

lal支持h265 flv/rtmp。
但是由于rtmp官方标准不支持h265,所以原生的ffmpeg和vlc都无法直接播放h265 rtmp/flv。
你可以使用 lalext 项目里thirdparty/build.sh编译一个支持h265的ffmpeg。
另外,据说 EasyPlayer.js 也支持播放h265 rtmp/flv,你也可以试试。
https://pengrl.com/#/FAQ?id=q-%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bd%bf%e7%94%a8vlc%e7%ad%89%e6%92%ad%e6%94%be%e5%99%a8%e6%92%ad%e6%94%beh265-flvrtmp%e5%a4%b1%e8%b4%a5%e4%ba%86%ef%bc%9f

我尝试了下直接用vlc播放rtsp流地址是可以,我是通过接口api/ctrl/start_relay_pull授权lal去拉取rtsp流,然后代发,尝试了海康和华为两款ipc,默认出厂都是h265都不行,修改了摄像机里的编码为h264就可以;我用ffmpeg推流到lal,推流参数:ffmpeg -re -rtsp_transport tcp -threads 1 -buffer_size 1024000 -max_delay 500000 -i rtsp://admin:xxx@10.8.51.111:554/LiveMedia/ch1/Media1 -c:v libx264 -b:v 350k -profile:v baseline -level 3.0 -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 96k -fflags nobuffer -preset ultrafast -tune zerolatency -vcodec h264 -f flv -an rtmp://localhost:1935/live/ff80808181367aef01813680fdfe00f1 把h265转264再推送到lal,前端flv播放就ok

@zhengzhixiong
Copy link
Author

用ffmpeng推流的时候,如果要flv.js再html能正常播放 (再手机浏览器是必须的,pc浏览器我试过不加这个参数也是能正常播放),需要-pix_fmt yuv420p参数。

http://bilibili.github.io/flv.js/demo/

去试试取消勾选视频,是否有音频播放 image

我目前还没用ffmpeg推流,走api/ctrl/start_relay_pull方式去设置拉流,如果rtsp流编码是h264都可以,h265就不可以,改成用ffmpeg去推送,推流参数:ffmpeg -re -rtsp_transport tcp -threads 1 -buffer_size 1024000 -max_delay 500000 -i rtsp://admin:xxx@10.8.51.111:554/LiveMedia/ch1/Media1 -c:v libx264 -b:v 350k -profile:v baseline -level 3.0 -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 96k -fflags nobuffer -preset ultrafast -tune zerolatency -vcodec h264 -f flv -an rtmp://localhost:1935/live/ff80808181367aef01813680fdfe00f1 把h265转264再推送到lal,前端flv播放就ok

@zhengzhixiong
Copy link
Author

用ffmpeng推流的时候,如果要flv.js再html能正常播放 (再手机浏览器是必须的,pc浏览器我试过不加这个参数也是能正常播放),需要-pix_fmt yuv420p参数。

http://bilibili.github.io/flv.js/demo/

去试试取消勾选视频,是否有音频播放 image

我目前还没用ffmpeg推流,走api/ctrl/start_relay_pull方式去设置拉流,如果rtsp流编码是h264都可以,h265就不可以,改成用ffmpeg去推送,推流参数:ffmpeg -re -rtsp_transport tcp -threads 1 -buffer_size 1024000 -max_delay 500000 -i rtsp://admin:xxx@10.8.51.111:554/LiveMedia/ch1/Media1 -c:v libx264 -b:v 350k -profile:v baseline -level 3.0 -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 96k -fflags nobuffer -preset ultrafast -tune zerolatency -vcodec h264 -f flv -an rtmp://localhost:1935/live/ff80808181367aef01813680fdfe00f1 把h265转264再推送到lal,前端flv播放就ok

设备是华为SDC,编码格式H265,分辨率2560*1440, 帧率30 前端flv报错:[TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported codec in video frame: 12 lal日志信息: {"stream_name":"ff80808181367aef01813680fdfe00f1","audio_codec":"","video_codec":"H265","video_width":2560,"video_height":1440,"pub":{"session_id":"","protocol":"","base_type":"","start_time":"","remote_addr":"","read_bytes_sum":0,"wrote_bytes_sum":0,"bitrate":0,"read_bitrate":0,"write_bitrate":0},"subs":null,"pull":{"session_id":"RTSPPULL1","protocol":"RTSP","base_type":"PULL","start_time":"2022-06-07 09:27:50.567","remote_addr":"10.8.51.117:554","read_bytes_sum":36634392,"wrote_bytes_sum":5460,"bitrate":1008,"read_bitrate":1008,"write_bitrate":0}}

你试试ffplay能正常播放吗

设备是华为SDC,编码格式H265,分辨率2560*1440, 帧率30 前端flv报错:[TransmuxingController] > DemuxException: type = CodecUnsupported, info = Flv: Unsupported codec in video frame: 12 lal日志信息: {"stream_name":"ff80808181367aef01813680fdfe00f1","audio_codec":"","video_codec":"H265","video_width":2560,"video_height":1440,"pub":{"session_id":"","protocol":"","base_type":"","start_time":"","remote_addr":"","read_bytes_sum":0,"wrote_bytes_sum":0,"bitrate":0,"read_bitrate":0,"write_bitrate":0},"subs":null,"pull":{"session_id":"RTSPPULL1","protocol":"RTSP","base_type":"PULL","start_time":"2022-06-07 09:27:50.567","remote_addr":"10.8.51.117:554","read_bytes_sum":36634392,"wrote_bytes_sum":5460,"bitrate":1008,"read_bitrate":1008,"write_bitrate":0}}

你试试ffplay能正常播放吗

我目前还没用ffmpeg推流,走api/ctrl/start_relay_pull方式去设置拉流,如果rtsp流编码是h264都可以,h265就不可以,改成用ffmpeg去推送,推流参数:ffmpeg -re -rtsp_transport tcp -threads 1 -buffer_size 1024000 -max_delay 500000 -i rtsp://admin:xxx@10.8.51.111:554/LiveMedia/ch1/Media1 -c:v libx264 -b:v 350k -profile:v baseline -level 3.0 -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 96k -fflags nobuffer -preset ultrafast -tune zerolatency -vcodec h264 -f flv -an rtmp://localhost:1935/live/ff80808181367aef01813680fdfe00f1 把h265转264再推送到lal,前端flv播放就ok

@q191201771
Copy link
Owner

flv.js不支持h265 flv/rtmp

@zhengzhixiong
Copy link
Author

ok,了解,感谢您的解答,接口是否考虑将h265内部自动转h264,然后代发出去,或者提供ffmpeg调用方式去实现推流

@q191201771 q191201771 mentioned this issue Mar 6, 2023
32 tasks
@q191201771
Copy link
Owner

超时移入 #37 管理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants