无需下载整个文件即可读取 ID3 标签

发布于 2024-10-24 05:06:11 字数 134 浏览 2 评论 0原文

是否可以读取 MP3 文件的 ID3 标签(持续时间、艺术家、标题...)而无需下载整个文件?

我做了一些测试,只需下载 MP3 文件的几个字节就可以获得艺术家和标题标签。但我不确定是否可以获取持续时间和其他标签。

谢谢。

Is it possible to read ID3 tags (Duration, Artist, title...) of an MP3 file without having to download the whole file?

I did a few tests and I was able to get the Artist and title tags with only downloading a few bytes of the MP3 file.. but I'm not sure if it's possible for Duration and other tags..

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

庆幸我还是我 2024-10-31 05:06:11

我刚刚发现 ffmpeg 可以读取远程文件的 ID3 标签,而无需下载整个文件:

root@local1:/# ffmpeg -i http://physics.ujep.cz/~mmaly/mp3/Mozart/Mass_in_C_Minor_New_by_Levin/sbory_vyssi_kvalita/01_Kyrie.mp3
FFmpeg version 0.6-4:0.6-2ubuntu6, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct  5 2010 22:36:53 with gcc 4.4.5
  configuration: --extra-version=4:0.6-2ubuntu6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[mp3 @ 0x7ae420]max_analyze_duration reached
[mp3 @ 0x7ae420]Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'http://physics.ujep.cz/~mmaly/mp3/Mozart/Mass_in_C_Minor_New_by_Levin/sbory_vyssi_kvalita/01_Kyrie.mp3':
  Metadata:
    TLEN            : 431046
    TIT2            : Kyrie
    TRCK            : 1
    TPE1            : Mozart
    TCON            : Classical
    TALB            : Mass in C Minor New by Levin
  Duration: 00:07:11.18, start: 0.000000, bitrate: 128 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, 2 channels, s16, 128 kb/s
At least one output file must be specified

I just find out that ffmpeg can read ID3 tags of a remote file without having to download the whole file:

root@local1:/# ffmpeg -i http://physics.ujep.cz/~mmaly/mp3/Mozart/Mass_in_C_Minor_New_by_Levin/sbory_vyssi_kvalita/01_Kyrie.mp3
FFmpeg version 0.6-4:0.6-2ubuntu6, Copyright (c) 2000-2010 the FFmpeg developers
  built on Oct  5 2010 22:36:53 with gcc 4.4.5
  configuration: --extra-version=4:0.6-2ubuntu6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[mp3 @ 0x7ae420]max_analyze_duration reached
[mp3 @ 0x7ae420]Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'http://physics.ujep.cz/~mmaly/mp3/Mozart/Mass_in_C_Minor_New_by_Levin/sbory_vyssi_kvalita/01_Kyrie.mp3':
  Metadata:
    TLEN            : 431046
    TIT2            : Kyrie
    TRCK            : 1
    TPE1            : Mozart
    TCON            : Classical
    TALB            : Mass in C Minor New by Levin
  Duration: 00:07:11.18, start: 0.000000, bitrate: 128 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, 2 channels, s16, 128 kb/s
At least one output file must be specified
━╋う一瞬間旳綻放 2024-10-31 05:06:11

取决于您想读取 ID3v1 还是 ID3v2。 ID3v1 始终位于文件末尾,因此如果您有兴趣阅读,请不要阅读。 ID3v2通常出现在文件的开头,但不能保证这一点。

因此,如果您不想意外错过任何标签,则必须读取整个文件。 ID3v1问题可以通过从文件末尾读取来解决,但这对ID3v2没有帮助。

Depends on if you want to read ID3v1 or ID3v2. ID3v1 is always at the end of the file, so if you are interested in reading that no go. ID3v2 usually occurs at the start of the file, but there's no guarantee for that.

So if you don't want to accidentally miss any tags, you have to read the whole file. The ID3v1 problem can be solved by reading from the end of the file, but that doesn't help with ID3v2.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文