Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/more video statistics and optional nalu printout #9

Merged
merged 10 commits into from
Jan 19, 2024
Prev Previous commit
Next Next commit
chore: rename variables
  • Loading branch information
Wkkkkk committed Jan 18, 2024
commit d26d52a0b4adab87eba7877252416f70f522d5f6
2 changes: 1 addition & 1 deletion cmd/ts-info/app/testdata/golden_bbb_1s.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
{"pid":256,"parameterSet":"PPS","nr":0,"hex":"68ebecb22c","length":5}
{"pid":256,"rai":true,"pts":223500,"dts":216000,"nalus":[{"type":"AUD_9","len":2},{"type":"SPS_7","len":26},{"type":"PPS_8","len":5},{"type":"IDR_5","len":12975}]}
{"pid":256,"rai":false,"pts":234750,"dts":219750,"nalus":[{"type":"AUD_9","len":2},{"type":"NonIDR_1","len":24332}]}
{"streamType":"AVC","pid":256,"frameRate":23.04147465437788,"maxStep":7500,"minStep":3750,"avgStep":3906,"RAIGopDuration":1,"IDRGopDuration":1,"errors":["PTS/DTS steps are not constant"]}
{"streamType":"AVC","pid":256,"frameRate":23.04147465437788,"maxStep":7500,"minStep":3750,"avgStep":3906,"RAIGoPDuration":1,"IDRGoPDuration":1,"errors":["PTS/DTS steps are not constant"]}
2 changes: 1 addition & 1 deletion cmd/ts-info/app/testdata/golden_obs_h265_aac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
{"pid":256,"rai":false,"pts":97920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":400}]}
{"pid":256,"rai":false,"pts":100920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":293}]}
{"pid":256,"rai":false,"pts":103920,"nalus":[{"type":"AUD_35","len":3},{"type":"NonRAP_Trail_1","len":566}]}
{"streamType":"HEVC","pid":256,"frameRate":30,"RAIGopDuration":1,"IDRGopDuration":1}
{"streamType":"HEVC","pid":256,"frameRate":30,"RAIGoPDuration":1,"IDRGoPDuration":1}
10 changes: 5 additions & 5 deletions cmd/ts-info/app/video.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ type streamStatistics struct {
// RAI-markers
RAIPTS []int64 `json:"-"`
IDRPTS []int64 `json:"-"`
RAIGOPDuration int64 `json:"RAIGopDuration,omitempty"`
IDRGOPDuration int64 `json:"IDRGopDuration,omitempty"`
RAIGOPDuration int64 `json:"RAIGoPDuration,omitempty"`
IDRGOPDuration int64 `json:"IDRGoPDuration,omitempty"`
// Errors
Errors []string `json:"errors,omitempty"`
}
Expand Down Expand Up @@ -107,8 +107,8 @@ func (s *streamStatistics) calculateFrameRate(timescale int64) {
// dataRange must be monotonically increasing
if !isMonotonicallyIncreasing {
s.Errors = append(s.Errors, "PTS/DTS steps are not monotonically increasing")
fmt.Printf("DataRange: %v\n", dataRange)
fmt.Printf("Steps: %v\n", steps)
// fmt.Printf("DataRange: %v\n", dataRange)
// fmt.Printf("Steps: %v\n", steps)
return
}

Expand All @@ -125,7 +125,7 @@ func (s *streamStatistics) calculateFrameRate(timescale int64) {
}

func (s *streamStatistics) calculateGoPDuration(timescale int64) {
if len(s.RAIPTS) < 2 && len(s.IDRPTS) < 2 {
if len(s.RAIPTS) < 2 || len(s.IDRPTS) < 2 {
s.Errors = append(s.Errors, "Not enough PTS steps to calculate GOP duration")
return
}
Expand Down
Loading