Skip to content

Commit

Permalink
feat(bmm): export with filesize
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikvedvik committed Nov 17, 2023
1 parent b1fc173 commit cfe4b17
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions common/transcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type AudioResult struct {
OutputPath paths.Path
Bitrate string
Format string
FileSize int64
}

type MuxInput struct {
Expand Down
9 changes: 8 additions & 1 deletion services/transcode/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package transcode

import (
"fmt"
"github.com/bcc-code/bccm-flows/paths"
"os"
"path/filepath"
"strconv"
"strings"

"github.com/bcc-code/bccm-flows/paths"

"github.com/bcc-code/bccm-flows/common"
"github.com/bcc-code/bccm-flows/services/ffmpeg"
)
Expand Down Expand Up @@ -46,10 +47,16 @@ func AudioAac(input common.AudioInput, cb ffmpeg.ProgressCallback) (*common.Audi
return nil, err
}

fileInfo, err := os.Stat(outputFilePath)
if err != nil {
return nil, err
}

return &common.AudioResult{
OutputPath: outputPath,
Bitrate: input.Bitrate,
Format: "aac",
FileSize: fileInfo.Size(),
}, nil
}

Expand Down
2 changes: 2 additions & 0 deletions workflows/export/vx_export_bmm.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ type BMMAudioFile struct {
Peak float64 `json:"peak"`
Language string `json:"language"`
MimeType string `json:"mime_type"`
Size int64 `json:"size"`
}

func prepareBMMData(audioFiles map[string][]common.AudioResult, analysis map[string]activities.NormalizeAudioResult) BMMData {
Expand All @@ -243,6 +244,7 @@ func prepareBMMData(audioFiles map[string][]common.AudioResult, analysis map[str
Lufs: analysis[lang].OutputAnalysis.IntegratedLoudness,
DynamicRange: analysis[lang].OutputAnalysis.LoudnessRange,
Language: lang,
Size: file.FileSize,
}

switch {
Expand Down

0 comments on commit cfe4b17

Please sign in to comment.