Comments (7)
I am trying to make a yolo detector using mp4 video or real time camera. I am trying to speed up my pipeline because the fps of the model is much higher than the video and the fps marked. How can I use hardware e.g. nvdec and nvenc to encode and decode the video?
I have opencv and ffmpeg with cuda. The device is a jetson agx orin
@johnnynunez Don't use OpenCV for video IO, but FFmpeg directly which supports both nvenc and nvenc to encode and decode the video. For this purpose, You could use my deffcode library instead which will be integrated soon in #148. The complete HW transcoding example is given in this docs: https://abhitronix.github.io/deffcode/latest/recipes/advanced/transcode-hw-acceleration/#hardware-accelerated-video-transcoding
Goodluck!
from vidgear.
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.
from vidgear.
I am trying to make a yolo detector using mp4 video or real time camera. I am trying to speed up my pipeline because the fps of the model is much higher than the video and the fps marked. How can I use hardware e.g. nvenc and nvenc to encode and decode the video?
I have opencv and ffmpeg with cuda. The device is a jetson agx orin@johnnynunez Don't use OpenCV for video IO, but FFmpeg directly which supports both nvenc and nvenc to encode and decode the video. For this purpose, You could use my deffcode library instead which will be integrated soon in #148. The complete HW transcoding example is given in this docs: https://abhitronix.github.io/deffcode/latest/recipes/advanced/transcode-hw-acceleration/#hardware-accelerated-video-transcoding
Goodluck!
but Does it have threaded-queue-mode too?? https://abhitronix.github.io/vidgear/v0.3.2-stable/bonus/TQM/#threaded-queue-mode
class FrameCapture:
def __init__(self, source=0, stabilize=False, stream_mode=False, logging=False):
self.source = source
if isinstance(self.source, int):
# Use CamGear for optimized live stream handling
self.vcap = CamGear(source=self.source, stream_mode=stream_mode, logging=logging)
height, width, _ = self.vcap.frame.shape
self.fps = self.vcap.framerate
else:
# Use VideoGear for general video file handling
self.vcap = VideoGear(source=self.source, stabilize=stabilize, stream_mode=stream_mode, logging=logging)
height, width, _ = self.vcap.stream.frame.shape
self.fps = self.vcap.stream.framerate
self.video_info = sv.VideoInfo.from_video_path(self.source)
self.frame_count = 0
self.frame_size = (width, height)
self.stopped = False
def start(self):
self.stopped = False
self.vcap.start()
def read(self):
if not self.stopped:
frame = self.vcap.read()
if frame is None:
self.stop()
return None
self.frame_count += 1
return frame
return None
def get_frame_count(self):
return self.frame_count
def get_fps(self):
return self.fps
def get_frame_size(self):
return self.frame_size
def get_stop(self):
return self.stopped
def stop(self):
# Safely close the video stream
self.frame_count = 0
# self.vcap.release()
self.vcap.stop()
self.stopped = True
if __name__ == '__main__':
# Example usage:
stream = FrameCapture(0) # 0 for default webcam
stream.start()
try:
input("Press Enter to stop...")
finally:
stream.stop()
print("Exiting program")
from vidgear.
You don't need multi-threading here.
from vidgear.
You don't need multi-threading here.
and deffcode uses queue? Or only decoding?
from vidgear.
and deffcode uses queue? Or only decoding?
@johnnynunez No queue, just decoding. You could learn more about it here: https://abhitronix.github.io/deffcode/latest/recipes/advanced/decode-hw-acceleration/#hardware-accelerated-video-decoding
from vidgear.
and deffcode uses queue? Or only decoding?
@johnnynunez No queue, just decoding. You could learn more about it here: https://abhitronix.github.io/deffcode/latest/recipes/advanced/decode-hw-acceleration/#hardware-accelerated-video-decoding
Yeah it is working for me
from vidgear.
Related Issues (20)
- Exception in thread NetGear, zmq.error.Again: Resource temporarily unavailable HOT 8
- [Question]: looping? HOT 2
- [Bug]: Freezes video thread when processing background thread? HOT 5
- [Bug]: Logging issue with yt-dlp HOT 3
- [Proposal]: -vcodec copy HLS HOT 15
- [Proposal]: Deprecate `on_startup` and `on_shutdown` in favor of `lifespan` HOT 1
- [Bug]: update pyzmq version HOT 4
- [Question]: There is a problem with the thread HOT 6
- [Bug]: WebGear throws error 500: context must include a "request" key HOT 4
- [Question]: Client-server issues using Linux and Windows HOT 3
- [Question]: How to use our project as RTSP Server based on local usb camera? HOT 3
- [Proposal]: Make `simplejpeg` an Optional Dependency in WebGear API
- [Bug]: `simplejpeg` Incompatibility with `numpy` Version `>= 2.0.0` HOT 2
- [Proposal]: Add SRTP/RTSPS compatibility HOT 2
- [Proposal]: Change PiGear to have a blocking `read()` function HOT 2
- [Bug]: WriteGear().write causes python process to terminate HOT 3
- [Question]: Using streamgear with webgear HOT 4
- [Bug]: Stabilization not good on linux environment HOT 3
- "setuptools" and "pkg_resources" usage HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vidgear.