35 lines
1.7 KiB
JavaScript
35 lines
1.7 KiB
JavaScript
const { execSync } = require('child_process');
|
|
const fs = require('fs');
|
|
|
|
// Helper to run command
|
|
const run = (cmd) => {
|
|
try {
|
|
console.log(`Running: ${cmd}`);
|
|
console.log(execSync(cmd, { stdio: 'pipe' }).toString());
|
|
} catch (e) {
|
|
console.log(`Error: ${e.message}`);
|
|
if (e.stderr) console.log(`Stderr: ${e.stderr.toString()}`);
|
|
}
|
|
};
|
|
|
|
// Create dummy test files
|
|
// 2.1 Layout (FL+FR+LFE)
|
|
run('ffmpeg -y -f lavfi -i "sine=frequency=1000:duration=1" -f lavfi -i "sine=frequency=1000:duration=1" -f lavfi -i "sine=frequency=1000:duration=1" -filter_complex "[0:a][1:a][2:a]join=inputs=3:channel_layout=2.1[a]" -map "[a]" input_2.1.wav');
|
|
|
|
// 4.1 Layout (FL+FR+FC+LFE+BC) - Wait, FFmpeg's 4.1 is 5 channels.
|
|
// Let's create what we think AC3 4.1 is.
|
|
// If user meant "4.1" as in 4 surround channels + LFE, that's 5 channels.
|
|
// FFmpeg layout "4.1" is FL+FR+FC+LFE+BC (5 channels).
|
|
run('ffmpeg -y -f lavfi -i "sine=frequency=1000:duration=1" -f lavfi -i "sine=frequency=1000:duration=1" -f lavfi -i "sine=frequency=1000:duration=1" -f lavfi -i "sine=frequency=1000:duration=1" -f lavfi -i "sine=frequency=1000:duration=1" -filter_complex "[0:a][1:a][2:a][3:a][4:a]join=inputs=5:channel_layout=4.1[a]" -map "[a]" input_4.1.wav');
|
|
|
|
console.log('\n--- Testing AAC Conversion for 2.1 ---');
|
|
run('ffmpeg -y -i input_2.1.wav -c:a aac output_2.1.aac');
|
|
run('ffprobe -hide_banner -show_streams output_2.1.aac');
|
|
|
|
console.log('\n--- Testing AAC Conversion for 4.1 ---');
|
|
run('ffmpeg -y -i input_4.1.wav -c:a aac output_4.1.aac');
|
|
run('ffprobe -hide_banner -show_streams output_4.1.aac');
|
|
|
|
// Cleanup
|
|
run('rm input_2.1.wav input_4.1.wav output_2.1.aac output_4.1.aac');
|