diff --git a/examples/play-from-disk/README.md b/examples/play-from-disk/README.md index 2dfe70e368f..e7d93fcca9f 100644 --- a/examples/play-from-disk/README.md +++ b/examples/play-from-disk/README.md @@ -4,7 +4,7 @@ play-from-disk demonstrates how to send video and/or audio to your browser from For an example of playing H264 from disk see [play-from-disk-h264](https://github.com/pion/example-webrtc-applications/tree/master/play-from-disk-h264) ## Instructions -### Create IVF named `output.ivf` that contains a VP8 track and/or `output.ogg` that contains a Opus track +### Create IVF named `output.ivf` that contains a VP8/VP9/AV1 track and/or `output.ogg` that contains a Opus track ``` ffmpeg -i $INPUT_FILE -g 30 -b:v 2M output.ivf ffmpeg -i $INPUT_FILE -c:a libopus -page_duration 20000 -vn output.ogg diff --git a/examples/play-from-disk/main.go b/examples/play-from-disk/main.go index b3edbc27a29..7486bd69e47 100644 --- a/examples/play-from-disk/main.go +++ b/examples/play-from-disk/main.go @@ -61,8 +61,31 @@ func main() { iceConnectedCtx, iceConnectedCtxCancel := context.WithCancel(context.Background()) if haveVideoFile { + file, openErr := os.Open(videoFileName) + if openErr != nil { + panic(openErr) + } + + _, header, openErr := ivfreader.NewWith(file) + if openErr != nil { + panic(openErr) + } + + // Determine video codec + var trackCodec string + switch header.FourCC { + case "AV01": + trackCodec = webrtc.MimeTypeAV1 + case "VP90": + trackCodec = webrtc.MimeTypeVP9 + case "VP80": + trackCodec = webrtc.MimeTypeVP8 + default: + panic(fmt.Sprintf("Unable to handle FourCC %s", header.FourCC)) + } + // Create a video track - videoTrack, videoTrackErr := webrtc.NewTrackLocalStaticSample(webrtc.RTPCodecCapability{MimeType: webrtc.MimeTypeVP8}, "video", "pion") + videoTrack, videoTrackErr := webrtc.NewTrackLocalStaticSample(webrtc.RTPCodecCapability{MimeType: trackCodec}, "video", "pion") if videoTrackErr != nil { panic(videoTrackErr) } diff --git a/examples/save-to-disk-av1/README.md b/examples/save-to-disk-av1/README.md index ddd174437c8..8622b659a26 100644 --- a/examples/save-to-disk-av1/README.md +++ b/examples/save-to-disk-av1/README.md @@ -5,6 +5,8 @@ If you wish to save VP8 and Opus instead of AV1 see [save-to-disk](https://githu If you wish to save VP8/Opus inside the same file see [save-to-webm](https://github.com/pion/example-webrtc-applications/tree/master/save-to-webm) +You can then send this video back to your browser using [play-from-disk](https://github.com/pion/example-webrtc-applications/tree/master/play-from-disk) + ## Instructions ### Download save-to-disk-av1 ``` diff --git a/examples/save-to-disk/README.md b/examples/save-to-disk/README.md index 53ff188d846..b6f819ffb15 100644 --- a/examples/save-to-disk/README.md +++ b/examples/save-to-disk/README.md @@ -3,6 +3,10 @@ save-to-disk is a simple application that shows how to record your webcam/microp If you wish to save VP8/Opus inside the same file see [save-to-webm](https://github.com/pion/example-webrtc-applications/tree/master/save-to-webm) +If you wish to save AV1 instead see [save-to-disk-av1](https://github.com/pion/webrtc/tree/master/examples/save-to-disk-av1) + +You can then send this video back to your browser using [play-from-disk](https://github.com/pion/example-webrtc-applications/tree/master/play-from-disk) + ## Instructions ### Download save-to-disk ``` diff --git a/mediaengine.go b/mediaengine.go index c824d1ed42f..c5c3dc1f635 100644 --- a/mediaengine.go +++ b/mediaengine.go @@ -182,6 +182,15 @@ func (m *MediaEngine) RegisterDefaultCodecs() error { PayloadType: 118, }, + { + RTPCodecCapability: RTPCodecCapability{MimeTypeAV1, 90000, 0, "", videoRTCPFeedback}, + PayloadType: 45, + }, + { + RTPCodecCapability: RTPCodecCapability{"video/rtx", 90000, 0, "apt=45", nil}, + PayloadType: 46, + }, + { RTPCodecCapability: RTPCodecCapability{"video/ulpfec", 90000, 0, "", nil}, PayloadType: 116,