ngraziano / SharpRTSP

A RTSP handling library
Other
557 stars 182 forks source link

How to make a RTSP server to read ffmpeg data and send video to VLC. #117

Closed Coloryr closed 8 months ago

Coloryr commented 8 months ago

I clone the code, and run RtspMultiplexer

Starting

And start the ffmpeg

ffmpeg -re -stream_loop -1 -i C:\Users\user\Desktop\movie.mp4 -c copy -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/live/test

but the video data can't write, ffmpeg log

C:\Users\user\Desktop\ffmpeg-master-latest-win64-gpl-shared\bin>ffmpeg -re -stream_loop -1 -i C:\Users\user\Desktop\movie.mp4 -c copy -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/live/test
ffmpeg version N-113840-g1bb7d5ca9f-20240227 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 13.2.0 (crosstool-NG 1.25.0.232_c175b21)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20240227
  libavutil      58. 39.100 / 58. 39.100
  libavcodec     60. 40.100 / 60. 40.100
  libavformat    60. 22.101 / 60. 22.101
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 17.100 /  9. 17.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\user\Desktop\movie.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isomavc1
    creation_time   : 2010-05-11T10:32:06.000000Z
    encoder         : HandBrake 0.9.4 2009112300
  Duration: 00:00:12.61, start: 0.000000, bitrate: 202 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 12.612000
      Metadata:
        title           :
  Stream #0:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 320x240, 80 kb/s, 29.65 fps, 29.97 tbr, 90k tbn (default)
      Metadata:
        creation_time   : 2010-05-11T10:32:06.000000Z
        vendor_id       : [0][0][0][0]
        encoder         : JVT/AVC Coding
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 115 kb/s (default)
      Metadata:
        creation_time   : 2010-05-11T10:32:06.000000Z
        vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Data: bin_data (text / 0x74786574), 0 kb/s
      Metadata:
        creation_time   : 2010-05-11T10:32:06.000000Z
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
ngraziano commented 8 months ago

Hi,

What are you trying to achieve

RtspMultiplexer is an exemple with limited function. For annonce streams, It only supports receiving data on unicast UDP and sending data on one multicast address on UDP.

The sender must use an url with /push/xxx and the receiver must use an url with /pull/xxx and due to udp port assignment the receiver and RtspMultiplexer must not be on same host.

If you need other use case, you must construct your own program.

Coloryr commented 8 months ago

Ok, thanks.