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

如何将h264流或者h264文件封装成flv #122

Open
q303757102 opened this issue Mar 13, 2024 · 3 comments
Open

如何将h264流或者h264文件封装成flv #122

q303757102 opened this issue Mar 13, 2024 · 3 comments

Comments

@q303757102
Copy link

q303757102 commented Mar 13, 2024

如何将h264流或者h264文件封装成flv,没看到怎样获取h264的pts和dts 新手问题

@Tryanks
Copy link

Tryanks commented Mar 13, 2024

裸 264 流是不包含 pts 和 dts 的,你要手动生成

@q303757102
Copy link
Author

裸 264 流是不包含 pts 和 dts 的,你要手动生成

封装flv的粗略写法,没见flv里面有script tag,是哪一步有问题吗

flvWriter.WriteHeader()
	for {
		time.Sleep(time.Millisecond * 1)
		select {
		case Payload, _ := <-StreamProvider.GetDataChan():

			frame := calculatePtsDts(Payload)
			flvWriter.WriteH264(Payload, frame.Pts, frame.Dts)
		default:

		}
	}

@yapingcat
Copy link
Owner

yapingcat commented Mar 15, 2024

裸 264 流是不包含 pts 和 dts 的,你要手动生成

封装flv的粗略写法,没见flv里面有script tag,是哪一步有问题吗

flvWriter.WriteHeader()
	for {
		time.Sleep(time.Millisecond * 1)
		select {
		case Payload, _ := <-StreamProvider.GetDataChan():

			frame := calculatePtsDts(Payload)
			flvWriter.WriteH264(Payload, frame.Pts, frame.Dts)
		default:

		}
	}

gomedia 还不支持写script tag

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

3 participants