Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

ffmpeg怎样将局域网的onvif转成hls

sycru

New Member
Joined
Aug 21, 2017
Messages
13
Reaction score
0
我已经在debian中搭好了ffmpeg,ng,nginx-rtmp-module,也能用ffmpeg将mp4成功送到rtmp。
ffmpeg -re -i /tmp/02.mp4 -vcodec copy -acodec copy -f flv rtmp://127.0.0.1/hls/mystream

但我怎样才能用ffmpeg将rtsp://192.168.0.3:554/转成hls直播呢?
ffmpeg -i "rtsp://192.168.0.3:554/onvif1" -f flv rtmp://127.0.0.1/hls/mystream
总是失败
 
ffmpeg -i "rtsp://192.168.0.3:554/onvif" -f mp4 -vcodec copy -r 25 -s -b:v 2048000 -an -f flv "rtmp://127.0.0.1/hls/mystream"
出错
[rtsp @ 0x564204386b80] UDP timeout, retrying with TCP
ctrl+z退出错误显示

[rtsp @ 0x564204386b80] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://192.168.0.3:554/onvif1':
Metadata:
title : H.264 Video, RtspServer_0.0.0.2
Duration: N/A, start: 0.000000, bitrate: 64 kb/s
Stream #0:0: Video: h264, none, 90k tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
File '2048000' already exists. Overwrite ? [y/N] y
Output #1, flv, to 'rtmp://127.0.0.1/hls/mystream':
Output file #1 does not contain any stream
Exiting normally, received signal 2.
 
ffmpeg -i "rtsp://192.168.0.3:554/onvif1" -f flv rtmp://127.0.0.1/hls/mystream

[rtsp @ 0x55669067b9c0] UDP timeout, retrying with TCP

[rtsp @ 0x55669067b9c0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://192.168.0.3:554/onvif1':
Metadata:
title : H.264 Video, RtspServer_0.0.0.2
Duration: N/A, start: 0.000000, bitrate: 64 kb/s
Stream #0:0: Video: h264, none, 90k tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
[rtmp @ 0x5566906cf800] Cannot open connection tcp://127.0.0.1:1935
rtmp://127.0.0.1/hls/mystream: Immediate exit requested
Exiting normally, received signal 2.
 
ffmpeg -i "rtsp://192.168.0.3:554/onvif2" -f flv "rtmp://127.0.0.1:1935/hls/playlist"
[rtsp @ 0x561151cd2be0] UDP timeout, retrying with TCP
ctl+z退出没有其它错误
 
指定视频编解码器试一下:
Code:
ffmpeg -f lavfi -i anullsrc -rtsp_transport udp -i rtsp://192.168.1.3:554/onvif1 -tune zerolatency -vcodec libx264 -t 12:00:00 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/stream name
 
指定视频编解码器试一下:
Code:
ffmpeg -f lavfi -i anullsrc -rtsp_transport udp -i rtsp://192.168.1.3:554/onvif1 -tune zerolatency -vcodec libx264 -t 12:00:00 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/stream name
ffmpeg -f lavfi -i anullsrc -rtsp_transport udp -i rtsp://192.168.0.3:554/onvif1 -tune zerolatency -vcodec libx264 -t 12:00:00 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv rtmp://127.0.0.1:1935/hls/playlist

能产生文件,但我用vlc播放不了
http://192.168.48.11/hls/playlist.m3u8
rtmp://192.168.48.11/hls/playlist.m3u8
rtmp://192.168.48.11:1935/hls/playlist.m3u8

都是黑屏幕播不了
 
指定视频编解码器试一下:
Code:
ffmpeg -f lavfi -i anullsrc -rtsp_transport udp -i rtsp://192.168.1.3:554/onvif1 -tune zerolatency -vcodec libx264 -t 12:00:00 -pix_fmt + -c:v copy -c:a aac -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/stream name
[rtsp @ 0x555becd719a0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for Input Stream #1.1 : mono
Input #1, rtsp, from 'rtsp://192.168.0.3:554/onvif1':
Metadata:
title : H.264 Video, RtspServer_0.0.0.2
Duration: N/A, start: 0.000000, bitrate: 64 kb/s
Stream #1:0: Video: h264, none, 90k tbr, 90k tbn, 180k tbc
Stream #1:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Codec AVOption tune (Tune the encoding to a specific scenario) specified for output file #0 (rtmp://127.0.0.1:1935/hls/play2) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
 
Back
Top