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

Translating h264 video to rtmp server #739

Open
Leur68 opened this issue Mar 26, 2025 · 0 comments
Open

Translating h264 video to rtmp server #739

Leur68 opened this issue Mar 26, 2025 · 0 comments

Comments

@Leur68
Copy link

Leur68 commented Mar 26, 2025

Sorry if this is a stupid question. I need to stream video that I’m receiving via RTSP (H.264) to an RTMP server (e.g., using joy4 or go-rtmp). How can I do this? Right now, I’ve written code that records the video to a *.ts file.

		rtspClient.OnPacketRTP(medi, forma, func(pkt *rtp.Packet) {
			log.Printf("RTP packet from media %v\n", medi)

			// decode timestamp
			pts, ok := rtspClient.PacketPTS2(medi, pkt)
			if !ok {
				log.Printf("waiting for timestamp")
				return
			}

			// extract access unit from RTP packets
			au, err := rtpDec.Decode(pkt)
			if err != nil {
				if err != rtph264.ErrNonStartingPacketAndNoPrevious && err != rtph264.ErrMorePacketsNeeded {
					log.Printf("ERR: %v", err)
				}
				return
			}

			// here I need to mux (?) h264 to rtmp packets
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