ggerganov / whisper.cpp

Port of OpenAI's Whisper model in C/C++
MIT License
35.41k stars 3.61k forks source link

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

Open pravindahal opened 1 year ago

pravindahal commented 1 year ago

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

RichardGrundy commented 12 months ago

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.

anga83 commented 11 months ago

-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

kornpow commented 11 months ago

This solution also helped me out!

D0han commented 9 months ago

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

DuckyBlender commented 8 months ago

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...

remuswu1019 commented 7 months ago

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
tamo commented 7 months ago

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

barolo commented 6 months ago

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

matijagrcic commented 5 months ago

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  
xezpeleta commented 2 weeks ago

Same issue here. I've tried with the commands listed above, but I got some errors in my environment (Ubuntu 22.04)

Finally I get it working with the following:

grep -oP '(?<=-vf ").*?(?=")' myfile.wav.wts > filter.txt
LC_ALL=C sed -E 's/\-vf ".*"/-filter_complex_script filter.txt/g' -i myfile.wav.wts

Thanks!