Help converting RTSP stream on AVI202Z [SOLVED]

Post here to ask any questions about hardware suitability, configuration in ZoneMinder, or experiences. If you just want to know if something works with ZoneMinder or not, please check the Hardware Compatibility sections in the forum, and the Wiki first. Also search this topic as well.
Post Reply
aNt1X
Posts: 10
Joined: Wed Apr 02, 2008 10:55 am

Help converting RTSP stream on AVI202Z [SOLVED]

Post by aNt1X »

Hi all, i'm now trying another different model, an Avtech AVI202Z.

It supports MPEG4/MJPEG RTSP streaming, so i'm trying to convert the RTSP stream to rawvideo to use it with Zoneminder.

I'm trying to decode the RSTP stream with ffmpeg without success.

I can succesfully view the RTSP stream with MPlayer on Windows, and also i can succesfully decode the RTSP stream with MPlayer on Linux (don't mind the X11 error). See output:

Code: Select all

C:\MPlayer\MPlayer-1.0rc2>mplayer rtsp://admin:admin@192.168.1.221/live/m
MPlayer 1.0rc2-4.2.1 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) M processor 1.73GHz (Family: 6, Model: 13, Stepp

CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.

Playing rtsp://admin:admin@192.168.1.221/live/mjpeg.
Connecting to server 192.168.1.221[192.168.1.221]: 554...
librtsp: server responds: 'RTSP/1.0 401 Unauthorized'
rtsp_session: unsupported RTSP server. Server type is 'unknown'.
STREAM_LIVE555, URL: rtsp://admin:admin@192.168.1.221/live/mjpeg
Stream not seekable!
 file format detected.
Initiated "video/JPEG" RTP subsession on port 4138
demux_rtp: Guessed the video frame rate as 30 frames-per-second.
       (If this is wrong, use the "-fps <frame>" option instead.)
VIDEO:  [MJPG]  0x0  0bpp  30.000 fps    0.0 kbps ( 0.0 kbyte/s)
=========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG decoder)
=========================================================================
Audio: no sound
Starting playback...
VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 3)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [directx] 640x480 => 640x480 Planar YV12
V:   1.4  42/ 42  9%  1%  0.0% 0 0
Exiting... (Quit)

C:\MPlayer\MPlayer-1.0rc2>

Code: Select all

root@videoserver:~# mplayer rtsp://admin:admin@192.168.1.221/live/mjpeg
MPlayer 2:1.0~rc1-0ubuntu13.2 (C) 2000-2006 MPlayer Team
CPU: Dual-Core AMD Opteron(tm) Processor 1210 (Family: 15, Model: 67,
Stepping: 2)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing rtsp://admin:admin@192.168.1.221/live/mjpeg.
Resolving 192.168.1.221 for AF_INET6...
Couldn't resolve name for AF_INET6: 192.168.1.221
Connecting to server 192.168.1.221[192.168.1.221]: 554...
librtsp: server responds: 'RTSP/1.0 401 Unauthorized'
rtsp_session: unsupported RTSP server. Server type is 'unknown'.
STREAM_LIVE555, URL: rtsp://admin:admin@192.168.1.221/live/mjpeg
Stream not seekable!
 file format detected.
Initiated "video/JPEG" RTP subsession on port 32770
demux_rtp: Guessed the video frame rate as 30 frames-per-second.
 (If this is wrong, use the "-fps <frame>" option instead.)
VIDEO:  [MJPG]  0x0  0bpp  30.000 fps    0.0 kbps ( 0.0 kbyte/s)
vo: couldn't open the X11 display ()!
Error opening/initializing the selected video_out (-vo) device.


Exiting... (End of file)
root@videoserver:~#
If i try to open the RTSP stream with ffmpeg, i got the following error:

Code: Select all

