Skip to content

[rtp-to-webrtc v4 example] - use H264 instead of VP8 #3027

@Ryan-ZL-Lin

Description

@Ryan-ZL-Lin

Hi, I'm following this doc to test out the example, and I could use gstreamer with VP8 to see the video on fiddle web page successfully.

Now, I want to switch to H264 instead of VP8.
I'm using
ffmpeg -re -f lavfi -i testsrc=size=640x480:rate=30 -pix_fmt yuv420p -c:v libx264 -g 10 -preset ultrafast -tune zerolatency -f rtp 'rtp://127.0.0.1:5004?pkt_size=1200'as the test video source.

I changed this line since it's the only occurrence that I can find in https://github.com/pion/webrtc/blob/master/examples/rtp-to-webrtc/main.go

// Create a video track
	videoTrack, err := webrtc.NewTrackLocalStaticRTP(
		webrtc.RTPCodecCapability{MimeType: webrtc.MimeTypeVP8}, "video", "pion",
	)

to

// Create a video track
	videoTrack, err := webrtc.NewTrackLocalStaticRTP(
		webrtc.RTPCodecCapability{MimeType: webrtc.MimeTypeH264}, "video", "pion",
	)

However, I cannot see the video stream on fiddle web site anymore and the vide player keeps loading, although I can see log Connection State has changed connected printed out.

Is there anything I missed out here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions