kingslay / KSPlayer

A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, support subtitles.
GNU General Public License v3.0
868 stars 182 forks source link

Unable to view an RTSP stream in included SwiftUI demo #750

Closed PaulAddy closed 3 months ago

PaulAddy commented 3 months ago

Describe the bug When I paste an RTSP URL in your demo, only a black screen appears.

To Reproduce Steps to reproduce the behavior:

  1. Open SwiftUI demo project with Xcode 15.2
  2. Set target simulator to any iOS 17.2 device
  3. Run the Xcode project
  4. Click on Open URL button
  5. Paste the RTSP url, example: rtsp://rtsp-test-server.com:554/stream
  6. Click Done

Expected behavior The playing RTSP video stream

Screenshots If applicable, add screenshots to help explain your problem. Simulator Screenshot - iPhone 15 Pro Max - 2024-03-15 at 11 50 03 Simulator Screenshot - iPhone 15 Pro Max - 2024-03-15 at 11 51 18

Platform (please complete the following information):

Additional context I am simply trying to figure out how to use this library out of the box with the included demo projects. Add any other context about the problem here. or Using FFmpeg to extract problematic video segments and upload them to GitHub.(ffmpeg -i http://xxx.com/123.mkv -map 0 -c copy -ss 00:00:50 -to 00:04:10 1.mkv)

kingslay commented 3 months ago

你可以用我的app (TracyPlayer) 的testflihgt包看下会不会也有这个问题。如果还是有这个问题的话。那你运行下命令。ffmpeg -i rtsp://rtsp-test-server.com:554/stream。 输出下流的信息。然后发出来下。我看下是不是流的格式有问题。

PaulAddy commented 3 months ago

Hi Kingslay,

Here is the ffmpeg output:

$ ffmpeg -i rtsp://rtsp-test-server.com:554/stream
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.1.1_4 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
[rtsp @ 0x1206043c0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, rtsp, from 'rtsp://rtsp-test-server.com:554/stream':
  Metadata:
    title           : No Name
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264, none, 90k tbr, 90k tbn
  Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp
At least one output file must be specified
$

How can I access your TestFlight TraceyApp?

kingslay commented 3 months ago

https://testflight.apple.com/join/eNmYbmZN

PaulAddy commented 3 months ago

Hi Kingsley,

Thanks for the link, I will try to install.

I was able to get more output from the command by adding a video output format, since I am more interested in the video stream. Here is the output:

$ ffmpeg -i rtsp://rtsp-test-server.com:554/stream output.mp4
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.1.1_4 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
[rtsp @ 0x120e05f60] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, rtsp, from 'rtsp://rtsp-test-server.com:554/stream':
  Metadata:
    title           : No Name
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264, none, 90k tbr, 90k tbn
  Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp
Stream mapping:
  Stream #0:1 -> #0:0 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[aost#0:0/aac @ 0x122006350] No filtered frames for output stream, trying to initialize anyway.
Output #0, mp4, to 'output.mp4':
  Metadata:
    title           : No Name
    encoder         : Lavf60.16.100
  Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.31.102 aac
[out#0/mp4 @ 0x600003e843c0] video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[out#0/mp4 @ 0x600003e843c0] Output file is empty, nothing was encoded(check -ss / -t / -frames parameters if used)
size=       0kB time=N/A bitrate=N/A speed=N/A    
[aac @ 0x1220065c0] Qavg: nan
$
PaulAddy commented 3 months ago

@kingslay ,

I installed your TestFlight app, and it is able to stream the rtsp url, see below image of stream. What is missing from the demo project..?

Screenshot 2024-03-15 at 16 31 25
kingslay commented 3 months ago

那就是缺少了一些配置的问题。目前demo跟app store上的代码是不一样的。具体要如何配置rtsp的参数,这个问题属于技术支持。这个项目的技术支持有两个收费方式:

  1. 单次技术支持收费50美元。
  2. 持续每个月捐赠30美元以上。