root@videoserver:~# ffmpeg -i rtsp://admin:admin@192.168.1.221/live/mjpeg
FFmpeg version SVN-r12774, Copyright (c) 2000-2008 Fabrice Bellard, et al.
 configuration:
 libavutil version: 49.6.0
 libavcodec version: 51.54.0
 libavformat version: 52.13.0
 libavdevice version: 52.0.0
 built on Apr  9 2008 16:36:53, gcc: 4.1.3 20070929 (prerelease)
(Ubuntu 4.1.2-16ubuntu2)
rtsp://admin:admin@192.168.1.221/live/mjpeg: Error while parsing header
What can i do?

Thank you i.a.

aNt1X
aNt1X
Posts: 10
Joined: Wed Apr 02, 2008 10:55 am

Post by aNt1X »

Hi guys,
i solved the problem using openRTSP + ffmpeg + vloopback + vpipe.

I piped them all and here is the command:

Code: Select all

/usr/src/live/testProgs/openRTSP -c -d 60 -t -v -u admin admin rtsp://192.168.1.221/live/mjpeg | ffmpeg -f mjpeg -i - -f rawvideo -pix_fmt rgb24 - | ./vpipe -f rgb -i 0
The openRTSP gets the rtp stream, using TCP connection (with UDP i had problems), reconnecting every 60 seconds.
It pipes the output to ffmpeg, that converts the mjpeg to rawvideo/rgb.
It pipes then all to vpipe, so i can catch the final output from Zoneminder from the /dev/video1 device.

Plese refer to this post to setup the vloopback and vpipe tools: http://www.zoneminder.com/forums/viewtopic.php?t=10766.

I hope this will be of help to anyone trying to use RDSP with ZoneMinder.

Good luck,
aNt1X
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for this. Native RTSP support is progressing in ZM and should be in the next maor release.
Phil
ThoR
Posts: 3
Joined: Sat Apr 12, 2008 1:15 am

Post by ThoR »

i have been trying to openrtsp + ffmpeg + vloopback + vpipe for 3 days and hold no success yet.
everything "looks" like it's working, but i still get no video feed on the loopback device. if i try to cat /dev/video1 it just stays there and shows nothing (on real capture cards, i see alot of gibberish on the screen when doing the same)

im running ubuntu 7.10

anyone else tested this / had this problem?
aNt1X
Posts: 10
Joined: Wed Apr 02, 2008 10:55 am

Post by aNt1X »

i'm using it successfully on Ubuntu 7.10.

is vloopback module modprobed successfully? i had to modprobe the videodev module too, if i remember correctly, before insomodding vloopback.

are the permissions ok on video1 and video0 devices ?

are you sure ffmpeg is working? i had to recompile it from svn repository to make sure i had the latest version. i had problems using the ffmpeg version included in ubuntu 7.10 with an older ipcam.

first of all try to use a file as output for ffmpeg: if ffmpeg is working ok using a file as an output, then it should pipe correctly to vpipe.

if ffmpeg is not ok, then you should check various ffmpeg and openrtsp parameters.

regards,

aNt1X
rsadanan
Posts: 46
Joined: Fri Mar 31, 2006 2:05 pm

Post by rsadanan »

since one week i am trying

i tried the idea to capture the video in zoneminder


but i get black screen


/usr/src/live/testProgs/openRTSP -c -d 60 -t -v -u admin admin rtsp://192.168.1.27:8003/live/mjpeg | ffmpeg -f mjpeg -i - -f rawvideo -pix_fmt rgb24 - | ./vpipe -f rgb -i 0
bash: ./vpipe: Aucun fichier ou répertoire de ce type
Sending request: OPTIONS rtsp://192.168.1.27:8003/live/mjpeg RTSP/1.0
CSeq: 1
User-Agent: /usr/src/live/testProgs/openRTSP (LIVE555 Streaming Media v2008.09.02)


