Repository: bluenviron/gortsplib
Pull request #695 (2025-02-10 10:52:03)

switch to mediacommon/v2

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/bluenviron/gortsplib/pull/695?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bluenviron) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 82.03%. Comparing base [(`4779b35`)](https://app.codecov.io/gh/bluenviron/gortsplib/commit/4779b35c23f20e55904bdad65d7dcf5796e78b75?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bluenviron) to head [(`5c47ea2`)](https://app.codecov.io/gh/bluenviron/gortsplib/commit/5c47ea2596f6813ef28572d31261ea577e136d14?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bluenviron).

<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main     #695   +/-   ##
=======================================
  Coverage   82.03%   82.03%           
=======================================
  Files         120      120           
  Lines       12468    12468           
=======================================
  Hits        10228    10228           
  Misses       1823     1823           
  Partials      417      417           
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/bluenviron/gortsplib/pull/695?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bluenviron).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bluenviron).


Patch:
diff --git a/examples/client-play-format-h264-convert-to-jpeg/main.go b/examples/client-play-format-h264-convert-to-jpeg/main.go
index 0d71ac02..08f66a53 100644
--- a/examples/client-play-format-h264-convert-to-jpeg/main.go
+++ b/examples/client-play-format-h264-convert-to-jpeg/main.go
@@ -14,7 +14,7 @@ import (
 	"github.com/bluenviron/gortsplib/v4/pkg/base"
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
 	"github.com/bluenviron/gortsplib/v4/pkg/format/rtph264"
-	"github.com/bluenviron/mediacommon/pkg/codecs/h264"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
 	"github.com/pion/rtp"
 )
 
@@ -117,7 +117,7 @@ func main() {
 
 		// wait for an I-frame
 		if !iframeReceived {
-			if !h264.IDRPresent(au) {
+			if !h264.IsRandomAccess(au) {
 				log.Printf("waiting for an I-frame")
 				return
 			}
diff --git a/examples/client-play-format-h264-mpeg4audio-save-to-disk/mpegts_muxer.go b/examples/client-play-format-h264-mpeg4audio-save-to-disk/mpegts_muxer.go
index 4f14e8b1..7bbc5ae2 100644
--- a/examples/client-play-format-h264-mpeg4audio-save-to-disk/mpegts_muxer.go
+++ b/examples/client-play-format-h264-mpeg4audio-save-to-disk/mpegts_muxer.go
@@ -6,8 +6,8 @@ import (
 	"sync"
 
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
-	"github.com/bluenviron/mediacommon/pkg/codecs/h264"
-	"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
+	"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
 )
 
 func multiplyAndDivide(v, m, d int64) int64 {
@@ -27,7 +27,7 @@ type mpegtsMuxer struct {
 	w               *mpegts.Writer
 	h264Track       *mpegts.Track
 	mpeg4AudioTrack *mpegts.Track
-	dtsExtractor    *h264.DTSExtractor2
+	dtsExtractor    *h264.DTSExtractor
 	mutex           sync.Mutex
 }
 
@@ -111,7 +111,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
 		if !idrPresent {
 			return nil
 		}
-		e.dtsExtractor = h264.NewDTSExtractor2()
+		e.dtsExtractor = h264.NewDTSExtractor()
 	}
 
 	dts, err := e.dtsExtractor.Extract(au, pts)
@@ -120,7 +120,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
 	}
 
 	// encode into MPEG-TS
-	return e.w.WriteH264(e.h264Track, pts, dts, idrPresent, au)
+	return e.w.WriteH264(e.h264Track, pts, dts, au)
 }
 
 // writeMPEG4Audio writes MPEG-4 audio access units into MPEG-TS.
diff --git a/examples/client-play-format-h264-save-to-disk/mpegts_muxer.go b/examples/client-play-format-h264-save-to-disk/mpegts_muxer.go
index 475b8e80..1bc8a928 100644
--- a/examples/client-play-format-h264-save-to-disk/mpegts_muxer.go
+++ b/examples/client-play-format-h264-save-to-disk/mpegts_muxer.go
@@ -4,8 +4,8 @@ import (
 	"bufio"
 	"os"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h264"
-	"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
+	"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
 )
 
 // mpegtsMuxer allows to save a H264 stream into a MPEG-TS file.
@@ -18,7 +18,7 @@ type mpegtsMuxer struct {
 	b            *bufio.Writer
 	w            *mpegts.Writer
 	track        *mpegts.Track
-	dtsExtractor *h264.DTSExtractor2
+	dtsExtractor *h264.DTSExtractor
 }
 
 // initialize initializes a mpegtsMuxer.
@@ -92,7 +92,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
 		if !idrPresent {
 			return nil
 		}
-		e.dtsExtractor = h264.NewDTSExtractor2()
+		e.dtsExtractor = h264.NewDTSExtractor()
 	}
 
 	dts, err := e.dtsExtractor.Extract(au, pts)
