Closed dorvan closed 6 years ago
can you try ffprobe rtsp://10.2.22.2:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=test&password=test
?
But with the URL surrounded in single quotes due to the &s :-)
@jogu commente thanks for quotes suggestion, but I use console daily... :-)
RTMP stream: [ @tosiara , @jogu ] repeat, RTMP stream:
as RTMP proto:
:pts/0: [root@box01] /cfg/anthilla/motion #> ffprobe 'rtmp://10.2.22.2:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=test&password=test'
ffprobe version 3.2.4 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5)
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Metadata:
width 2560.00
height 1440.00
displayWidth 2560.00
displayHeight 1440.00
duration 0.00
videocodecid 7.00
audiocodecid 10.00
audiosamplerate 16000.00
framerate 24.00
[flv @ 0x23ecdc0] audio stream discovered after head already parsed
[flv @ 0x23ecdc0] video stream discovered after head already parsed
Input #0, flv, from 'rtmp://10.2.22.2:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=test&password=test':
Metadata:
displayWidth : 2560
displayHeight : 1440
Duration: 00:00:00.00, start: 210832.309000, bitrate: N/A
Stream #0:0: Audio: aac (LC), 16000 Hz, mono, fltp
Stream #0:1: Video: h264 (High), yuv420p(progressive), 2560x1440, 25 fps, 25 tbr, 1k tbn
as RTSP proto as suggested by @tosiara in #98 (wrong):
:pts/0: [root@box01] /cfg/anthilla/motion #> ffprobe 'rtsp://10.2.22.2:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=test&password=test'
ffprobe version 3.2.4 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5)
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
stalled. (28/06/2017 update) anyone want play chess? mmmh yes stalled.... yes rtmp streams are not rtsp streams called rtmp....
What if you specify RTCP TRANSPORT?
ffprobe -rtsp_transport tcp rtsp://blahblah
@tosiara
ffprobe -rtsp_transport tcp rtsp://blahblah
the same. remains stalled.
:pts/1: [root@box01] /cfg/anthilla/motion #> ffprobe -rtsp_transport tcp 'rtsp://10.2.22.2:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=test&password=test'
ffprobe version 3.2.4 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 5.4.0 (Gentoo 5.4.0-r3 p1.3, pie-0.6.5)
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
@tosiara there are updates about rtmp?
No, I don't have any news for you. This issue may be camera specific. I have tested online available RTMP camera and it worked fine both with ffprobe and motion
Maybe you can provide wireshark dump to for both ffprobe cases: rtmp and rtsp?
@tosiara but it's a totally different protocol!!! yes I can provide it ASAP
pcap directly, from tcpdump, not wireshark, but you know, it's the same.
@dorvan, you will probably need to ask the camera manufacturer or user forums for the correct RTSP/RTMP URL (and settings) to use. If you can't get ffprobe/VLC/etc. to stream video from the camera, then there's no way Motion will do any better.
@iskunk no, wait, we already make it, with great results, without motion, but we need motion detection.
We can't, as @tosiara suggested, because rtsp and rtmp stream are totally different protocols.
As you can read, we already do it, directly with ffmpeg, we already have the API documentation and we already use both streams, rtsp with motion and ffmpeg and rtmp directly with ffmpeg because motion cannot... It's already in use. this because we switched to rtmp, one month ago studying both protocols and see stream capture impacts referring to netcam API docs.
as you can read: this is the Rtmp stream syntax, for the rtmp stream:
'rtmp://10.2.22.2:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=test&password=test'
and capture an always fluent stream also in case of multi capture of same stream.
this is the Rtsp stream syntax, for the rtsp stream:
'rtsp://test:test@10.2.22.2:554/h264Preview_01_main'
and capture an fluent stream, only if is captured only by a thread, but tune and optimization params cause the freeze of frames, like the execution of many capture threads of the same stream.
Protocol packets looking to pcap it's totally different, video encoding it's the same, resolution it's the same.
Looking pcap and the behavior of ffmpeg on both protocols streams, using the rstp word on rtmp stream it's like calling a .mp3 file .avi thinking to make a conversion. XD
Probably, in some firmware, both streams (especially rtmp, when is it present in a real rtmp format, it's for browser live view without plugins or with flash player plugins, not activex or other fucking pieces) usually have a no specialized tuning but are present only for compatibility with various NVR so the motion capture of stream can be call with same parameters capturing the same stream ignoring the protocol specification. on Onvif Cameras with the live view published with a good web gui without plugin needs, you have a real rtmp stream. And is it different from rtsp stream (also for device cpu load).
so the quastion it's always: "can motion work with rtmp streams? ..really rtmp..."
So to sum up, I believe dorvan has a camera that has broken rtsp support.
The camera appears to work with ffmpeg when using rtmp.
motion can probably support rtmp via ffmpeg, but someone would need to implement and test it - I would imagine it would be similar to how Mr-Dave added v4l2 support via ffmpeg in 58baeb4d.
No one from the core team currently has time to do this, pull requests would be welcome.
@jogu I have different network cameras, with different protocols and official API documentations, tested with different firmware versions, and support continue to update, so as definition, software can always be enhanced and fixed, so, the firmware release can be buggy or not on different features, like any other product.
Starting from this, for the work I have to do, I have to make something, more realtime as possible using the maximum quality from netcams or usbcams, generate different data streams from each video streams.
So I can select my "tools" to work in this environment, to solve the problem.
Base OS: Custom Linux system, with tuned compilation flags. on x86 64bit platform, all used binaries are benchmarked with the default OS binary settings. Base HW: low end cpu, quad core, 8 gb ram Network Monitoring on server side, switch side, AP side (some cams are wifi), camera side. Protocols: Protocols documentation, and banchmarking with ffmpeg
Camera works with both streams, rtsp and rtmp on their native API, but if I test the @tosiara tips to change rtmp word with rtsp, to force motion to manage rtmp, the answer is the "totally nothing" the same on test with ffmpeg, passing the (wrong) rtsp protocol name on a rtmp i can't have the stream captured. If I correctly call it for what is (RTMP for rtmp stream and RTSP for rtsp stream) I have no problem to acquire... with ffmpeg...
the "bug" firmware related seems it's on exclusive access of the stream, where rtsp, take an esclusive priority (100 as weight, for example), but seems more related on how RTMP works, because seems more cpu hungry then RTMP protocol
speaking about ffmpeg tests (without or with motion), as I wrote before, I can capture and manage more RTMP streams using less resources than RTSP, with the best quality and smoothly.
so a part the stream output of the camera, the RTSP computation seems more heavy.
This is why I have asked a way to use RTMP with motion.
and Why at moment i'm using, with the published configuration, motion, only as motion trigger. But actually motion have problems to manage external process in a stress situation, sometimes cannot close ffmpeg extpipe and start a new thread on event, the same of other triggers. The problem it's always on a multi managed (network) device configuration. But this can be another issue...
but this is comprehensive, async (motion trigger related) multithread thread management especially on external processes it's one of the most complex things....
@jogu my colleagues develops in c#,, and work on system engineering, I'm not a developer. I can help you guys with this great project, point the focus on problems with maintream products and environments, I can't provide code fixes, all I need a more relaxed, trusted, and friendly (aka less acid) answers. Like you I have already my daily problems, if i can find the time to write something here it's for support the project, using the latest code available and testing it. Is my help, in this way appeciated?
rtsp and rtmp it's NOT only related to the protocol syntax but to the api of the camera,
for example:
rtsp stream:
netcam_url rtsp://test:test@10.2.22.2:554/h264Preview_01_main
works!rtmp stream:
netcam_url rtsp://10.2.22.2:1935/bcs/channel0_main.bcs?channel=0&stream=0&user=test&password=test
does not works!Reporting in a log level 5