【问题标题】:Extract cover image from OGG file从OGG文件中提取封面图像
【发布时间】:2015-12-02 13:58:00
【问题描述】:

我需要从 OGG 文件中提取封面。

我正在尝试解码存储在 METADATA_BLOCK_PICTURE 标记中的 base64 字符串,我通过以下命令得到:

vorbiscomment -R -e 1.ogg

Base64 解码工作正常,但生成的二进制文件既不像 JPG 也不像 PNG 那样打开。

示例文件:http://regress78.com/1.ogg

【问题讨论】:

    标签: shell ubuntu base64 ogg vorbis


    【解决方案1】:

    在 JFIF 或 PNG 流开始之前,二进制数据上有一个 header

    在从 hexdump 解析出标头长度(本例中为 42 个字节)后,我能够提取有效的 jpeg 文件:

    $ vorbiscomment -R -e 1.ogg | grep METADATA_BLOCK_PICTURE | cut -d '=' -f 2 | base64 -d > 1.dat
    base64: invalid input
    $ dd if=1.dat of=1.jpeg bs=1 skip=42
    114424+0 records in
    114424+0 records out
    114424 bytes (114 kB) copied, 0.112082 s, 1.0 MB/s
    $ file 1.jpeg
    1.jpeg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 72x72, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=1], baseline, precision 8, 496x500, frames 3
    

    【讨论】:

      猜你喜欢
      • 2011-10-22
      • 2012-04-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-17
      • 2019-02-24
      • 1970-01-01
      相关资源
      最近更新 更多