Add support for atrac3 encoded tracks
This commit is contained in:
parent
254c06c74a
commit
b7c3aaddf6
|
@ -2,20 +2,22 @@
|
|||
# This is just an experiment. Might not work at all on your hardware
|
||||
|
||||
apt update
|
||||
apt install wine-stable
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y wine-stable wget vim
|
||||
wget https://github.com/cskau/atrac3util/releases/download/v0.0.1/atrac3util.exe
|
||||
wget https://dl.winehq.org/wine/wine-mono/4.9.4/wine-mono-4.9.4.msi
|
||||
WINEARCH=win32 WINEPREFIX=~/.wine32 wineboot
|
||||
# WINEARCH=win32 WINEPREFIX=~/.wine32 wineboot
|
||||
wineboot
|
||||
wine msiexec /i wine-mono-4.9.4.msi
|
||||
wine64 msiexec /i wine-mono-4.9.4.msi
|
||||
wget https://samples.ffmpeg.org/A-codecs/ATRAC3/atrac3.acm
|
||||
cp atrac3.acm ~/.wine/drive_c/windows/system32/
|
||||
cp atrac3.acm ~/.wine/drive_c/windows/syswow64/
|
||||
vi ~/.wine/drive_c/windows/system.ini
|
||||
vi ~/.wine/drive_c/windows/system.ini #msacm.at3=atrac3.acm
|
||||
ls
|
||||
wine64 atrac3util.exe
|
||||
wine atrac3util.exe
|
||||
|
||||
|
||||
apt-get install mono-complete
|
||||
git clone https://github.com/cskau/atrac3util.git
|
||||
cd atrac3util/
|
||||
|
@ -23,6 +25,7 @@ mcs -out:atrac3util.exe main.cs acm.cs
|
|||
ls
|
||||
wine atrac3util.exe
|
||||
wine64 atrac3util.exe
|
||||
|
||||
dpkg --add-architecture i386 && apt-get update && apt-get install wine32
|
||||
wine64 atrac3util.exe
|
||||
ls ..
|
||||
|
@ -47,10 +50,24 @@ cd atrac3util/
|
|||
mcs -out:atrac3util.exe main.cs acm.cs
|
||||
|
||||
# dockerfile
|
||||
dpkg --add-architecture i386
|
||||
apt update
|
||||
apt install wine-stable
|
||||
DEBIAN_FRONTEND=noninteractive apt install -y wine32 wget
|
||||
wineboot
|
||||
wget https://dl.winehq.org/wine/wine-mono/4.9.4/wine-mono-4.9.4.msi
|
||||
wine msiexec /i wine-mono-4.9.4.msi
|
||||
wget https://samples.ffmpeg.org/A-codecs/ATRAC3/atrac3.acm
|
||||
cp atrac3.acm ~/.wine/drive_c/windows/system32/
|
||||
echo "msacm.at3=atrac3.acm" >> ~/.wine/drive_c/windows/system.ini
|
||||
wget https://github.com/cskau/atrac3util/releases/download/v0.0.1/atrac3util.exe
|
||||
wine atrac3util.exe prova.wav prova.at3
|
||||
|
||||
# bash idea
|
||||
|
||||
ID=$(docker run -itd atrac3) # https://stackoverflow.com/questions/44577344/piping-docker-run-container-id-to-docker-exec
|
||||
# for each file
|
||||
docker cp @file $ID:/tmp/file # https://stackoverflow.com/questions/22907231/how-to-copy-files-from-host-to-docker-container
|
||||
docker exec -it $ID wine atrac3util.exe -lp2 /tmp/@file /tmp/@file.at3
|
||||
docker cp $ID:/tmp/file/@file.at3 ./file.at3
|
||||
|
||||
docker stop $ID
|
||||
|
|
|
@ -534,12 +534,18 @@ export function convertAndUpload(files: File[], requestedFormat: UploadFormat, t
|
|||
let error: any;
|
||||
let errorMessage = ``;
|
||||
let i = 1;
|
||||
let failedConversion: File[] = [];
|
||||
for await (let item of conversionIterator(files)) {
|
||||
if (hasUploadBeenCancelled()) {
|
||||
break;
|
||||
}
|
||||
|
||||
const { file, data, format } = item;
|
||||
if (data === null) {
|
||||
console.error(`Conversion failed for file: ${file.name}`);
|
||||
failedConversion.push(file);
|
||||
continue;
|
||||
}
|
||||
|
||||
let title = file.name;
|
||||
try {
|
||||
|
|
|
@ -49,25 +49,31 @@ if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScop
|
|||
const inWavFile = `inWavFile.wav`;
|
||||
const outAt3File = `outAt3File.aea`;
|
||||
const dataArray = new Uint8Array(data);
|
||||
Module.FS.writeFile(`${inWavFile}`, dataArray);
|
||||
Module.callMain([`-e`, `atrac3`, `-i`, inWavFile, `-o`, outAt3File, `--bitrate`, bitrate]);
|
||||
let result = null;
|
||||
|
||||
// Read file and trim header (96 bytes)
|
||||
let fileStat = Module.FS.stat(outAt3File);
|
||||
let size = fileStat.size;
|
||||
let tmp = new Uint8Array(size - 96);
|
||||
let outAt3FileStream = Module.FS.open(outAt3File, 'r');
|
||||
Module.FS.read(outAt3FileStream, tmp, 0, tmp.length, 96);
|
||||
Module.FS.close(outAt3FileStream);
|
||||
try {
|
||||
Module.FS.writeFile(`${inWavFile}`, dataArray);
|
||||
Module.callMain([`-e`, `atrac3`, `-i`, inWavFile, `-o`, outAt3File, `--bitrate`, bitrate]);
|
||||
|
||||
let result = tmp.buffer;
|
||||
// Read file and trim header (96 bytes)
|
||||
let fileStat = Module.FS.stat(outAt3File);
|
||||
let size = fileStat.size;
|
||||
let tmp = new Uint8Array(size - 96);
|
||||
let outAt3FileStream = Module.FS.open(outAt3File, 'r');
|
||||
Module.FS.read(outAt3FileStream, tmp, 0, tmp.length, 96);
|
||||
Module.FS.close(outAt3FileStream);
|
||||
|
||||
result = tmp.buffer;
|
||||
} catch (err) {
|
||||
console.error(`AtracdencProcess error: `, err);
|
||||
}
|
||||
|
||||
self.postMessage(
|
||||
{
|
||||
action: 'encode',
|
||||
result,
|
||||
},
|
||||
[result]
|
||||
result ? [result] : []
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue