Skip to content

Commit

Permalink
feat(export): allow 2 mono channels
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikvedvik committed Sep 29, 2023
1 parent b416111 commit c3a292d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion services/transcode/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
23 changes: 21 additions & 2 deletions services/vidispine/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c3a292d

Please sign in to comment.