Discussion:
[libav-user] Reading RTSP Stream from Axis Camera
Tekweb
2008-08-25 10:46:21 UTC
Permalink
Hi there,
i want to read an RTSP Stream from an Axis Camera and decode it.
Decoding a File via the libs works fine(even wrapped for my C# project),
but i just dont know where to start with the RTSP stuff.

Does anyone has some example Code?
Im not even sure if ffmpeg already has support for RTSP via TCP.

thanks K. Herv
Luca Abeni
2008-08-25 11:10:18 UTC
Permalink
Hi,
Post by Tekweb
Hi there,
i want to read an RTSP Stream from an Axis Camera and decode it.
Decoding a File via the libs works fine(even wrapped for my C# project),
but i just dont know where to start with the RTSP stuff.
Just open the "rtsp://..." URL, using the "rtsp" AVInputFormat.
Try "ffmpeg -i rtsp://..." to check if the stream sent by your camera
is supported by libavformat.
Post by Tekweb
Does anyone has some example Code?
The same code you use for playing from a file should work fine.
Post by Tekweb
Im not even sure if ffmpeg already has support for RTSP via TCP.
You probably mean "RTP over TCP", right? Yes, libavformat supports
it (in particular, it supports RTP over RTSP), but I am not sure
how you can select this transport protocol (for sure, if the RTSP
server says that RTP over UDP is unsupported then libavformat tries
RTP over RTSP... But I do not know how to force it if RTP over UDP
is supported).


Luca
Tekweb
2008-08-25 11:40:14 UTC
Permalink
I already tried to check if the stream is supported

G:\Dokumente und Einstellungen\Keksi\Desktop\videomixer>ffmpeg -i
rtsp://134.155
.92.47:1024/mpeg4/1/media.amp
FFmpeg version SVN-r13712, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --enable-memalign-hack --enable-avisynth
--enable-libxvid --ena
ble-libx264 --enable-libgsm --enable-libfaac --enable-libfaad
--enable-liba52 --
enable-libmp3lame --enable-libvorbis --enable-libtheora
--enable-pthreads --enab
le-swscale --enable-gpl
libavutil version: 49.7.0
libavcodec version: 51.57.2
libavformat version: 52.14.0
libavdevice version: 52.0.0
built on Jun 8 2008 21:33:14, gcc: 4.2.3

ffmpeg.exe just hangs without an error

VLC can play this Stream with live555 and ffmpeg as decoder, but i would
be glad if theres an easy"out of the box" solution.
Post by Luca Abeni
Hi,
Post by Tekweb
Hi there,
i want to read an RTSP Stream from an Axis Camera and decode it.
Decoding a File via the libs works fine(even wrapped for my C# project),
but i just dont know where to start with the RTSP stuff.
Just open the "rtsp://..." URL, using the "rtsp" AVInputFormat.
Try "ffmpeg -i rtsp://..." to check if the stream sent by your camera
is supported by libavformat.
Post by Tekweb
Does anyone has some example Code?
The same code you use for playing from a file should work fine.
Post by Tekweb
Im not even sure if ffmpeg already has support for RTSP via TCP.
You probably mean "RTP over TCP", right? Yes, libavformat supports
it (in particular, it supports RTP over RTSP), but I am not sure
how you can select this transport protocol (for sure, if the RTSP
server says that RTP over UDP is unsupported then libavformat tries
RTP over RTSP... But I do not know how to force it if RTP over UDP
is supported).
Luca
_______________________________________________
libav-user mailing list
libav-user at mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Luca Abeni
2008-08-25 12:05:24 UTC
Permalink
Post by Tekweb
I already tried to check if the stream is supported
G:\Dokumente und Einstellungen\Keksi\Desktop\videomixer>ffmpeg -i
rtsp://134.155
.92.47:1024/mpeg4/1/media.amp
FFmpeg version SVN-r13712, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --enable-memalign-hack --enable-avisynth
--enable-libxvid --ena
ble-libx264 --enable-libgsm --enable-libfaac --enable-libfaad
--enable-liba52 --
enable-libmp3lame --enable-libvorbis --enable-libtheora
--enable-pthreads --enab
le-swscale --enable-gpl
libavutil version: 49.7.0
libavcodec version: 51.57.2
libavformat version: 52.14.0
libavdevice version: 52.0.0
built on Jun 8 2008 21:33:14, gcc: 4.2.3
ffmpeg.exe just hangs without an error
VLC can play this Stream with live555 and ffmpeg as decoder, but i would
be glad if theres an easy"out of the box" solution.
Is your client on the same network of the camera? Is there any firewall
in the middle? Or do you have a windows firewall enabled, which blocks
the UDP traffic?

What's probably happening is that ffmpeg asks for RTP over UDP, but
something is blocking the UDP traffic... VLC solves this problem by
switching to RTP over RTSP if no packet is received after a short timeout.

Can you try to change the "protocol_mask = (1 << RTSP_PROTOCOL_RTP_LAST) - 1;"
line in libavformat/rtsp.c (around line 1061) in
"protocol_mask = (1<< RTSP_PROTOCOL_RTP_TCP);" and see if this helps?


Luca
Stephane List
2008-08-26 13:33:02 UTC
Permalink
Post by Luca Abeni
Post by Tekweb
I already tried to check if the stream is supported
G:\Dokumente und Einstellungen\Keksi\Desktop\videomixer>ffmpeg -i
rtsp://134.155
.92.47:1024/mpeg4/1/media.amp
FFmpeg version SVN-r13712, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --enable-memalign-hack --enable-avisynth
--enable-libxvid --ena
ble-libx264 --enable-libgsm --enable-libfaac --enable-libfaad
--enable-liba52 --
enable-libmp3lame --enable-libvorbis --enable-libtheora
--enable-pthreads --enab
le-swscale --enable-gpl
libavutil version: 49.7.0
libavcodec version: 51.57.2
libavformat version: 52.14.0
libavdevice version: 52.0.0
built on Jun 8 2008 21:33:14, gcc: 4.2.3
ffmpeg.exe just hangs without an error
VLC can play this Stream with live555 and ffmpeg as decoder, but i would
be glad if theres an easy"out of the box" solution.
Is your client on the same network of the camera? Is there any firewall
in the middle? Or do you have a windows firewall enabled, which blocks
the UDP traffic?
What's probably happening is that ffmpeg asks for RTP over UDP, but
something is blocking the UDP traffic... VLC solves this problem by
switching to RTP over RTSP if no packet is received after a short timeout.
Can you try to change the "protocol_mask = (1 << RTSP_PROTOCOL_RTP_LAST) - 1;"
line in libavformat/rtsp.c (around line 1061) in
"protocol_mask = (1<< RTSP_PROTOCOL_RTP_TCP);" and see if this helps?
Hi,

It's not a matter of TCP or UDP, Axis cameras support both protocols.

In file libavformat/utils.c , you can read :" /* Do not open file if
the format does not need it. XXX: specific
hack needed to handle RTSP/TCP */


Stephane
Luca Abeni
2008-08-26 13:41:00 UTC
Permalink
Stephane List wrote:
[...]
Post by Stephane List
Post by Luca Abeni
Post by Tekweb
VLC can play this Stream with live555 and ffmpeg as decoder, but i would
be glad if theres an easy"out of the box" solution.
Is your client on the same network of the camera? Is there any firewall
in the middle? Or do you have a windows firewall enabled, which blocks
the UDP traffic?
What's probably happening is that ffmpeg asks for RTP over UDP, but
something is blocking the UDP traffic... VLC solves this problem by
switching to RTP over RTSP if no packet is received after a short timeout.
Can you try to change the "protocol_mask = (1 << RTSP_PROTOCOL_RTP_LAST) - 1;"
line in libavformat/rtsp.c (around line 1061) in
"protocol_mask = (1<< RTSP_PROTOCOL_RTP_TCP);" and see if this helps?
Hi,
It's not a matter of TCP or UDP
So, changing the "protocol_mask = ..." line as I suggested did not help?
Post by Stephane List
Axis cameras support both protocols.
I know this. But if something inside the network is dropping UDP packets,
the axis camera has no way to know this...
Post by Stephane List
In file libavformat/utils.c , you can read :" /* Do not open file if
the format does not need it. XXX: specific
hack needed to handle RTSP/TCP */
This looks something completely unrelated.


Luca

Loading...