@@ -101,5 +101,5 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
 	}
 
 	// encode into MPEG-TS
-	return e.w.WriteH264(e.track, pts, dts, idrPresent, au)
+	return e.w.WriteH264(e.track, pts, dts, au)
 }
diff --git a/examples/client-play-format-h265-convert-to-jpeg/main.go b/examples/client-play-format-h265-convert-to-jpeg/main.go
index 488b4786..0e90bc2a 100644
--- a/examples/client-play-format-h265-convert-to-jpeg/main.go
+++ b/examples/client-play-format-h265-convert-to-jpeg/main.go
@@ -14,7 +14,7 @@ import (
 	"github.com/bluenviron/gortsplib/v4/pkg/base"
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
 	"github.com/bluenviron/gortsplib/v4/pkg/format/rtph265"
-	"github.com/bluenviron/mediacommon/pkg/codecs/h265"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
 	"github.com/pion/rtp"
 )
 
diff --git a/examples/client-play-format-h265-save-to-disk/mpegts_muxer.go b/examples/client-play-format-h265-save-to-disk/mpegts_muxer.go
index 7c0bfc1c..98d50728 100644
--- a/examples/client-play-format-h265-save-to-disk/mpegts_muxer.go
+++ b/examples/client-play-format-h265-save-to-disk/mpegts_muxer.go
@@ -4,8 +4,8 @@ import (
 	"bufio"
 	"os"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h265"
-	"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
+	"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
 )
 
 // mpegtsMuxer allows to save a H265 stream into a MPEG-TS file.
@@ -19,7 +19,7 @@ type mpegtsMuxer struct {
 	b            *bufio.Writer
 	w            *mpegts.Writer
 	track        *mpegts.Track
-	dtsExtractor *h265.DTSExtractor2
+	dtsExtractor *h265.DTSExtractor
 }
 
 // initialize initializes a mpegtsMuxer.
@@ -93,7 +93,7 @@ func (e *mpegtsMuxer) writeH265(au [][]byte, pts int64) error {
 		if !isRandomAccess {
 			return nil
 		}
-		e.dtsExtractor = h265.NewDTSExtractor2()
+		e.dtsExtractor = h265.NewDTSExtractor()
 	}
 
 	dts, err := e.dtsExtractor.Extract(au, pts)
@@ -102,5 +102,5 @@ func (e *mpegtsMuxer) writeH265(au [][]byte, pts int64) error {
 	}
 
 	// encode into MPEG-TS
-	return e.w.WriteH265(e.track, pts, dts, isRandomAccess, au)
+	return e.w.WriteH265(e.track, pts, dts, au)
 }
diff --git a/examples/client-play-format-mpeg4audio-save-to-disk/main.go b/examples/client-play-format-mpeg4audio-save-to-disk/main.go
index 956b3b06..8bbf405e 100644
--- a/examples/client-play-format-mpeg4audio-save-to-disk/main.go
+++ b/examples/client-play-format-mpeg4audio-save-to-disk/main.go
@@ -6,7 +6,7 @@ import (
 	"github.com/bluenviron/gortsplib/v4"
 	"github.com/bluenviron/gortsplib/v4/pkg/base"
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
-	"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
+	"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
 	"github.com/pion/rtp"
 )
 
