h264

package
v0.0.0-...-aa897e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package h264 - AVCC format related functions

Package h264 - MPEG4 format related functions

Index

Constants

View Source
const (
	NALUTypePFrame = 1 // Coded slice of a non-IDR picture
	NALUTypeIFrame = 5 // Coded slice of an IDR picture
	NALUTypeSEI    = 6 // Supplemental enhancement information (SEI)
	NALUTypeSPS    = 7 // Sequence parameter set
	NALUTypePPS    = 8 // Picture parameter set
	NALUTypeAUD    = 9 // Access unit delimiter
)
View Source
const (
	ProfileBaseline    = 0x42
	ProfileMain        = 0x4D
	ProfileHigh        = 0x64
	CapabilityBaseline = 0xE0
	CapabilityMain     = 0x40
)

https://developers.google.com/cast/docs/media

View Source
const PSMaxSize = 128 // the biggest SPS I've seen is 48 (EZVIZ CS-CV210)
View Source
const RTPPacketVersionAVC = 0

Variables

This section is empty.

Functions

func AVCCToCodec

func AVCCToCodec(avcc []byte) *core.Codec

func ConfigToCodec

func ConfigToCodec(conf []byte) *core.Codec

func DecodeAnnexB

func DecodeAnnexB(b []byte) []byte

DecodeAnnexB - convert AnnexB to AVC format support unknown separator size

func DecodeConfig

func DecodeConfig(conf []byte) (profile []byte, sps []byte, pps []byte)

DecodeConfig - extract profile, SPS and PPS from MPEG4 config

func DecodeStream deprecated

func DecodeStream(annexb []byte) ([]byte, int)

Deprecated: DecodeStream - find and return first AU in AVC format useful for processing live streams with unknown separator size

func EmitNalus

func EmitNalus(nals []byte, isAVC bool, emit func([]byte))

func EncodeConfig

func EncodeConfig(sps, pps []byte) []byte

func FixPixFmt

func FixPixFmt(sps []byte)

FixPixFmt - change yuvj420p to yuv420p in SPS same as "-c:v copy -bsf:v h264_metadata=video_full_range_flag=0"

func GetFmtpLine

func GetFmtpLine(avc []byte) string

GetFmtpLine from SPS+PPS+IFrame in AVC format

func GetParameterSet

func GetParameterSet(fmtp string) (sps, pps []byte)

func GetProfileLevelID

func GetProfileLevelID(fmtp string) string

GetProfileLevelID - get profile from fmtp line Some devices won't play video with high level, so limit max profile and max level. And return some profile even if fmtp line is empty.

func IndexFrom

func IndexFrom(b []byte, sep []byte, from int) int

func IsKeyframe

func IsKeyframe(b []byte) bool

IsKeyframe - check if any NALU in one AU is Keyframe

func Join

func Join(ps, iframe []byte) []byte

func JoinNALU

func JoinNALU(nalus ...[]byte) (avcc []byte)

func NALUType

func NALUType(b []byte) byte

func NALUTypes

func NALUTypes(avcc []byte) []byte

func RTPDepay

func RTPDepay(codec *core.Codec, handler core.HandlerFunc) core.HandlerFunc

func RTPPay

func RTPPay(mtu uint16, handler core.HandlerFunc) core.HandlerFunc

func RepairAVCC

func RepairAVCC(codec *core.Codec, handler core.HandlerFunc) core.HandlerFunc

func SplitNALU

func SplitNALU(avcc []byte) [][]byte

Types

type Payloader

type Payloader struct {
	IsAVC bool
	// contains filtered or unexported fields
}

Payloader payloads H264 packets

func (*Payloader) Payload

func (p *Payloader) Payload(mtu uint16, payload []byte) [][]byte

Payload fragments a H264 packet across one or more byte arrays

type SPS

type SPS struct {
	// contains filtered or unexported fields
}

func DecodeSPS

func DecodeSPS(sps []byte) *SPS

func (*SPS) Height

func (s *SPS) Height() uint16

func (*SPS) PixFmt

func (s *SPS) PixFmt() string

func (*SPS) Profile

func (s *SPS) Profile() string

func (*SPS) String

func (s *SPS) String() string

func (*SPS) Width

func (s *SPS) Width() uint16

Directories

Path Synopsis
Package annexb - universal for H264 and H265
Package annexb - universal for H264 and H265

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL