Documentation ¶
Overview ¶
Package mp4read provides for reading MP4
Index ¶
- Variables
- type Mp4read
- func (v *Mp4read) Close() error
- func (v *Mp4read) Duration() int64
- func (v *Mp4read) GetSPSPPS() [][]byte
- func (v *Mp4read) GetVideoTracks() (r []int64)
- func (v *Mp4read) Initialize() error
- func (v *Mp4read) NextSample(out *VideoSampleInfo) error
- func (v *Mp4read) ReadMdatAtSample(info *VideoSampleInfo, buf []byte) (avc []byte, err error)
- func (v *Mp4read) Seek(timestamp int64, force bool) (bool, error)
- func (v *Mp4read) SetVideoTrack(id int64) error
- func (v *Mp4read) TimeDuration() time.Duration
- func (v *Mp4read) Timescale() uint32
- func (v *Mp4read) VideoInfo() (*VideoInfo, error)
- type VideoInfo
- type VideoSampleInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEndOfStream = fmt.Errorf("end of stream")
View Source
var MemoryLimitSampleCapacity int = 4 * 1024 * 1024
mp4 headerの情報をもとにメモリ確保をします。
Functions ¶
This section is empty.
Types ¶
type Mp4read ¶
type Mp4read struct {
// contains filtered or unexported fields
}
func NewFromReadSeeker ¶
func NewFromReadSeeker(r io.ReadSeeker) (*Mp4read, error)
NewFromReadSeeker
mp4を読み込みます。
func (*Mp4read) NextSample ¶
func (v *Mp4read) NextSample(out *VideoSampleInfo) error
NextSample
次のSampleデータを計算してinfoに代入します。終わりに到達するとErrEndOfStreamを返します。
func (*Mp4read) ReadMdatAtSample ¶
func (v *Mp4read) ReadMdatAtSample(info *VideoSampleInfo, buf []byte) (avc []byte, err error)
ReadMdatAtSample
mdatからSampleデータを読み込みます。
func (*Mp4read) Seek ¶
Seek
Timescale()単位の指定時刻より前のIDRに移動
force: true 現在より未来のtimestampでも、現在より過去のIDRに移動。 false 同GOP内で、未来のtimestampなら移動しない。該当したら戻り値はfalse
type VideoInfo ¶
type VideoInfo struct { Width int Height int Duration int64 // Duration() Timescale int64 // Timescale() Samples int // フレーム数 }
VideoInfo
ビデオトラックの情報。
type VideoSampleInfo ¶
type VideoSampleInfo struct { NalLengthSize int // サンプルデータ先頭にある長さ情報のサイズ(byte) TimeDelta uint32 // サンプルの再生時間 Number int64 // サンプルの番号。フレーム番号ではない。 CompositionTime int64 // 1サンプル目を0とした時の再生時刻 // contains filtered or unexported fields }
VideoSampleInfo
ビデオのサンプル情報。ReadMdatAtSampleに渡すとサンプルデータを取得できる。
Click to show internal directories.
Click to hide internal directories.