Provide original bitrate to ffmpeg

This commit is contained in:
Arkadiusz Wieczorek 2021-10-03 22:21:04 +02:00
parent 91357cba80
commit 9223a333f0

View File

@ -12,6 +12,9 @@ const FREQ = 48000;
const FRAMERATE = parseFloat(
(await $`mediainfo --Output="Video;%FrameRate%" ${video}`).stdout
);
const BITRATE = parseFloat(
(await $`mediainfo --Inform="Video;%BitRate/String%" ${video}`).stdout
);
const labels_contents = (await $`awk '{print $3, $4, $5}' < ${labels}`).stdout;
@ -182,4 +185,4 @@ ${audio_filter}
${ns.map((n) => `[copy${n}t][copy${n}ta]`).join(" ")}
concat=n=${pieces.length}:v=1:a=1 [out_video] [out_audio]`;
await $`ffmpeg -i ${video} -b:v 20000k -filter_complex ${filter} -map '[out_video]' -map '[out_audio]' ${`${video}.cut-complex.mp4`}`;
await $`ffmpeg -i ${video} -b:v ${BITRATE}M -filter_complex ${filter} -map '[out_video]' -map '[out_audio]' ${`${video}.cut-complex.mp4`}`;