whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

"argument list too long: ffmpeg" when trying to generate video

Open pravindahal opened this issue 1 year ago • 9 comments

It seems that if the audio file is too long, the generated wts file cannot be converted to video.

enchiridion-01-epictetus_64kb.wav.wts.zip

pravindahal avatar Sep 17 '23 08:09 pravindahal

I recently experienced this and took a look at the .wts file. Turns out the filter argument was thousands of lines long (long podcast). Anyway I managed to fix it by extracting this parameter to a text file and then replace it in the was file with:

-filter_complex_script filter.txt

rather than the -vf param

this then works. Can provide more info if necessary.

RichardGrundy avatar Nov 06 '23 20:11 RichardGrundy

-filter_complex_script filter.txt

Thanks, can confirm that this solution works!

However, maybe it's just me, but with a large filte script ffmpeg takes ages to render the video. For comparison: a 3 minute audio (filter script 379 KB - that's roughly the amount you can still parse as command-line parameters) ffmpeg renders at 3x, while a 16 minute audio (filter script about 2 MB), ffmpeg renders at only 0.1x.

Am I holding it wrong or is that an unavoidable side effect at this scale?

Specs: latest ffmpeg snapshot on M1 Pro

anga83 avatar Nov 16 '23 15:11 anga83

This solution also helped me out!

kornpow avatar Nov 16 '23 23:11 kornpow

Also bumped into this problem, output_wts should create parameter file instead of the long command https://github.com/ggerganov/whisper.cpp/blob/7a74e929c842489010f641156f2a5ac733b17016/examples/main/main.cpp#L693

D0han avatar Feb 05 '24 13:02 D0han

I recently experienced this and took a look at the .wts file. Turns out the filter argument was thousands of lines long (long podcast). Anyway I managed to fix it by extracting this parameter to a text file and then replace it in the was file with:

-filter_complex_script filter.txt

rather than the -vf param

this then works. Can provide more info if necessary.

How to extract the filter param? For me the file is so large it lags out everything I use...

DuckyBlender avatar Mar 05 '24 10:03 DuckyBlender

I recently experienced this and took a look at the .wts file. Turns out the filter argument was thousands of lines long (long podcast). Anyway I managed to fix it by extracting this parameter to a text file and then replace it in the was file with: -filter_complex_script filter.txt rather than the -vf param this then works. Can provide more info if necessary.

How to extract the filter param? For me the file is so large it lags out everything I use...

I use following command to generate param file,

grep -o -E '(\-vf ".+")' ${WAV}.wts > filter.txt
LC_ALL=C sed -E 's/(\-vf ".+")/\-filter_complex_script filter.txt/g' -I ${WAV}.wts

remuswu1019 avatar Mar 16 '24 21:03 remuswu1019

Maybe we can use ASS instead of many -vf filters: https://github.com/ggerganov/whisper.cpp/compare/master...tamo:whisper.cpp:main-wts-ass?expand=1 see https://aegisub.org/docs/latest/ass_tags/#\k

tamo avatar Mar 17 '24 16:03 tamo

Maybe we can use ASS instead of many -vf filters: https://github.com/ggerganov/whisper.cpp/compare/master...tamo:whisper.cpp:main-wts-ass?expand=1 see https://aegisub.org/docs/latest/ass_tags/#\k

There's a script which can convert json output [-ojf] to karaoke ass

https://github.com/ggerganov/whisper.cpp/issues/884

barolo avatar Apr 08 '24 01:04 barolo

Used the following to produce the working command:

# Extract the -vf parameter and save to filter.txt
awk '/-vf "/{flag=1} flag; /"/{flag=0}' fileName.wav.wts | awk 'BEGIN{RS="\""} /-vf /{getline; print}' > filter.txt

# Replace -vf parameter with -filter_complex_script filter.txt in the original file, preserving the surrounding text
perl -0777 -i.bak -pe 's/-vf ".*?"/-filter_complex_script filter.txt/s' fileName.wav.wts  

matijagrcic avatar May 17 '24 21:05 matijagrcic