简体   繁体   English

如何结束管道?

[英]How do I end a pipe?

I have trouble using ffprobe from node.js. 我在使用来自node.js的ffprobe遇到了麻烦。 I need the audio lengths MP3 files. 我需要音频长度的MP3文件。 There is an npm package, get-audio-duration for this. 有一个npm包,为此需要get-audio-duration

The package calls ffprobe through an execa command. 程序包通过execa命令调用ffprobe It works well for .flac files both when when using a filename and a stream. 当使用文件名和流时,它对.flac文件都适用。 However for .mp3 files it fails for streams. 但是,对于.mp3文件,流失败。

I suspected some problems with execa so I checked from the command line (on Windows 10): 我怀疑execa出现问题,因此我从命令行(在Windows 10上)进行了检查:

type file.mp3 | ffprobe -

(Where I left out the parameters to ffprobe for clarity.) (为清楚起见,我在这里省略了ffprobe的参数。)

This kind of works, but says duration=N/A . 这种工作,但是说duration=N/A

It looks to me like ffprobe didn't get the info that the input is finished. 在我看来, ffprobe没有获得输入完成的信息。 Or, it dint care about it. 或者,它对它有所关注。 (There is a 4 year old bug report about this on the ffmpeg issue site which was closed for no obvious reason.) (在ffmpeg问题站点上有一份有关此问题的4年错误报告,该报告没有明显原因被关闭。)

Is it possible to somehow tell ffprobe that the pipe has ended? 是否可以以某种方式告诉ffprobe管道已结束?

It's not a matter of noticing that the pipe has ended. 无需注意管道已结束。

ffprobe uses a different way of determining the file size than is allowed by piping stdout to stdin ffprobe使用不同于将stdout传递到stdin所允许的方法来确定文件大小

See https://trac.ffmpeg.org/ticket/4358 参见https://trac.ffmpeg.org/ticket/4358

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM