[FFmpeg-user] Wave channel split is very slow

Bouke / Videotoolshed bouke at videotoolshed.com
Sat Feb 24 16:26:10 EET 2024


On 24 Feb 2024, at 12:37, Paul B Mahol <onemda at gmail.com> wrote:
> 
> On Sat, Feb 24, 2024 at 11:33 AM Bouke / Videotoolshed <
> bouke at videotoolshed.com> wrote:
> 
>> Trying to split a 64 channel 48Khz 24 bits Wave file.
>> That is VERY slow.
>> 
>> ffmpeg -i /Volumes/Data/magweg/64channel.wav -filter_complex
>> "[0]pan=mono|c0=c0[tr0]" -c:a pcm_s24le -map "[tr0]"
>> /Volumes/Data/magweg/64_test/out_1.wav
>> 
>> Runs at about 15x
>> 
>> But if I do all 64 in one pass, it slows down to about 0.7x
>> 
>> I don’t get it. DiskIO should not be a factor, and there is no math
>> involved. (Granted, the ppm_s24le might involve math, but that should be
>> simple.)
>> 
>> Is this a bug?
>> (Same happens vice versa, going from multiple non-interleaved to one big
>> interleaved Wave.)
>> 
>> Bouke
>> 
> 
> For demuxing case, use -max_size 4000000 as input option for wav demuxer,

Hi Paul,

Yup, that helps. It now runs 64 channels at about 16x, that is about 20 times faster than before!

> order of this option matters.

Where have I heard this before :-) (I won’t go there, no worries.)


> Issue is if single packets have small number of stored samples it hurts
> performance with ffmpeg utility, recently situation got even worse with
> threading work.
I trust you, but I don’t do C
> I raised concerns and reported it to authorities multiple times without
> results, but got responses that is not relevant but very minor problem.

This IS a serious problem, same as stripping audio only from video has become dog slow.
FFmbc used to be able to do that (with -c:a copy) at the speed of drive, FFmpeg nowadays seems to read the entire file, including video.
> 
> Dunno what command you use for reverse direction so can not help you on
> that one.

My filter compex is HUGE, it splits all inputs to mono, pads / merges / etc. (I’m doing auto sequence style.)
But for now, I’ve got something more to toy with.

Thanks,
Bouke

