diff --git a/pkg/formats/fmp4/init_track.go b/pkg/formats/fmp4/init_track.go index e5f1cc4..5083d6a 100644 --- a/pkg/formats/fmp4/init_track.go +++ b/pkg/formats/fmp4/init_track.go @@ -96,6 +96,10 @@ func (track *InitTrack) marshal(w *mp4Writer) error { height = av1SequenceHeader.Height() case *CodecVP9: + if codec.Width == 0 { + return fmt.Errorf("VP9 parameters not provided") + } + width = codec.Width height = codec.Height @@ -120,16 +124,28 @@ func (track *InitTrack) marshal(w *mp4Writer) error { height = h264SPS.Height() case *CodecMPEG4Video: + if len(codec.Config) == 0 { + return fmt.Errof("MPEG-4 Video config not provided") + } + // TODO: parse config and use real values width = 800 height = 600 case *CodecMPEG1Video: + if len(codec.Config) == 0 { + return fmt.Errof("MPEG-1/2 Video config not provided") + } + // TODO: parse config and use real values width = 800 height = 600 case *CodecMJPEG: + if codec.Width == 0 { + return fmt.Errorf("M-JPEG parameters not provided") + } + width = codec.Width height = codec.Height }