Page 1 of 1

rtsp to file

Posted: 23 Apr 2016 21:15
by apu
Hi,

Been trying to dump my IP camera real time stream on to disk but not quit making it, I need some advice please.

About the setup: The IP camera is a cheapo Sricam IP camera. After some fighting I now have it set up and working in my LAN with a static local IP address and using it's Android sw. From iSpy site I then found out how to form the RTSP URL for this camera for streaming it using VLC player. The URL is like this: rtsp://test:123456@192.168.10.49/onvif1 and it actually works so than I can watch the live stream via VLC player on my PC. As the next step I then tried to dump the stream to file as h264, MPEG4 and also as RAW format but all these fail and almost every time VLC crashes. From "Current Media Information" I see that the stream is of format: H264-MPEG-4 AVC (part10) (h264). Anyone out there who could help.

Thanks
a.p.u.

Re: rtsp to file

Posted: 06 May 2016 10:46
by qiqo
I have the same problem, let's see if someone can help..

Re: rtsp to file

Posted: 06 May 2016 18:39
by kmf31
To really "dump" a RTSP stream (without any modification) use:

1) either the option "--ts-dump-file=..." with vlc-2.0.9 (if you can install/complile/use it somehow). Unfortunately this option has disappeared in later versions of vlc, especially in vlc-2.2.x (I am not sure for vlc-2.1.x.) and the replacement option (--demux=demuxdump ----demuxdump-file=...") does NOT work with rtsp since rtsp is already a "demux" and not a bytestream. So for this you really need a version of vlc of the 2.0.x branch (or earlier) if possible.

2) or the utility "openRTSP" which comes with the live555 library ( http://www.live555.com/liveMedia/ ), a library which is actually also used by vlc for rtsp. In any case this utility permits simple saving/dumping of a RTSP stream. When you compile/install live555 in linux this utility is automatically build but you have to install it to some convient place, for Windows I don't know if and how you can use it in a simple way. It is not impossible that this utility is already somewhere in your system if live555 is installed for the use in vlc (maybe also for Windows ???).

Both should allow to save the RTSP stream without any modification and the resulting files should play with vlc provided that direct viewing also works. However, using these files as input for further transcoding/demuxing with vlc will probably trigger the same problem but only on a later stage (see below) if there is some problem in the rtsp flux as such.


A part from this I suspect that your rtsp-TS-streams suffer maybe from a similar problem of missing time-stamps in certain packets as I have discussed here:
https://forum.videolan.org/viewtopic.php?f=4&t=132666
If you can compile vlc on your own, you can try the simple "hack" I suggest and then use a standard option such as:

--sout="#std{mux=ts,access=file,dst=outputfile.ts}"

to save the RTSP stream to a file. Note that this method does non-trivial modifications on the stream (especially unjustly removing "non-timestamp" packets from the stream) which may cause the problem if the initial stream is not perfect. The other two methods above do NOT apply these modifications !! Therefore they should produce files which play with vlc but still "contain" the problem.
Using the hack I suggest in the other topic the sout-method might work and produce "repaired files" but of course this is very speculative and maybe I am completely wrong on this since I do not know what your exact problem is.

In any case the problem I discuss in the other topic is identical if you use other mux values with sout (for example mux=mp4 instead of mux=ts). The different muxes produce different encapsulation file formats (TS, mp4, ...) but the main problem of the flux is exactly the same.

Re: rtsp to file

Posted: 06 May 2016 22:16
by RĂ©mi Denis-Courmont
You can't really dump an RTSP stream without modifications. RTSP uses RTP to transmit data. That brings two issues. First, it's lossy. And second, it is packet-based. If you really wanted the original, you would have to save a packet capture. But that can't be played in a media player.

The VLC "dump" demux plugin does not work with RTSP because of that. You have to remux.