Page 1 of 1

VLC Record RTSP stream from command line

Posted: 27 Feb 2016 21:28
by viemmsakh
I have a Uokoo 720p wifi camera, and the software for it sucks. If it detects motion it will only record for 9-10 seconds, even if there is still motion present. From what I can tell there is now way to continuously record in 10 minute increments. Enter VLC. Using the GUI I can do most of this: http://imgur.com/a/ssdJC

Image
Image
Image
Image
Image
Image

But I cannot quiet figure out how to convert what I am doing in the GUI to command line. The best I have been able to do is

Code: Select all

vlc.exe -vvv rtsp://admin:123456@192.168.0.17:554/live/ch0 --sout file/ts:stream.mpg
But this just generates a stream.mpg without saving anything to the file.

If I can figure out how to save the stream to file using the command line, I am going to throw the command into a batch script and let it loop every 10 minutes.

I have been struggling with this for weeks, I even made a post to reddit /r/VLC 5 days ago asking for help; and still no luck.

Re: VLC Record RTSP stream from command line

Posted: 23 May 2016 14:20
by viemmsakh
I probably shouldn't bump this, but I am in case some future sole finds themselves in the same position I was.

To save a RTSP stream to a file with the command line (easy mode)

The GUI actually provides you everything you need (almost) to use the command line.
Media > Open Network Stream
URL: <your stream url> "rtsp://192.168.0.17:554"
Click dropdown next to play and select stream.
Next
To save to file, click File from the drop down and click add.
Give it a file name and location (you can change this later)
Next
You can select a profile for transcoding. In my instance I found it best to select Video - H.264 + MP3 (MP4) and clicking the preference icon to fine tune what I wanted
Next
Now this screen is the bread and butter. Copy the entire Generate stream output string and set it aside

Code: Select all

:sout=#transcode{acodec=none}:file{dst=c:\\example\\mov.mp4,no-overwrite} :sout-keep
Open up your terminal

Code: Select all

vlc -vvv <your stream url> --sout "#transcode{acodec=none}:file{dst=c:\\example\\mov.mp4,no-overwrite}"
Notice how I removed #sout= and replaced it with --sout ". I also dropped the :sout-keep from the end.
Hit enter. Yay!

PS Thanks for letting me go 3 months without any direction.

Re: VLC Record RTSP stream from command line

Posted: 04 Jun 2019 14:00
by ohanlon
SOLVED.

This is what I finally ended up getting to work:

Code: Select all

vlc dshow:// :dshow-vdev="USB2.0 Camera" --sout file/avi:test.avi --run-time=5