我正在尝试使用avprobe
. 这有效(尽管有一些奇怪的警告):
$ avprobe somefile.mp3
...
[mp3 @ 0x657b20] max_analyze_duration reached
[mp3 @ 0x657b20] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'somefile.mp3':
Duration: 00:03:38.10, start: 0.000000, bitrate: 128 kb/s
Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
但是,如果我转身通过 STDIN 传输文件,我会遇到问题:
cat somefile.mp3 | avprobe -
...
[mp3 @ 0x255db20] max_analyze_duration reached
[mp3 @ 0x255db20] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'pipe:':
Duration: N/A, start: 0.000000, bitrate: 128 kb/s
Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
持续时间报告为“N/A”。为什么从 STDIN 读取时无法计算出持续时间?