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

生成的视频没有duration,在播放器中不会显示总时长 #20

Closed
qcjiamin opened this issue Aug 17, 2023 · 8 comments
Closed

Comments

@qcjiamin
Copy link

No description provided.

@hughfenghen
Copy link
Member

@qcjiamin
#15 (comment)

因为流式导出文件(fMP4格式),所以没办法在开始的时候确定视频的时长,
你可以尝试使用 ffmpeg 给输出的视频文件添加时长, ffmpeg -i WebAv-export-1689131950320.mp4 -vcodec copy -acodec copy video_1_fixed.mp4

你在什么场景下输出视频文件?
WebAV 输出的视频流直接上传,还是会写入本地磁盘?

或者,也可以考虑单独提供一个工具函数,给 fMP4 文件添加 duration 字段。

@hughfenghen
Copy link
Member

或者在结束的时候,给 moov box 添加 duration 写入文件结尾,需要试试是否可行。

@hughfenghen
Copy link
Member

或者在结束的时候,给 moov box 添加 duration 写入文件结尾,需要试试是否可行。

试过了,将 moov box 移动到 fMP4 文件的末尾处,文件将无法播放。

按这个规范文件描述,moov 应该在 ftyp box 之后,文件的开头处。
https://www.w3.org/2013/12/byte-stream-format-registry/isobmff-byte-stream-format.html

@hughfenghen
Copy link
Member

很遗憾,目前只能通过ffmpeg 添加 duration:ffmpeg -i WebAv-export-1689131950320.mp4 -vcodec copy -acodec copy video_1_fixed.mp4

或者牺牲流式导出文件的能力,在流结束的时候去更新 duration,但我目前认为还不值得。

@hughfenghen
Copy link
Member

hughfenghen commented Jan 6, 2024

v0.2.17 新增一个 API fixFMP4Duration 将 mp4 流保存到临时文件,在流结束时修正 duration 字段
解决 windows Media Player 播放输出文件不显示时长

查看完整示例 修复输出文件不显示时长

@DeanDai
Copy link

DeanDai commented Jun 21, 2024

v0.2.17 新增一个 API mp4StreamToOPFSFile 将 mp4 流保存到临时文件,在流结束时修正 duration 字段 解决 windows Media Player 播放输出文件不显示时长

查看完整示例 修复输出文件不显示时长

Hi, seems like the demo is unavailable, may I know how to solve the issue? Thanks

@hughfenghen
Copy link
Member

hughfenghen commented Jun 21, 2024

@DeanDai

If you use the @webav/av-cliper Combinator to generate videos, this issue has been resolved in the latest version
commit, DEMO

If you use @webav/av-recorder to record videos, please refer to this DEMO

This project has changed organizations, so the domain has changed.

@DeanDai
Copy link

DeanDai commented Jun 21, 2024

@DeanDai

If you use the @webav/av-cliper Combinator to generate videos, this issue has been resolved in the latest version commit, DEMO

If you use @webav/av-recorder to record videos, please refer to this DEMO

This project has changed organizations, so the domain has changed.

Thank you 👍

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