4

I need to extract cover from OGG file.

I'm tries to decode base64 string stored in METADATA_BLOCK_PICTURE tag, which I'm getting with following command:

vorbiscomment -R -e 1.ogg

Base64 decoding is working without errors, but resulting binary file is not opening neither like JPG, nor like PNG.

Example file: http://regress78.com/1.ogg

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Beer Brother
  • 514
  • 2
  • 6
  • 15

1 Answers1

2

There's a header on the binary data before the JFIF or PNG stream starts.

I'm able to extract a valid jpeg file after parsing out the header length (42 bytes in this case) from a hexdump:

$ 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
Ralph Giles
  • 467
  • 2
  • 9