Skip to content

配置开启了record,程序在对应的目录下也创建了flv,但是录制的flv文件为0字节 #10

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

Closed
cts2021 opened this issue Apr 6, 2025 · 2 comments

Comments

@cts2021
Copy link

cts2021 commented Apr 6, 2025

非常感谢大佬的开源!

配置开启了record,程序在对应的目录下也创建了flv,但是录制的flv文件为0字节

"record": {
"enable": true,
"format": "flv",
"dir": "./recdata"
}

不知道是不是我理解错了,Input没有看到在被调用。

// Input 输入http-flv数据
func (f *FLVFileSink) Input(data []byte) error {
if f.fail {
return nil
}

//去掉不需要的换行符
var offset int
for i := 2; i < len(data); i++ {
	if data[i-2] == 0x0D && data[i-1] == 0x0A {
		offset = i
		break
	}
}

_, err := f.file.Write(data[offset : len(data)-2])
if err != nil {
	//只要写入失败一次,后续不再允许写入, 不影响拉流
	f.fail = true
}

return err

}

@ydajiang
Copy link
Member

ydajiang commented Apr 7, 2025

嗯,我在重构阶段也出现了这个问题,本周会发布一个重构的新版本。

@cts2021
Copy link
Author

cts2021 commented Apr 8, 2025

嗯,我在重构阶段也出现了这个问题,本周会发布一个重构的新版本。

大佬威武!

@cts2021 cts2021 closed this as completed Apr 16, 2025
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

2 participants