Replies: 1 comment
-
|
@schittli - Mostly due to the Windows environment, standard ffmpegio functions are not compatible with complex filters. You need to use low-level functions (e.g., However, you don't have a complex filter, it is a SISO (single-inpnut single-output) filter. Hence, you can use fsout,y = ff.audio.filter('[0:a]pan=1c|c0<0.5*c0+0.5*c1[a_mono];[a_mono]dynaudnorm=targetrms=0.95:correctdc=1[a_normalized]', fs, x) That is, simply replacing Just give you a quick lesson on FFmpeg filter expressions. What you have is actually a filter chain and not graph. As such, the minimal expression would be: Hope this helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Good evening
I have been trying to solve this puzzle since yesterday… although I use the debugger to analyze the code of python-ffmpegio, I unfortunately did not come to a solution.
Maybe someone with experience with python-ffmpegio knows what the solution must look like....
To explain the task, I have a working filter_complex command for the ffmpeg command line, but I am not able to transpose it to python-ffmpegio, so that Python does not save a file but return the filtered data back as a numpy array:
ffmpeg -i "Stereo.Wav" -filter_complex "[0:a]pan=1c|c0<0.5*c0+0.5*c1[a_mono];[a_mono]dynaudnorm=targetrms=0.95:correctdc=1[a_normalized]" -map "[a_normalized]" "Normalized-Mono.wav"ffmpeg is doing this:
The challenge for python-ffmpegio lies in this:
If possible, the filtered result should not be saved to a file, but returned as a numpy array. This way the data can be processed further without having to work with big temporary files.
I can contribute this additional information:
In Discussion Nr. 13, @tikuma-lsuhsc explained, how we can pass an numpy-array to an
ff.audio.filter()and get the result back as a numpy-array, so that we do not have to write a file 😀.He posted this ingenious, working code (please note the
'anull'parameter in the last line which allows to not write the result to a stream):Unfortunately, I did not manage to:
filter_complexparameter to the example code.For example, I got this error message, if I just added a filtergraph:
Multiple -filter, -af or -vf options specified for stream 0, only the last option '-filter:a anull' will be used.expr='anull'must not be empty forff.audio.filter(), so we can't just pass afilter_complexparameter.expr='anull'parameter into this definition:-filter_complex "[0:a]pan=1c|c0<0.5*c0+0.5*c1[a_mono];[a_mono]dynaudnorm=targetrms=0.95:correctdc=1[a_normalized]"Many thanks for any ideas / hints.
Also to learn if it is a limit of python-ffmpegio and can not work, then that is already a big help :-)
Thanks a lot, kind regards,
Thomas
Beta Was this translation helpful? Give feedback.
All reactions