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 cfe4b17 commit d36ba68
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
12 changes: 12 additions & 0 deletions services/transcode/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,16 @@ func AudioWav(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: "wav",
FileSize: fileInfo.Size(),
}, nil
}

Expand Down Expand Up @@ -161,9 +167,15 @@ func AudioMP3(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: "mp3",
FileSize: fileInfo.Size(),
}, nil
}
9 changes: 8 additions & 1 deletion services/transcode/linear_normalize.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package transcode

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

"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 @@ -45,7 +46,13 @@ func AdjustAudioLevel(input common.AudioInput, adjustment float64, cb ffmpeg.Pro
return nil, err
}

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

return &common.AudioResult{
OutputPath: outputPath,
FileSize: fileInfo.Size(),
}, nil
}

0 comments on commit d36ba68

Please sign in to comment.