Better command line (way simplified) that indeed runs faster:
/Applications/ffmpeg -max_size 4000000 -i /Volumes/Data/magweg/64_test/64chans.wav -max_size 4000000 -filter_complex "[0]pan=mono|c0=c0[tr0];[0]pan=mono|c0=c1[tr1];[0]pan=mono|c0=c2[tr2];[0]pan=mono|c0=c3[tr3];[0]pan=mono|c0=c4[tr4];[0]pan=mono|c0=c5[tr5];[0]pan=mono|c0=c6[tr6];[0]pan=mono|c0=c7[tr7];[0]pan=mono|c0=c8[tr8];[0]pan=mono|c0=c9[tr9];[0]pan=mono|c0=c10[tr10];[0]pan=mono|c0=c11[tr11];[0]pan=mono|c0=c12[tr12];[0]pan=mono|c0=c13[tr13];[0]pan=mono|c0=c14[tr14];[0]pan=mono|c0=c15[tr15];[0]pan=mono|c0=c16[tr16];[0]pan=mono|c0=c17[tr17];[0]pan=mono|c0=c18[tr18];[0]pan=mono|c0=c19[tr19];[0]pan=mono|c0=c20[tr20];[0]pan=mono|c0=c21[tr21];[0]pan=mono|c0=c22[tr22];[0]pan=mono|c0=c23[tr23];[0]pan=mono|c0=c24[tr24];[0]pan=mono|c0=c25[tr25];[0]pan=mono|c0=c26[tr26];[0]pan=mono|c0=c27[tr27];[0]pan=mono|c0=c28[tr28];[0]pan=mono|c0=c29[tr29];[0]pan=mono|c0=c30[tr30];[0]pan=mono|c0=c31[tr31];[0]pan=mono|c0=c32[tr32];[0]pan=mono|c0=c33[tr33];[0]pan=mono|c0=c34[tr34];[0]pan=mono|c0=c35[tr35];[0]pan=mono|c0=c36[tr36];[0]pan=mono|c0=c37[tr37];[0]pan=mono|c0=c38[tr38];[0]pan=mono|c0=c39[tr39];[0]pan=mono|c0=c40[tr40];[0]pan=mono|c0=c41[tr41];[0]pan=mono|c0=c42[tr42];[0]pan=mono|c0=c43[tr43];[0]pan=mono|c0=c44[tr44];[0]pan=mono|c0=c45[tr45];[0]pan=mono|c0=c46[tr46];[0]pan=mono|c0=c47[tr47];[0]pan=mono|c0=c48[tr48];[0]pan=mono|c0=c49[tr49];[0]pan=mono|c0=c50[tr50];[0]pan=mono|c0=c51[tr51];[0]pan=mono|c0=c52[tr52];[0]pan=mono|c0=c53[tr53];[0]pan=mono|c0=c54[tr54];[0]pan=mono|c0=c55[tr55];[0]pan=mono|c0=c56[tr56];[0]pan=mono|c0=c57[tr57];[0]pan=mono|c0=c58[tr58];[0]pan=mono|c0=c59[tr59];[0]pan=mono|c0=c60[tr60];[0]pan=mono|c0=c61[tr61];[0]pan=mono|c0=c62[tr62];[0]pan=mono|c0=c63[tr63]" -map_metadata -1 -c:a pcm_s24le -map "[tr0]" /Volumes/Data/magweg/64_test/speed_1.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr1]" /Volumes/Data/magweg/64_test/speed_2.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr2]" /Volumes/Data/magweg/64_test/speed_3.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr3]" /Volumes/Data/magweg/64_test/speed_4.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr4]" /Volumes/Data/magweg/64_test/speed_5.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr5]" /Volumes/Data/magweg/64_test/speed_6.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr6]" /Volumes/Data/magweg/64_test/speed_7.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr7]" /Volumes/Data/magweg/64_test/speed_8.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr8]" /Volumes/Data/magweg/64_test/speed_9.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr9]" /Volumes/Data/magweg/64_test/speed_10.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr10]" /Volumes/Data/magweg/64_test/speed_11.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr11]" /Volumes/Data/magweg/64_test/speed_12.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr12]" /Volumes/Data/magweg/64_test/speed_13.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr13]" /Volumes/Data/magweg/64_test/speed_14.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr14]" /Volumes/Data/magweg/64_test/speed_15.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr15]" /Volumes/Data/magweg/64_test/speed_16.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr16]" /Volumes/Data/magweg/64_test/speed_17.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr17]" /Volumes/Data/magweg/64_test/speed_18.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr18]" /Volumes/Data/magweg/64_test/speed_19.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr19]" /Volumes/Data/magweg/64_test/speed_20.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr20]" /Volumes/Data/magweg/64_test/speed_21.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr21]" /Volumes/Data/magweg/64_test/speed_22.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr22]" /Volumes/Data/magweg/64_test/speed_23.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr23]" /Volumes/Data/magweg/64_test/speed_24.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr24]" /Volumes/Data/magweg/64_test/speed_25.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr25]" /Volumes/Data/magweg/64_test/speed_26.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr26]" /Volumes/Data/magweg/64_test/speed_27.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr27]" /Volumes/Data/magweg/64_test/speed_28.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr28]" /Volumes/Data/magweg/64_test/speed_29.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr29]" /Volumes/Data/magweg/64_test/speed_30.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr30]" /Volumes/Data/magweg/64_test/speed_31.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr31]" /Volumes/Data/magweg/64_test/speed_32.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr32]" /Volumes/Data/magweg/64_test/speed_33.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr33]" /Volumes/Data/magweg/64_test/speed_34.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr34]" /Volumes/Data/magweg/64_test/speed_35.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr35]" /Volumes/Data/magweg/64_test/speed_36.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr36]" /Volumes/Data/magweg/64_test/speed_37.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr37]" /Volumes/Data/magweg/64_test/speed_38.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr38]" /Volumes/Data/magweg/64_test/speed_39.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr39]" /Volumes/Data/magweg/64_test/speed_40.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr40]" /Volumes/Data/magweg/64_test/speed_41.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr41]" /Volumes/Data/magweg/64_test/speed_42.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr42]" /Volumes/Data/magweg/64_test/speed_43.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr43]" /Volumes/Data/magweg/64_test/speed_44.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr44]" /Volumes/Data/magweg/64_test/speed_45.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr45]" /Volumes/Data/magweg/64_test/speed_46.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr46]" /Volumes/Data/magweg/64_test/speed_47.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr47]" /Volumes/Data/magweg/64_test/speed_48.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr48]" /Volumes/Data/magweg/64_test/speed_49.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr49]" /Volumes/Data/magweg/64_test/speed_50.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr50]" /Volumes/Data/magweg/64_test/speed_51.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr51]" /Volumes/Data/magweg/64_test/speed_52.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr52]" /Volumes/Data/magweg/64_test/speed_53.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr53]" /Volumes/Data/magweg/64_test/speed_54.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr54]" /Volumes/Data/magweg/64_test/speed_55.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr55]" /Volumes/Data/magweg/64_test/speed_56.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr56]" /Volumes/Data/magweg/64_test/speed_57.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr57]" /Volumes/Data/magweg/64_test/speed_58.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr58]" /Volumes/Data/magweg/64_test/speed_59.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr59]" /Volumes/Data/magweg/64_test/speed_60.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr60]" /Volumes/Data/magweg/64_test/speed_61.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr61]" /Volumes/Data/magweg/64_test/speed_62.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr62]" /Volumes/Data/magweg/64_test/speed_63.wav -y -map_metadata -1 -c:a pcm_s24le -map "[tr63]" /Volumes/Data/magweg/64_test/speed_64.wav -y 
> 
> 
>> 
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list