Opened 7 years ago

Last modified 7 years ago

#6168 new enhancement

support Wing Commander Privateer Audio vpk files

Reported by: compn Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

samples:
http://trac.ffmpeg.org/ticket/5026
http://trac.mplayerhq.hu/ticket/2252

W:\>ffmpeg -i "http://trac.ffmpeg.org/raw-attachment/ticket/5026/BUYFIGHT.VPK"
ffmpeg version N-83243-g2080bc3 Copyright (c) 2000-2017 the FFmpeg developers

built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx

--enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-l
ibass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libi
lbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enab
le-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --e
nable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-
libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink
--enable-zlib

libavutil 55. 45.100 / 55. 45.100
libavcodec 57. 75.100 / 57. 75.100
libavformat 57. 63.100 / 57. 63.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 70.100 / 6. 70.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100

[vpk @ 00000000004aa3a0] Format vpk detected only with low score of 1, misdetection possible!
http://trac.ffmpeg.org/raw-attachment/ticket/5026/BUYFIGHT.VPK: Invalid data found when processing input

Change History (1)

comment:1 by James Carthew, 7 years ago

File is an LZW compressed Creative VOC File. I have the format spec here:

A header starting with the file size then read 4 bytes at a time, which points to a bunch of entries: first begins at offset 0x1c, second at 0x602a, third at 0xdbd4, etc (in an example file, the offsets vary in each file.)

Each of these entries is LZW compressed. Start reading 9 bits at a time, expect symbol 257 as a stop symbol (although only some games honour that), and dictionary entries start on symbol 258. As dictionary expands towards entry 512, read 10 bytes at a time, and so on. You read at most 12 bytes at time, the dictionary doesn't grow beyond that (4096 entries... with the first 256 entries being the ASCII table itself) and symbol 256 resets the dictionary.

Unpack these and you get a Creative VOC file, which you'll be able to play in VLC, or a similar player. The format is PCM, which means it's not compressed by any predictive audio compression algorithm. It's just plain 8-bit (unsigned), 11025Hz, mono audio.

Note: See TracTickets for help on using tickets.