diff --git a/services/transcode/merge.go b/services/transcode/merge.go index 98a795af..a8f1e25f 100644 --- a/services/transcode/merge.go +++ b/services/transcode/merge.go @@ -115,7 +115,7 @@ func mergeItemToStereoStream(index int, tag string, item common.MergeInputItem) if channels == 0 { streamString += fmt.Sprintf("anullsrc=channel_layout=stereo[%s]", tag) } else if channels == 2 { - streamString += fmt.Sprintf("amerge[%s]", tag) + streamString += fmt.Sprintf("amerge=inputs=2[%s]", tag) } else { streamString += fmt.Sprintf("amerge=inputs=%d[%s]", channels, tag) } diff --git a/services/vidispine/export.go b/services/vidispine/export.go index 0e0b6543..3dc5bdbb 100644 --- a/services/vidispine/export.go +++ b/services/vidispine/export.go @@ -177,8 +177,8 @@ func (s *VidispineService) getEmbeddedAudio(clip *Clip, languagesToExport []stri } shape := shapes.GetShape("original") - if len(shape.AudioComponent) != 16 && len(shape.AudioComponent) > 1 { - return clip, fmt.Errorf("found %d audio components, expected 1 or 16", len(shape.AudioComponent)) + if len(shape.AudioComponent) != 16 && len(shape.AudioComponent) > 2 { + return clip, fmt.Errorf("found %d audio components, expected 1, 2 or 16", len(shape.AudioComponent)) } if len(shape.AudioComponent) == 0 { @@ -207,6 +207,25 @@ func (s *VidispineService) getEmbeddedAudio(clip *Clip, languagesToExport []stri return clip, nil } + if len(shape.AudioComponent) == 2 { + var streams []int + for _, c := range shape.AudioComponent { + streams = append(streams, c.EssenceStreamID) + if c.ChannelCount != 1 { + return clip, fmt.Errorf("found %d channels in audio component, expected 1", c.ChannelCount) + } + } + + for _, lang := range languagesToExport { + + clip.AudioFiles[lang] = &AudioFile{ + VXID: clip.VXID, + File: shape.GetPath(), + Streams: streams, + } + } + } + for _, lang := range languagesToExport { // We have an actual 16 channel audio file, so we need to figure out which channels to use // and assign them to the correct language