Trying to encode video in a fairly generalized manner a typical call will look like:
HandBrakeCLI --encoder-preset medium --encoder-level 4.1 --format av_mkv --encoder x264 --quality 21 --aencoder aac,ac3 --audio-copy-mask aac,ac3,dtshd,dts,mp3 -a 1,2 -s 0,1,2,3,4 -x threads=38 -i Input.mkv -o Output.mkv
The issue is that I want to do the following with audio tracks:
- If there a high bitrate track (e.g. dts) convert it to ac3
- If there is an aac track re-encode it (or copy it)
- If there is no aac track and a high bitrate track create an aac track
Essentially, how would I be able to conditionally choose what to do based on the audio track or would I need to do some sort of pre-processing to identify what kind of audio tracks I am dealing with and change the command programmatically based on that?