Documentation ¶
Index ¶
- func Read(filename string) (int, int, []byte, error)
- func Write(filename string, width, height int, data []byte) error
- type Camera
- func (camera *Camera) Close()
- func (camera *Camera) Codec() string
- func (camera *Camera) Depth() int
- func (camera *Camera) FPS() float64
- func (camera *Camera) FrameBuffer() []byte
- func (camera *Camera) Height() int
- func (camera *Camera) Name() string
- func (camera *Camera) Read() bool
- func (camera *Camera) SetFrameBuffer(buffer []byte)
- func (camera *Camera) Width() int
- type Options
- type Video
- func (video *Video) AudioCodec() string
- func (video *Video) Bitrate() int
- func (video *Video) Close()
- func (video *Video) Codec() string
- func (video *Video) Depth() int
- func (video *Video) Duration() float64
- func (video *Video) FPS() float64
- func (video *Video) FileName() string
- func (video *Video) FrameBuffer() []byte
- func (video *Video) Frames() int
- func (video *Video) Height() int
- func (video *Video) Read() bool
- func (video *Video) SetFrameBuffer(buffer []byte)
- func (video *Video) Width() int
- type VideoWriter
- func (writer *VideoWriter) AudioCodec() string
- func (writer *VideoWriter) Bitrate() int
- func (writer *VideoWriter) Close()
- func (writer *VideoWriter) Codec() string
- func (writer *VideoWriter) Delay() int
- func (writer *VideoWriter) FPS() float64
- func (writer *VideoWriter) FileName() string
- func (writer *VideoWriter) Height() int
- func (writer *VideoWriter) Loop() int
- func (writer *VideoWriter) Macro() int
- func (writer *VideoWriter) Quality() float64
- func (writer *VideoWriter) Width() int
- func (writer *VideoWriter) Write(frame []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
func NewCamera ¶
Creates a new camera struct that can read from the device with the given stream index.
func (*Camera) FrameBuffer ¶
func (*Camera) SetFrameBuffer ¶ added in v1.1.0
Sets the framebuffer to the given byte array. Note that "buffer" must be large enough to store one frame of video data which is width*height*3.
type Options ¶
type Options struct { Bitrate int // Bitrate. Loop int // For GIFs only. -1=no loop, 0=infinite loop, >0=number of loops. Delay int // Delay for final frame of GIFs. Macro int // Macroblock size for determining how to resize frames for codecs. FPS float64 // Frames per second for output video. Quality float64 // If bitrate not given, use quality instead. Must be between 0 and 1. 0:best, 1:worst. Codec string // Codec for video. Audio string // File path for audio. If no audio, audio="". AudioCodec string // Codec for audio. }
Optional parameters for VideoWriter.
type Video ¶
type Video struct {
// contains filtered or unexported fields
}
func NewVideo ¶
Creates a new Video struct. Uses ffprobe to get video information and fills in the Video struct with this data.
func (*Video) AudioCodec ¶
func (*Video) FrameBuffer ¶
func (*Video) Read ¶
Reads the next frame from the video and stores in the framebuffer. If the last frame has been read, returns false, otherwise true.
func (*Video) SetFrameBuffer ¶ added in v1.1.0
Sets the framebuffer to the given byte array. Note that "buffer" must be large enough to store one frame of video data which is width*height*3.
type VideoWriter ¶
type VideoWriter struct {
// contains filtered or unexported fields
}
func NewVideoWriter ¶
func NewVideoWriter(filename string, width, height int, options *Options) (*VideoWriter, error)
Creates a new VideoWriter struct with default values from the Options struct.
func (*VideoWriter) AudioCodec ¶
func (writer *VideoWriter) AudioCodec() string
func (*VideoWriter) Bitrate ¶
func (writer *VideoWriter) Bitrate() int
func (*VideoWriter) Close ¶
func (writer *VideoWriter) Close()
Closes the pipe and stops the ffmpeg process.
func (*VideoWriter) Codec ¶
func (writer *VideoWriter) Codec() string
func (*VideoWriter) Delay ¶
func (writer *VideoWriter) Delay() int
func (*VideoWriter) FPS ¶
func (writer *VideoWriter) FPS() float64
func (*VideoWriter) FileName ¶
func (writer *VideoWriter) FileName() string
func (*VideoWriter) Height ¶
func (writer *VideoWriter) Height() int
func (*VideoWriter) Loop ¶
func (writer *VideoWriter) Loop() int
func (*VideoWriter) Macro ¶
func (writer *VideoWriter) Macro() int
func (*VideoWriter) Quality ¶
func (writer *VideoWriter) Quality() float64
func (*VideoWriter) Width ¶
func (writer *VideoWriter) Width() int
func (*VideoWriter) Write ¶
func (writer *VideoWriter) Write(frame []byte) error
Writes the given frame to the video file.