Skip to content

Snapshot continuously generates pictures by video frame #143

Closed
@lgcshy

Description

@lgcshy

Hello! I'd like to ask about the snapshot example about generating pictures. I plan to save every frame of the video stream from the camera to a directory on the server. Do I just need to use io. Writer writes bytes to os. File object is fine. Delete the return code below:
`// Encode to (RGB) jpeg
buffer := new(bytes.Buffer)
if err = jpeg.Encode(buffer, img, nil); err != nil {
panic(err)
}

            // Serve image
            w.Header().Set("Content-Type", "image/jpeg")
            w.Header().Set("Content-Length", strconv.Itoa(len(buffer.Bytes())))

            // Write jpeg as HTTP Response
            if _, err = w.Write(buffer.Bytes()); err != nil {
                    panic(err)
            }
            return`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions