abhiTronix / vidgear

A High-performance cross-platform Video Processing Python framework powerpacked with unique trailblazing features :fire:
https://abhitronix.github.io/vidgear
Apache License 2.0
3.33k stars 253 forks source link

[Bug]: No video shown on RTSP tested with VLC #388

Closed humblemat810 closed 5 months ago

humblemat810 commented 6 months ago

Description

just use any local file stream, open VLC netstream with same RTSP url, tried default download or ffmpeg daily release, both simply vlc not showing anything

Issue Checklist

Expected behaviour

VLC should open a RTSP stream normally

Actual behaviour

Black screen on VLC

Steps to reproduce

  1. on win 10 system change file name to r"path to file"
  2. open VLC change netstream path

Terminal log output

No response

Python Code(Optional)

import cv2
from vidgear.gears import CamGear
from vidgear.gears import WriteGear

# open any valid video stream(for e.g `foo.mp4` file)
stream = CamGear(source=r"C:\Test_videos\BigBuckBunny.mp4").start()

# define required FFmpeg parameters for your writer
output_params = {"-f": "rtsp", "-rtsp_transport": "tcp"} $ also checked udp

# Define writer with defined parameters and RTSP address
# [WARNING] Change your RTSP address `rtsp://localhost:8554/mystream` with yours!
writer = WriteGear(
    output="rtsp://localhost:8554/mystream", logging=True, **output_params
    #, custom_ffmpeg= r'C:\Program Files\ffmpeg-2023-11-15-git-78f55457c9-full_build\bin\ffmpeg.exe'
)

# loop over
while True:

    # read frames from stream
    frame = stream.read()

    # check for frame if Nonetype
    if frame is None:
        break

    # {do something with the frame here}

    # write frame to writer
    writer.write(frame)

# safely close video stream
stream.stop()

# safely close writer
writer.close()

VidGear Version

0.3.2

Python version

3.10

OpenCV version

4.9.0

Operating System version

win 10

Any other Relevant Information?

No response

welcome[bot] commented 6 months ago

Thanks for opening this issue, a maintainer will get back to you shortly!

In the meantime:

abhiTronix commented 5 months ago

@humblemat810 Did you setup a RTSP server first at rtsp://localhost:8554/mystream address? Or even considered reading docs properly first: https://abhitronix.github.io/vidgear/v0.3.1-stable/help/writegear_ex/#using-writegears-compression-mode-for-rtsprtp-live-streaming, Read it properly first and then it will work.