Build RTSP streaming media server (for testing and analyzing RTSP protocol) (rtsp-simple-server+FFmpeg+vlc+wireshark)

The streaming media server built in this article is to install rtsp-simple-server in the virtual machine centos7 as the server, install FFmpeg in the windows machine for streaming, and use vlc player to play the video in rtsp-simple-server as the streaming , and use wireshark to capture packets and analyze the RTSP protocol.

1. Download and run rtsp-simple-server

  1. Download the linux version at https://github.com/aler9/rtsp-simple-server/releases, go to the folder to decompress tar -zxvf rtsp-simple-server_v0.21.5_linux_amd64.tar.gz
    The version downloaded in linux2. After decompression, rtsp will appear in the file -simple-server executable file, ./rtsp-simple-server starts the server, in which different ports correspond to different protocols, here we mainly use port 8554 to pull streams.
    start rtsp server

2. Download and run FFmpeg

  1. Go to https://www.ffmpeg.org/download.html#build-windows to download, and just unzip it after downloading. (There will be multiple versions when downloading. The basic version of essentials should not have more functional plug-ins than the full version, but that version can meet the test, so just choose one at random)
    insert image description here
    insert image description here
  2. After the decompression is complete, enter the FFmpeg folder, open the powershell that comes with windows, (you can also add FFmpeg to the environment variable, so that you can run FFmpeg anytime and anywhere, please Baidu for details)
  3. ffmpeg -re -stream_loop -1 -i test.mp4 -c copy -f rtsp rtsp://192.168.162.141:8554/video
    -re: read as a stream;
    -stream_loop: the number of times to read the video in a loop,- 1 stands for infinite loop
    -i: input file;
    -c: audio and video are no longer encoded, and the original encoding method is used to push the stream directly;
    -f: output to that address;
    192.168.162.141: is the address of the virtual machine, Query with ifconfig in centos.

3. Download and use vlc to play

  1. Go to https://www.videolan.org/ to download the windows version and install it in windows.
    insert image description here
  2. Open vlc after installation, enter rtsp://192.168.162.141:8554/video in the open media stream, click play to pull the video.
    insert image description hereinsert image description here

insert image description here

4. Download and install wireshark

  1. Go to http://www.wireshark.org to download.
    insert image description here
    2. Open wireshark, enter RTSP in the filter bar , and filter the RTSP protocol
    insert image description here

V. Summary

  1. Start the rtsp-simple-server server;
  2. Streaming with FFmpeg;
  3. Use vlc to pull and play;
  4. Use wireshark to capture packets

Guess you like

Origin blog.csdn.net/qq_36819827/article/details/129320180