Giter Site home page Giter Site logo

cv2cuda's People

Contributors

antortjim avatar

cv2cuda's Issues

[from SO|kesh] inquiry

Hey @antortjim, this is kesh from SO,

This is a solicitation message, but if you find it useful, I'd be thrilled.

I've been developing a Python FFmpeg package called ffmpegio mostly for my research use (analyses of human voice disorders), but I'm hoping to find others who would use it. It seems like your FFmpeg use case with camera recording matches up well. Below is a quick take on how it could be used with pypylon

from pypylon import pylon
import ffmpegio

camera = pylon.InstantCamera(pylon.TlFactory.GetInstance().CreateFirstDevice())
camera.Open()

# camera setup goes here

with ffmpegio.open(
    "output.mp4", # output file
    "wv",           # mode: video write
    rate_in=45,  # input video framerate
    vsync_in=0, # not sure you need this, but specify input FFmpeg options with '_in' appendix (drop '-' prefix )
    extra_hw_frames_in=2,
    overwrite=True, # sets '-y' flag
    vcodec="h264_nvenc", # output option, just drop '-' prefix.
) as mp4:
    while camera.IsGrabbing():
        grabResult = camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
        if grabResult.GrabSucceeded():
            img = (
                grabResult.GetArrayZeroCopy()
            )  # or GetArray() ?
            # Make sure img shape is [nframes x h x w x ncomp] If grayscale, could be [nframes x h x w]

            mp4.write(img)
            # `-s` and `-pix_fmt` FFmpeg options will be set according to the first frame written

        grabResult.Release()
camera.Close()

Thanks for reading! -Kesh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.