[FFmpeg-user] Batch Join multimono to multichannel Auido (wav /

Luigi Rensinghoff soundgigi at freenet.de
Thu Jul 10 19:00:07 CEST 2014


Am 10.07.2014 um 17:52 schrieb Oliver Fromme <oliver at fromme.com>:

> Luigi Rensinghoff wrote:
>> i found the solution:
>> 
>> #!/bin/sh
>> 
>> for f in *C.aif;
>> do
>> 
>> #echo "Processing $f"
>> 
>> 
>> prefix=${f%}
>> pre=`echo $prefix | sed 's/.\{6\}$//'`
>> L=`echo $pre-\(L\).aif`
>> R=`echo $pre-\(R\).aif`
>> C=`echo $pre-C.aif`
>> LFE=`echo $pre-\LFE\.aif`
>> Ls=`echo $pre-S\(L\).aif`
>> Rs=`echo $pre-S\(R\).aif`
>> 
>> out=`${pre}_6ch.wav`
>> 
>> ffmpeg -i $L -i $R -i $C -i $LFE -i $Ls -i $Rs -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[aout]" -map "[aout]" ${f%-C.aif}_6ch.wav
>> 
>> rm $L
>> rm $R
>> rm $C
>> rm $LFE
>> rm $Ls
>> rm $Rs
>> 
>> done
>> 
>> But i am sure it can be achieved more elegant - Suggestions ???
> 
> *sigh*
> This is somewhat off-topic, but anyway, here is how I would do it:


It's off-topic, but useful ;-)  

thank you very much ....


I dont understand the highlighted parts ....  will do some more reading

Thanks a lot

Luigi

> 
> 
> #!/bin/sh
> 
> channels="L R C LFE Ls Rs"
> filter="[0:a][1:a][2:a][3:a][4:a][5:a]amerge=inputs=6[aout]"
> 
> for f in *-C.aif; do
>        #echo "Processing $f"
> 
>        pre="${f%-C.aif}"
>        set --
>        for c in $channels; do
>                set -- -i "$pre-$c.aif"
>        done
>        out="${pre}_6ch.wav"
> 
>        ffmpeg "$@" -filter_complex "$filter" -map "[aout]" "$out"
>        if [ $? -ne 0 ]; then
>                echo "****  ffmpeg failed!  Not removing input files!"
>                exit 1
>        fi
> 
>        for c in $channels; do
>                echo rm -- "$pre-$c.aif"
>        done
> done
> 
> 
> Note that it is written in a way that all variables are protected
> by quotes, so this works even if file names contain "unusual"
> characters like spaces, tabs or newlines.
> 
> Also note that the rm command has been disabled by an echo
> command.  I recommend you enable it only if you've tested the
> script and you are sure that it does the right thing.  Unless
> you have backup copies of the input files anyway, of course.
> 
> Best regards
>   Oliver
> 
> -- 
> ``We are all but compressed light'' (Albert Einstein)
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list