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

Error in bridge.cpp when using openh264 #565

Open
Alpe6825 opened this issue Apr 5, 2024 · 0 comments
Open

Error in bridge.cpp when using openh264 #565

Alpe6825 opened this issue Apr 5, 2024 · 0 comments

Comments

@Alpe6825
Copy link

Alpe6825 commented Apr 5, 2024

I implement custom video encoders for pion webrtc like this:

func CreateCustomOpen264Encoder() codec.ReadCloser {
	// Your image data (replace this with your image loading logic)
	customVideoReader := NewCustomVideoReader2()
	open264Params, _ := openh264.NewParams()
	mediaProp := prop.Media{
		//DeviceID: "",
		Video: prop.Video{
			Width:                  350,
			Height:                 350,
			FrameRate:              25,
			FrameFormat:            frame.FormatRGBA,
			DiscardFramesOlderThan: 0,
		},
		//Audio:    prop.Audio{},
	}

	open264Encoder, err := openh264Params.BuildVideoEncoder(&customVideoReader, mediaProp)
	if err != nil {
		println("Error BuildVideoEncoder")
	}

	return open264Encoder
}

It works for vp8, vp9 and x264, but open264 throws the following error:

/usr/local/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/usr/bin/ld: /tmp/go-link-1015362183/000012.o: in function `enc_new':
/home/alex/go/pkg/mod/github.com/pion/[email protected]/pkg/codec/x264/bridge.h:24: multiple definition of `enc_new'; /tmp/go-link-1015362183/000008.o:/home/alex/go/pkg/mod/github.com/pion/[email protected]/pkg/codec/openh264/bridge.cpp:7: first defined here
/usr/bin/ld: /tmp/go-link-1015362183/000012.o: in function `enc_encode':
/home/alex/go/pkg/mod/github.com/pion/[email protected]/pkg/codec/x264/bridge.h:81: multiple definition of `enc_encode'; /tmp/go-link-1015362183/000008.o:/home/alex/go/pkg/mod/github.com/pion/[email protected]/pkg/codec/openh264/bridge.cpp:74: first defined here
collect2: error: ld returned 1 exit status
@Alpe6825 Alpe6825 changed the title Error in bridge.cpp when using open264 Error in bridge.cpp when using openh264 Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant