import { buildCommandToConvertVideoWithFfmpeg } from '../shared/index.js';
import { BuildBaseFileInputOutputModel, FFMPEG_FORMAT, } from '../shared/type/index.js';
import { buildUseConvert, transform_input_output_file_array, } from './base.js';
import { handleCommand } from './command.js';
// export async function convertFLACToMp3({ inputPath, outputPath }) {
//   child_process.execSync(
//     `ffmpeg -y -loglevel warning -hide_banner -nostats -i "${path.resolve(
//       inputPath,
//     )}" -ab 320k -map_metadata 0 -id3v2_version 3 "${path.resolve(
//       outputPath,
//     )}"`,
//   )
// }
const IOFfmpeg = BuildBaseFileInputOutputModel.superRefine(transform_input_output_file_array(FFMPEG_FORMAT, FFMPEG_FORMAT));
export const useConvertVideoWithFfmpeg = buildUseConvert(FFMPEG_FORMAT, FFMPEG_FORMAT, 'ffmpeg');
export async function convertVideoWithFfmpeg(source) {
    const input = IOFfmpeg.parse(source);
    const list = await buildCommandToConvertVideoWithFfmpeg(input);
    for (const cmd of list) {
        await handleCommand(cmd);
    }
    return input.output.file.path;
}
//# sourceMappingURL=video.js.map