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

Update WASM plugins logic #4686

Merged
merged 4 commits into from
Mar 21, 2024
Merged

Conversation

DBeidachazi
Copy link
Contributor

fix: 解决旧版WASM下载两个音频或flv存在重复下载的问题,并限制仅支持单个视频下载

if (fragments.length === 2) {
await run(fragments[0].title, toast, fragments[0].url, fragments[1].url) // [dash]
} else {
await run(fragments[0].title, toast, fragments[0].url) // [flv | m4a]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只有单个流的话不用这个插件,没必要过一遍 FFmpeg,报个错就行,让用户直接下载。

if (
fragments.length > 2 ||
(fragments.length === 2 &&
!(fragments[0].extension === '.mp4' && fragments[1].extension === '.m4a'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extension 是可以自定义的(#4449),如果用户自定义了扩展名这里的条件就会出问题。

Direct link download flv/m4a in WASM
@DBeidachazi
Copy link
Contributor Author

在我这里ffmpeg处理flac音频时会出现文件异常的情况,这个参数需要改吗

  await ffmpeg.exec(['-i', 'video', '-i', 'audio', '-c:v', 'copy', '-c:a', 'copy', 'output.mp4'])

@WakelessSloth56
Copy link
Contributor

在我这里ffmpeg处理flac音频时会出现文件异常的情况,这个参数需要改吗

  await ffmpeg.exec(['-i', 'video', '-i', 'audio', '-c:v', 'copy', '-c:a', 'copy', 'output.mp4'])

因为输出是 MP4 容器,它是不支持 FLAC 流的,如果是 FLAC 音频的话用 Matroska 容器(.mkv)就行了。

@@ -47,3 +45,15 @@ export async function run(name: string, videoUrl: string, audioUrl: string, toas

await DownloadPackage.single(name, outputBlob)
}

export async function downloadFromLink(name: string, toast: Toast, url: string) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个插件不需要下载单个文件,这里给出用户提示之后就不要做什么了,下载单个文件已经有 Toast
StreamSaver、aria2、IDM 等很多方式了。

Add use WASM to download video containing flac audio
@the1812 the1812 merged commit 8afc9e7 into the1812:preview-fixes Mar 21, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants