Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: How to use our project as RTSP Server based on local usb camera? #405

Closed
4 tasks done
wynshiter opened this issue Jun 14, 2024 · 3 comments
Closed
4 tasks done
Labels
ANSWERED IN DOCS 📖 Already answered in our Docs! QUESTION ❓ User asked about the working/usage of VidGear APIs.

Comments

@wynshiter
Copy link

Issue guidelines

Issue Checklist

  • I have searched open or closed issues for my problem and found nothing related or helpful.
  • I have read the Documentation and found nothing related to my problem.
  • I have gone through the Bonus Examples and FAQs and found nothing related or helpful.

Describe your Question

How to use our project as RTSP Server based on local usb camera?
There is a USB camera on my Windows server, and I want to convert the images it collects into RTSP or other webRTC and publish them. I saw an example of webRTC, but I couldn't find the RTSP example. I hope you can guide me

Terminal log output(Optional)

No response

Python Code(Optional)

No response

VidGear Version

latest

Python version

3.10

Operating System version

windows10

Any other Relevant Information?

No response

@wynshiter wynshiter added the QUESTION ❓ User asked about the working/usage of VidGear APIs. label Jun 14, 2024
Copy link

welcome bot commented Jun 14, 2024

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

In the meantime:

  • Read our Issue Guidelines, and update your issue accordingly. Please note that your issue will be fixed much faster if you spend about half an hour preparing it, including the exact reproduction steps and a demo.
  • Go comprehensively through our dedicated FAQ & Troubleshooting section.
  • For any quick questions and typos, please refrain from opening an issue, as you can reach us on Gitter community channel.

@abhiTronix abhiTronix added the ANSWERED IN DOCS 📖 Already answered in our Docs! label Jun 14, 2024
@wynshiter
Copy link
Author

thanks for the guide

# import required libraries
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=0).start()

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

# Define writer with defined parameters and RTSP address
# [WARNING] Change your RTSP address `rtsp://localhost:8554/mystream` with yours!

writer = WriteGear(
    output="localhost:8554",logging=True,custom_ffmpeg=r"D:/code/c++/myyolo/streaming/ffmpeg",**output_params
)

# 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()

this code may cause bug , when i change output to rtsp://localhost:8554/mystream, i think custom_ffmpeg=r"D:/code/c++/myyolo/streaming/ffmpeg" may cause the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ANSWERED IN DOCS 📖 Already answered in our Docs! QUESTION ❓ User asked about the working/usage of VidGear APIs.
Projects
None yet
Development

No branches or pull requests

2 participants