diff --git a/examples/client-play-format-mpeg4audio-save-to-disk/mpegts_muxer.go b/examples/client-play-format-mpeg4audio-save-to-disk/mpegts_muxer.go
index 67316b7d..c9726db6 100644
--- a/examples/client-play-format-mpeg4audio-save-to-disk/mpegts_muxer.go
+++ b/examples/client-play-format-mpeg4audio-save-to-disk/mpegts_muxer.go
@@ -5,7 +5,7 @@ import (
 	"os"
 
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
-	"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
+	"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
 )
 
 func multiplyAndDivide(v, m, d int64) int64 {
diff --git a/examples/client-play-format-opus-save-to-disk/main.go b/examples/client-play-format-opus-save-to-disk/main.go
index 94c17a15..40946f56 100644
--- a/examples/client-play-format-opus-save-to-disk/main.go
+++ b/examples/client-play-format-opus-save-to-disk/main.go
@@ -6,7 +6,7 @@ import (
 	"github.com/bluenviron/gortsplib/v4"
 	"github.com/bluenviron/gortsplib/v4/pkg/base"
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
-	"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
+	"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
 	"github.com/pion/rtp"
 )
 
diff --git a/examples/client-play-format-opus-save-to-disk/mpegts_muxer.go b/examples/client-play-format-opus-save-to-disk/mpegts_muxer.go
index f32fa04f..ce65c179 100644
--- a/examples/client-play-format-opus-save-to-disk/mpegts_muxer.go
+++ b/examples/client-play-format-opus-save-to-disk/mpegts_muxer.go
@@ -5,7 +5,7 @@ import (
 	"os"
 
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
-	"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
+	"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
 )
 
 func multiplyAndDivide(v, m, d int64) int64 {
diff --git a/examples/client-record-format-h264-from-disk/main.go b/examples/client-record-format-h264-from-disk/main.go
index 9ee202fa..763b6ffa 100644
--- a/examples/client-record-format-h264-from-disk/main.go
+++ b/examples/client-record-format-h264-from-disk/main.go
@@ -10,7 +10,7 @@ import (
 	"github.com/bluenviron/gortsplib/v4"
 	"github.com/bluenviron/gortsplib/v4/pkg/description"
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
-	"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
+	"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
 )
 
 // This example shows how to
@@ -88,7 +88,7 @@ func main() {
 		panic(err)
 	}
 
-	timeDecoder := mpegts.NewTimeDecoder2()
+	timeDecoder := mpegts.NewTimeDecoder()
 	var firstDTS *int64
 	var startTime time.Time
 
diff --git a/examples/client-record-format-mpeg4audio/main.go b/examples/client-record-format-mpeg4audio/main.go
index bbb1d27e..6f24c759 100644
--- a/examples/client-record-format-mpeg4audio/main.go
+++ b/examples/client-record-format-mpeg4audio/main.go
@@ -7,7 +7,7 @@ import (
 	"github.com/bluenviron/gortsplib/v4"
 	"github.com/bluenviron/gortsplib/v4/pkg/description"
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
 	"github.com/pion/rtp"
 )
 
diff --git a/examples/server-h264-save-to-disk/mpegts_muxer.go b/examples/server-h264-save-to-disk/mpegts_muxer.go
index 278ff2f9..9b9cbb72 100644
--- a/examples/server-h264-save-to-disk/mpegts_muxer.go
+++ b/examples/server-h264-save-to-disk/mpegts_muxer.go
@@ -4,8 +4,8 @@ import (
 	"bufio"
 	"os"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h264"
-	"github.com/bluenviron/mediacommon/pkg/formats/mpegts"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
+	"github.com/bluenviron/mediacommon/v2/pkg/formats/mpegts"
 )
 
 // mpegtsMuxer allows to save a H264 stream into a MPEG-TS file.
@@ -18,7 +18,7 @@ type mpegtsMuxer struct {
 	b            *bufio.Writer
 	w            *mpegts.Writer
 	track        *mpegts.Track
-	dtsExtractor *h264.DTSExtractor2
+	dtsExtractor *h264.DTSExtractor
 }
 
 // initialize initializes a mpegtsMuxer.
@@ -92,7 +92,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
 		if !idrPresent {
 			return nil
 		}
-		e.dtsExtractor = h264.NewDTSExtractor2()
+		e.dtsExtractor = h264.NewDTSExtractor()
 	}
 
 	dts, err := e.dtsExtractor.Extract(au, pts)
@@ -101,5 +101,5 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts int64) error {
 	}
 
 	// encode into MPEG-TS
