Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio downmix + all #330

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ingestfile
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ AUDIODECISION.option = Only use right of the first audio track
AUDIODECISION.option = Only use the first track
AUDIODECISION.option = Downmix the first two mono tracks
AUDIODECISION.option = Downmix all tracks
AUDIODECISION.option = Downmix all tracks plus keep originals as extra tracks
AUDIODECISION.width = 400

# cropping strategy
Expand Down
6 changes: 5 additions & 1 deletion makederiv
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ _usage(){
echo " -l (only use the left channel of the first audio track)"
echo " -r (only use the right channel of the first audio track)"
echo " -a (downmix all audio tracks into a stereo output)"
echo " -A (downmix all audio tracks into a stereo output plus keep individual tracks as extra audio channels)"
echo " -t (burn timecode overlay)"
echo " -u subtitle_file (burn in a subtitle file)"
echo " -w (burn pts overlay)"
Expand Down Expand Up @@ -62,14 +63,15 @@ _usage(){

user_input=${@}
OPTIND=1
while getopts ":T:lrmDav:d:o:N:e:E:F:scYp:tu:wXCS:I:O:nh" OPT ; do
while getopts ":T:lrmDaAv:d:o:N:e:E:F:scYp:tu:wXCS:I:O:nh" OPT ; do
case "${OPT}" in
T) OUTPUT_TYPE="${OPTARG}";;
l) AUDIOMAP="L";;
r) AUDIOMAP="R";;
m) AUDIOMAP="M";;
D) AUDIOMAP="D";;
a) AUDIOMAP="A";;
A) AUDIOMAP="A+";;
v) VOLADJUST="${OPTARG}";;
d) DELIVERDIR="${OPTARG}" && (_check_deliverdir) ;;
o) OUTPUTDIR_FORCED="${OPTARG}" && (_check_outputdir_forced) ;;
Expand Down Expand Up @@ -305,6 +307,8 @@ while [[ "${@}" != "" ]] ; do
AUDIOMAP="D"
elif [[ "${AUDIODECISION}" == "Downmix all tracks" ]] ; then
AUDIOMAP="A"
elif [[ "${AUDIODECISION}" == "Downmix all tracks plus keep originals as extra tracks" ]] ; then
AUDIOMAP="A+"
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion makewindow
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ _usage(){
"${SCRIPTDIR}/makederiv" -h
}
[ "${#}" = 0 ] && _usage
"${SCRIPTDIR}/makederiv" -T window -X -a "${@}"
"${SCRIPTDIR}/makederiv" -T window -X -A "${@}"
17 changes: 15 additions & 2 deletions mmfunctions
Original file line number Diff line number Diff line change
Expand Up @@ -1245,13 +1245,26 @@ _get_audio_mapping(){
elif [[ "${AUDIOMAP}" = "A" ]] ; then
unset AMERGE_LIST
C=0
while "$C" -lte "${AUDIO_TRACK_COUNT}" ; do
AMERGE_LIST+="[0:a:$i]"
while [[ "$C" -lt "${AUDIO_TRACK_COUNT}" ]] ; do
AMERGE_LIST+="[0:a:${C}]"
((C++))
done
_report -wt "Will mix together ${AUDIO_TRACK_COUNT} tracks into a stereo output."
_add_audio_filter -p "${AMERGE_LIST}amerge=inputs=${AUDIO_TRACK_COUNT}"
_add_audio_filter "aformat=channel_layouts=stereo"
elif [[ "${AUDIOMAP}" = "A+" ]] ; then
unset AMERGE_LIST
C=0
MIDDLEOPTIONS+=(-map "[downmix]")
MIDDLEOPTIONS+=(-disposition:a:1 default)
while [[ "$C" -lt "${AUDIO_TRACK_COUNT}" ]] ; do
AMERGE_LIST+="[0:a:${C}]"
MIDDLEOPTIONS+=(-map "0:a:${C}")
((C++))
done
_report -wt "Will mix together ${AUDIO_TRACK_COUNT} tracks into a stereo output."
_add_audio_filter -p "${AMERGE_LIST}amerge=inputs=${AUDIO_TRACK_COUNT}"
_add_audio_filter "aformat=channel_layouts=stereo[downmix]"
elif [[ "${MULTIMONO}" = true && "${1#*.}" != "mkv" ]] ; then
_report -wt "The first two audio tracks of this non matroska file are both mono. Considering track 1 for left and track 2 for right."
_add_audio_filter -p "[0:a:0][0:a:1]amerge=inputs=2"
Expand Down