I’m using bunjs runtime to execute ffmpeg as terminal code but I don’t know if my code is typescript code is wrong or ffmpeg is wrong
and I’m using json file to get the clips correctly
let videos = 0;
let stepsTrim = "";
let concatInputs = "";
for (let i = 0; i < 40; i++) {
if (unwantedWords[i].keepORdelete === true) {
stepsTrim += `[0:v]trim=0:${
unwantedWords[i].start
},setpts=PTS[v${i}];[0:a]atrim=0:${
unwantedWords[i].start
},asetpts=PTS-STARTPTS[a${i}];[0:v]trim=${unwantedWords[i].start}:${
unwantedWords[i].end
},setpts=PTS[v${unwantedWords.length + i + 1}];[0:a]atrim=${
unwantedWords[i].start
}:${unwantedWords[i].end},asetpts=PTS-STARTPTS[a${
unwantedWords.length + i + 1
}];`;
concatInputs += `[v${i}][a${i}][v${unwantedWords.length + i + 1}][a${
unwantedWords.length + i + 1
}]`;
videos += 2;
}
}
stepsTrim = stepsTrim.slice(0, -1);
await $`ffmpeg -hide_banner -i ${videoRequirements.output} -filter_complex "${stepsTrim},${concatInputs} concat=n=${videos}:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" -c:v libopenh264 -preset slow -c:a mp3 -vsync 1 -y ${removedUnwantedWords}/fastAf.mp4`;
at the end after everything was done:
warning
[vost#0:0/libopenh264 @ 0x558f80ea1dc0] More than 1000 frames duplicated.9kbits/s dup=110 drop=1 speed=0.831x
[out_0_0 @ 0x558f8100a880] 100 buffers queued in out_0_0, something may be wrong. dup=1064 drop=1 speed=1.43x
[out_0_1 @ 0x558f8100af80] 100 buffers queued in out_0_1, something may be wrong.
[out_0_1 @ 0x558f8100af80] 1000 buffers queued in out_0_1, something may be wrong.
I can't figure out why ffmpeg is sometimes making the audio + video work and sometimes not
[enter image description here](https://i.stack.imgur.com/PicaA.png)
[
{
"word": "Hello",
"id": 0,
"keepORdelete": false,
"start": 0,
"end": 9.06
},
{
"word": "guys,",
"id": 1,
"keepORdelete": false,
"start": 9.06,
"end": 10.2
},
{
"word": "there",
"id": 2,
"keepORdelete": false,
"start": 11.76,
"end": 12.06
},
...
I have tried commands from many types of ffmpeg commands changing the code and I can’t seem to get the audio and video right