-	return e.w.WriteH265(e.track, pts, dts, idrPresent, au)
+	return e.w.WriteH265(e.track, pts, dts, au)
 }
diff --git a/go.mod b/go.mod
index f3e9b91b..fc840bae 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module github.com/bluenviron/gortsplib/v4
 go 1.21.0
 
 require (
-	github.com/bluenviron/mediacommon v1.14.0
+	github.com/bluenviron/mediacommon/v2 v2.0.0
 	github.com/google/uuid v1.6.0
 	github.com/pion/rtcp v1.2.15
 	github.com/pion/rtp v1.8.11
diff --git a/go.sum b/go.sum
index 71f7be94..386c137d 100644
--- a/go.sum
+++ b/go.sum
@@ -2,8 +2,8 @@ github.com/asticode/go-astikit v0.30.0 h1:DkBkRQRIxYcknlaU7W7ksNfn4gMFsB0tqMJflx
 github.com/asticode/go-astikit v0.30.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0=
 github.com/asticode/go-astits v1.13.0 h1:XOgkaadfZODnyZRR5Y0/DWkA9vrkLLPLeeOvDwfKZ1c=
 github.com/asticode/go-astits v1.13.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega3LPWz3ND/iI=
-github.com/bluenviron/mediacommon v1.14.0 h1:lWCwOBKNKgqmspRpwpvvg3CidYm+XOc2+z/Jw7LM5dQ=
-github.com/bluenviron/mediacommon v1.14.0/go.mod h1:z5LP9Tm1ZNfQV5Co54PyOzaIhGMusDfRKmh42nQSnyo=
+github.com/bluenviron/mediacommon/v2 v2.0.0 h1:JinZ9v2x6QeAOzA0cDA6aFe8vQuCrU8OyWEhG2iNzwY=
+github.com/bluenviron/mediacommon/v2 v2.0.0/go.mod h1:iHEz1SFIet6zBwAQoh1a92vTQ3dV3LpVFbom6/SLz3k=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
diff --git a/pkg/format/h264.go b/pkg/format/h264.go
index 3709df41..87115b9c 100644
--- a/pkg/format/h264.go
+++ b/pkg/format/h264.go
@@ -12,7 +12,7 @@ import (
 	"github.com/pion/rtp"
 
 	"github.com/bluenviron/gortsplib/v4/pkg/format/rtph264"
-	"github.com/bluenviron/mediacommon/pkg/codecs/h264"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
 )
 
 // H264 is the RTP format for the H264 codec.
diff --git a/pkg/format/h265.go b/pkg/format/h265.go
index 2ad9cb78..39931903 100644
--- a/pkg/format/h265.go
+++ b/pkg/format/h265.go
@@ -7,7 +7,7 @@ import (
 	"strconv"
 	"sync"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h265"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
 	"github.com/pion/rtp"
 
 	"github.com/bluenviron/gortsplib/v4/pkg/format/rtph265"
diff --git a/pkg/format/mpeg4_audio.go b/pkg/format/mpeg4_audio.go
index ff54b79a..91c8b730 100644
--- a/pkg/format/mpeg4_audio.go
+++ b/pkg/format/mpeg4_audio.go
@@ -6,7 +6,7 @@ import (
 	"strconv"
 	"strings"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
 	"github.com/pion/rtp"
 
 	"github.com/bluenviron/gortsplib/v4/pkg/format/rtpmpeg4audio"
diff --git a/pkg/format/mpeg4_video.go b/pkg/format/mpeg4_video.go
index 9874220c..8c09bf18 100644
--- a/pkg/format/mpeg4_video.go
+++ b/pkg/format/mpeg4_video.go
@@ -7,7 +7,7 @@ import (
 	"strings"
 	"sync"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4video"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4video"
 	"github.com/pion/rtp"
 
 	"github.com/bluenviron/gortsplib/v4/pkg/format/rtpmpeg4video"
diff --git a/pkg/format/rtpac3/decoder.go b/pkg/format/rtpac3/decoder.go
index 45f73bdd..60bce298 100644
--- a/pkg/format/rtpac3/decoder.go
+++ b/pkg/format/rtpac3/decoder.go
@@ -6,7 +6,7 @@ import (
 
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/ac3"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/ac3"
 )
 
 // ErrMorePacketsNeeded is returned when more packets are needed.
diff --git a/pkg/format/rtpac3/encoder.go b/pkg/format/rtpac3/encoder.go
index b6d4eade..6f4e34a7 100644
--- a/pkg/format/rtpac3/encoder.go
+++ b/pkg/format/rtpac3/encoder.go
@@ -5,7 +5,7 @@ import (
 
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/ac3"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/ac3"
 )
 
 const (
diff --git a/pkg/format/rtpav1/decoder.go b/pkg/format/rtpav1/decoder.go
index b744e904..020db078 100644
--- a/pkg/format/rtpav1/decoder.go
+++ b/pkg/format/rtpav1/decoder.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"fmt"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/av1"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/av1"
 	"github.com/pion/rtp"
 	"github.com/pion/rtp/codecs"
 )
diff --git a/pkg/format/rtpav1/encoder.go b/pkg/format/rtpav1/encoder.go
index 876d5d94..148990ad 100644
--- a/pkg/format/rtpav1/encoder.go
+++ b/pkg/format/rtpav1/encoder.go
@@ -3,7 +3,7 @@ package rtpav1
 import (
 	"crypto/rand"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/av1"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/av1"
 	"github.com/pion/rtp"
 )
 
@@ -69,7 +69,7 @@ func (e *Encoder) Init() error {
 
 // Encode encodes OBUs into RTP packets.
 func (e *Encoder) Encode(obus [][]byte) ([]*rtp.Packet, error) {
-	isKeyFrame, err := av1.ContainsKeyFrame(obus)
+	isKeyFrame, err := av1.IsRandomAccess(obus)
 	if err != nil {
 		return nil, err
 	}
diff --git a/pkg/format/rtph264/decoder.go b/pkg/format/rtph264/decoder.go
index 57692ef5..19567f34 100644
--- a/pkg/format/rtph264/decoder.go
+++ b/pkg/format/rtph264/decoder.go
@@ -7,7 +7,7 @@ import (
 
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h264"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
 )
 
 // ErrMorePacketsNeeded is returned when more packets are needed.
diff --git a/pkg/format/rtph264/encoder.go b/pkg/format/rtph264/encoder.go
index 4268585b..55938ea2 100644
--- a/pkg/format/rtph264/encoder.go
+++ b/pkg/format/rtph264/encoder.go
@@ -6,7 +6,7 @@ import (
 
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h264"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
 )
 
 const (
diff --git a/pkg/format/rtph265/decoder.go b/pkg/format/rtph265/decoder.go
index ad7faa0b..7159eb28 100644
--- a/pkg/format/rtph265/decoder.go
+++ b/pkg/format/rtph265/decoder.go
@@ -6,7 +6,7 @@ import (
 
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h265"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
 )
 
 // ErrMorePacketsNeeded is returned when more packets are needed.
diff --git a/pkg/format/rtpmjpeg/decoder.go b/pkg/format/rtpmjpeg/decoder.go
index 76f4e7a5..366c9bec 100644
--- a/pkg/format/rtpmjpeg/decoder.go
+++ b/pkg/format/rtpmjpeg/decoder.go
@@ -6,7 +6,7 @@ import (
 
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/jpeg"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/jpeg"
 )
 
 // ErrMorePacketsNeeded is returned when more packets are needed.
diff --git a/pkg/format/rtpmjpeg/encoder.go b/pkg/format/rtpmjpeg/encoder.go
index 49328451..b3bbdf60 100644
--- a/pkg/format/rtpmjpeg/encoder.go
+++ b/pkg/format/rtpmjpeg/encoder.go
@@ -7,7 +7,7 @@ import (
 
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/jpeg"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/jpeg"
 )
 
 const (
diff --git a/pkg/format/rtpmpeg1audio/decoder.go b/pkg/format/rtpmpeg1audio/decoder.go
index 8bb27201..41c9202f 100644
--- a/pkg/format/rtpmpeg1audio/decoder.go
+++ b/pkg/format/rtpmpeg1audio/decoder.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"fmt"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg1audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg1audio"
 	"github.com/pion/rtp"
 )
 
diff --git a/pkg/format/rtpmpeg1audio/encoder.go b/pkg/format/rtpmpeg1audio/encoder.go
index f3e707e8..4aa12172 100644
--- a/pkg/format/rtpmpeg1audio/encoder.go
+++ b/pkg/format/rtpmpeg1audio/encoder.go
@@ -3,7 +3,7 @@ package rtpmpeg1audio
 import (
 	"crypto/rand"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg1audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg1audio"
 	"github.com/pion/rtp"
 )
 
diff --git a/pkg/format/rtpmpeg4audio/decoder_generic.go b/pkg/format/rtpmpeg4audio/decoder_generic.go
index 47c2d574..5cddca09 100644
--- a/pkg/format/rtpmpeg4audio/decoder_generic.go
+++ b/pkg/format/rtpmpeg4audio/decoder_generic.go
@@ -3,8 +3,8 @@ package rtpmpeg4audio
 import (
 	"fmt"
 
-	"github.com/bluenviron/mediacommon/pkg/bits"
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/bits"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
 	"github.com/pion/rtp"
 )
 
diff --git a/pkg/format/rtpmpeg4audio/decoder_latm.go b/pkg/format/rtpmpeg4audio/decoder_latm.go
index 0e363c94..ed3dd9b9 100644
--- a/pkg/format/rtpmpeg4audio/decoder_latm.go
+++ b/pkg/format/rtpmpeg4audio/decoder_latm.go
@@ -3,7 +3,7 @@ package rtpmpeg4audio
 import (
 	"fmt"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
 	"github.com/pion/rtp"
 )
 
diff --git a/pkg/format/rtpmpeg4audio/encoder_generic.go b/pkg/format/rtpmpeg4audio/encoder_generic.go
index 90d2adeb..5c56bcda 100644
--- a/pkg/format/rtpmpeg4audio/encoder_generic.go
+++ b/pkg/format/rtpmpeg4audio/encoder_generic.go
@@ -3,8 +3,8 @@ package rtpmpeg4audio
 import (
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/bits"
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/bits"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
 )
 
 func packetCountGeneric(avail, le int) int {
diff --git a/pkg/format/rtpmpeg4audio/encoder_latm.go b/pkg/format/rtpmpeg4audio/encoder_latm.go
index 7d07d58c..16db07e8 100644
--- a/pkg/format/rtpmpeg4audio/encoder_latm.go
+++ b/pkg/format/rtpmpeg4audio/encoder_latm.go
@@ -3,7 +3,7 @@ package rtpmpeg4audio
 import (
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
 )
 
 func (e *Encoder) packetCountLATM(auLen int, plil int) int {
diff --git a/pkg/format/rtpmpeg4video/decoder.go b/pkg/format/rtpmpeg4video/decoder.go
index b9d8effa..e04e1497 100644
--- a/pkg/format/rtpmpeg4video/decoder.go
+++ b/pkg/format/rtpmpeg4video/decoder.go
@@ -6,7 +6,7 @@ import (
 
 	"github.com/pion/rtp"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4video"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4video"
 )
 
 // ErrMorePacketsNeeded is returned when more packets are needed.
diff --git a/pkg/format/rtpvp8/decoder.go b/pkg/format/rtpvp8/decoder.go
index 308d0710..ab64ba78 100644
--- a/pkg/format/rtpvp8/decoder.go
+++ b/pkg/format/rtpvp8/decoder.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"fmt"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/vp8"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/vp8"
 	"github.com/pion/rtp"
 	"github.com/pion/rtp/codecs"
 )
diff --git a/pkg/format/rtpvp9/decoder.go b/pkg/format/rtpvp9/decoder.go
index 06e3ad40..e24f124a 100644
--- a/pkg/format/rtpvp9/decoder.go
+++ b/pkg/format/rtpvp9/decoder.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"fmt"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/vp9"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/vp9"
 	"github.com/pion/rtp"
 	"github.com/pion/rtp/codecs"
 )


Test patch:
diff --git a/client_play_test.go b/client_play_test.go
index ea49ee63..c4a0c737 100644
--- a/client_play_test.go
+++ b/client_play_test.go
@@ -21,7 +21,7 @@ import (
 	"github.com/bluenviron/gortsplib/v4/pkg/description"
 	"github.com/bluenviron/gortsplib/v4/pkg/format"
 	"github.com/bluenviron/gortsplib/v4/pkg/headers"
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
 )
 
 func ipPtr(v net.IP) *net.IP {
diff --git a/pkg/format/format_test.go b/pkg/format/format_test.go
index f17dd331..e3b1a241 100644
--- a/pkg/format/format_test.go
+++ b/pkg/format/format_test.go
@@ -4,7 +4,7 @@ import (
 	"testing"
 
 	"github.com/bluenviron/gortsplib/v4/pkg/sdp"
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
 	"github.com/stretchr/testify/require"
 )
 
diff --git a/pkg/format/h265_test.go b/pkg/format/h265_test.go
index ed1a735b..e951977c 100644
--- a/pkg/format/h265_test.go
+++ b/pkg/format/h265_test.go
@@ -3,7 +3,7 @@ package format
 import (
 	"testing"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h265"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
 	"github.com/pion/rtp"
 	"github.com/stretchr/testify/require"
 )
diff --git a/pkg/format/mpeg4_audio_test.go b/pkg/format/mpeg4_audio_test.go
index da680b8c..133b4c4c 100644
--- a/pkg/format/mpeg4_audio_test.go
+++ b/pkg/format/mpeg4_audio_test.go
@@ -6,7 +6,7 @@ import (
 	"github.com/pion/rtp"
 	"github.com/stretchr/testify/require"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/mpeg4audio"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/mpeg4audio"
 )
 
 func TestMPEG4AudioAttributes(t *testing.T) {
diff --git a/pkg/format/rtpav1/decoder_test.go b/pkg/format/rtpav1/decoder_test.go
index a6cde17c..24b61238 100644
--- a/pkg/format/rtpav1/decoder_test.go
+++ b/pkg/format/rtpav1/decoder_test.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"testing"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/av1"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/av1"
 	"github.com/pion/rtp"
 	"github.com/stretchr/testify/require"
 )
diff --git a/pkg/format/rtph264/decoder_test.go b/pkg/format/rtph264/decoder_test.go
index fda63587..3593db8e 100644
--- a/pkg/format/rtph264/decoder_test.go
+++ b/pkg/format/rtph264/decoder_test.go
@@ -5,7 +5,7 @@ import (
 	"errors"
 	"testing"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h264"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h264"
 	"github.com/pion/rtp"
 	"github.com/stretchr/testify/require"
 )
diff --git a/pkg/format/rtph265/decoder_test.go b/pkg/format/rtph265/decoder_test.go
index f9715ce5..1a634d1e 100644
--- a/pkg/format/rtph265/decoder_test.go
+++ b/pkg/format/rtph265/decoder_test.go
@@ -4,7 +4,7 @@ import (
 	"errors"
 	"testing"
 
-	"github.com/bluenviron/mediacommon/pkg/codecs/h265"
+	"github.com/bluenviron/mediacommon/v2/pkg/codecs/h265"
 	"github.com/pion/rtp"
 	"github.com/stretchr/testify/require"
 )