FFmpeg version SVN-r8876, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --prefix=/usr --incdir=/usr/include/ffmpeg --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --arch=x86_32 --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables --enable-libmp3lame --enable-libogg --enable-libtheora --enable-libvorbis --enable-libfaad --enable-libfaac --enable-libgsm --enable-xvid --enable-x264 --enable-liba52 --enable-liba52bin --enable-libdts --enable-pp --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-opts --disable-strip
libavutil version: 49.4.0
libavcodec version: 51.40.4
libavformat version: 51.12.1
built on May 3 2007 12:47:56, gcc: 4.1.2 20070424 (Red Hat 4.1.2-11)
Received OPTIONS response: RTSP/1.0 200 OK
CSeq: 1
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE


Sending request: DESCRIBE rtsp://192.168.1.27:8003/live/mjpeg RTSP/1.0
CSeq: 2
Accept: application/sdp
User-Agent: /usr/src/live/testProgs/openRTSP (LIVE555 Streaming Media v2008.09.02)


Received DESCRIBE response: RTSP/1.0 401 Unauthorized
CSeq: 2
WWW-Authenticate: Basic realm="Server"


Sending request: DESCRIBE rtsp://192.168.1.27:8003/live/mjpeg RTSP/1.0
CSeq: 3
Accept: application/sdp
Authorization: Basic YWRtaW46YWRtaW4=
User-Agent: /usr/src/live/testProgs/openRTSP (LIVE555 Streaming Media v2008.09.02)


Received DESCRIBE response: RTSP/1.0 200 OK
CSeq: 3
Content-Base: rtsp://192.168.1.27:8003/live/mjpeg/
Content-Type: application/sdp
Content-Length: 122


Need to read 122 extra bytes
Read 122 extra bytes: v=0
o=- 1 1 IN IP4 127.0.0.1
s=Test
a=type:broadcast
t=0 0
c=IN IP4 0.0.0.0
m=video 0 RTP/AVP 26
a=control:track1

Opened URL "rtsp://192.168.1.27:8003/live/mjpeg", returning a SDP description:
v=0
o=- 1 1 IN IP4 127.0.0.1
s=Test
a=type:broadcast
t=0 0
c=IN IP4 0.0.0.0
m=video 0 RTP/AVP 26
a=control:track1

Created receiver for "video/JPEG" subsession (client ports 32830-32831)
Sending request: SETUP rtsp://192.168.1.27:8003/live/mjpeg/track1 RTSP/1.0
CSeq: 4
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Authorization: Basic YWRtaW46YWRtaW4=
User-Agent: /usr/src/live/testProgs/openRTSP (LIVE555 Streaming Media v2008.09.02)


Received SETUP response: RTSP/1.0 200 OK
CSeq: 4
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Session: 88E9565F5445021BE0616E972C3D9A


Setup "video/JPEG" subsession (client ports 32830-32831)
Outputting data from the "video/JPEG" subsession to 'stdout'
Sending request: PLAY rtsp://192.168.1.27:8003/live/mjpeg/ RTSP/1.0
CSeq: 5
Session: 88E9565F5445021BE0616E972C3D9A
Range: npt=0.000-60.000
Authorization: Basic YWRtaW46YWRtaW4=
User-Agent: /usr/src/live/testProgs/openRTSP (LIVE555 Streaming Media v2008.09.02)


Received PLAY response: RTSP/1.0 200 OK
CSeq: 5
Session: 88E9565F5445021BE0616E972C3D9A
Range: npt=now-
RTP-Info: url=rtsp://192.168.1.27:8003/live/mjpeg//track1;trackID=1;seq=25450;rtptime=1299982142


Started playing session
Receiving streamed data (for up to 60.000000 seconds)...
Input #0, mjpeg, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj420p, 320x240, 25.00 fps(r)
Output #0, rawvideo, to 'pipe:':
Stream #0.0: Video: rawvideo, rgb24, 320x240, q=2-31, 200 kb/s, 25.00 fps(c)
Stream mapping:
Stream #0.0 -> #0.0


this was my output


please help


thanks



in the status i have 7 - 8 fps but black screen
Post Reply