Skip to content

Commit

Permalink
fix recording timestamp with some audio codecs (#3969) (#4041) (#4062)
Browse files Browse the repository at this point in the history
When a stream contained an Opus, MPEG-4 audio or AC3 track, timestamp in
the segment file name was increasing at twice the speed.
  • Loading branch information
aler9 authored Dec 21, 2024
1 parent d23fb08 commit f1e031c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/recorder/format_fmp4.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ func (f *formatFMP4) initialize() bool {
Payload: packet,
},
dts: pts,
ntp: tunit.NTP.Add(timestampToDuration(pts, clockRate)),
ntp: tunit.NTP.Add(timestampToDuration(pts-tunit.PTS, clockRate)),
})
if err != nil {
return err
Expand Down Expand Up @@ -649,7 +649,7 @@ func (f *formatFMP4) initialize() bool {
Payload: au,
},
dts: pts,
ntp: tunit.NTP.Add(timestampToDuration(pts, clockRate)),
ntp: tunit.NTP.Add(timestampToDuration(pts-tunit.PTS, clockRate)),
})
if err != nil {
return err
Expand Down Expand Up @@ -771,7 +771,7 @@ func (f *formatFMP4) initialize() bool {
Payload: frame,
},
dts: pts,
ntp: tunit.NTP.Add(timestampToDuration(pts, clockRate)),
ntp: tunit.NTP.Add(timestampToDuration(pts-tunit.PTS, clockRate)),
})
if err != nil {
return err
Expand Down

0 comments on commit f1e031c

Please sign in to comment.