VLC recording rtsp stream

13,108

Solution 1

Seems like your destination URL is not correct. Try this:

vlc -vvv rtsp://admin:[email protected]/live/h264/ --sout="#transcode{vcodec=mp4v,vfilter=canvas{width=800,height=600}}:std{access=file,mux=mp4,dst=C:\\123.mp4}"

Solution 2

For Linux users, ffmpeg alone works straight away.

If you want to watch the stream while recording, write to a .mkv instead of a .mp4.

This example will overwrite the file video.mp4 in your home folder without asking due to the -y param, and the original codecs are kept.

ffmpeg -i rtsp://192.168.42.1/live -vcodec copy -acodec copy -y ~/video.mp4

NB: This example url is for an Ambarella Xiaomi Mijia 4K camera, like many wifi ip cameras, you have to activate the stream via telnet first, for this particular model the command to be sent before reading the stream via rtsp://:

echo '{"msg_id":257,"token":0}' | telnet 192.168.42.1 7878
Share:
13,108
Admin
Author by

Admin

Updated on June 30, 2022

Comments

  • Admin
    Admin almost 2 years

    I have a problem with recording rtsp stream with VLC player. Actually my method works in MacOS X, but doesn't in Windows. Command line:

    vlc -vvv rtsp://admin:[email protected]/live/h264/ --sout="#transcode{vcodec=mp4v,vfilter=canvas{width=800,height=600}}:std{access=file,mux=mp4,dst=C:\123.mp4}"
    

    On MacOS it works fine, but under Windows it creates unreadable file. MediaInfo output:

    General
    Complete name                            : C:\123.mp4
    Format                                   : MPEG-4
    Format profile                           : Base Media
    Codec ID                                 : isom
    File size                                : 1.08 MiB
    

    Any suggestions?