Skip to content

Commit 3e1aab0

Browse files
committed
Add XDCAM export
1 parent f15b317 commit 3e1aab0

File tree

5 files changed

+75
-25
lines changed

5 files changed

+75
-25
lines changed

workflows/export/vx_export.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import (
2121
type AssetExportDestination enum.Member[string]
2222

2323
var (
24-
AssetExportDestinationPlayout = AssetExportDestination{Value: "playout"}
24+
AssetExportDestinationXDCAM = AssetExportDestination{Value: "xdcam"}
2525
AssetExportDestinationVOD = AssetExportDestination{Value: "vod"}
2626
AssetExportDestinationBMM = AssetExportDestination{Value: "bmm"}
2727
AssetExportDestinationBMMIntegration = AssetExportDestination{Value: "bmm-integration"}
2828
AssetExportDestinationIsilon = AssetExportDestination{Value: "isilon"}
2929
AssetExportDestinations = enum.New(
30-
AssetExportDestinationPlayout,
30+
AssetExportDestinationXDCAM,
3131
AssetExportDestinationVOD,
3232
AssetExportDestinationBMM,
3333
AssetExportDestinationBMMIntegration,
@@ -39,7 +39,7 @@ type VXExportParams struct {
3939
VXID string
4040
WithChapters bool
4141
WatermarkPath string
42-
Destinations []string `jsonschema:"enum=vod,enum=playout,enum=bmm,enum=bmm-integration,enum=isilon"`
42+
Destinations []string `jsonschema:"enum=vod,enum=xdcam,enum=bmm,enum=bmm-integration,enum=isilon"`
4343
AudioSource string
4444
Languages []string
4545
Subclip string
@@ -218,8 +218,8 @@ func VXExport(ctx workflow.Context, params VXExportParams) ([]wfutils.ResultOrEr
218218
fallthrough
219219
case AssetExportDestinationVOD:
220220
w = VXExportToVOD
221-
case AssetExportDestinationPlayout:
222-
w = VXExportToPlayout
221+
case AssetExportDestinationXDCAM:
222+
w = VXExportToXDCAM
223223
case AssetExportDestinationBMM, AssetExportDestinationBMMIntegration:
224224
w = VXExportToBMM
225225
default:

workflows/export/vx_export_playout.go

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@ import (
44
"github.com/bcc-code/bcc-media-flows/services/rclone"
55
"github.com/bcc-code/bcc-media-flows/services/telegram"
66
"github.com/bcc-code/bcc-media-flows/utils"
7-
"path/filepath"
87

98
"github.com/bcc-code/bcc-media-flows/activities"
109
"github.com/bcc-code/bcc-media-flows/common"
1110
wfutils "github.com/bcc-code/bcc-media-flows/utils/workflows"
1211
"go.temporal.io/sdk/workflow"
1312
)
1413

15-
// VXExportToPlayout is a workflow that exports a VX to the playout system
16-
// It transcodes the video to XDCAM HD 50Mbit/s and muxes it with the audio and subtitle files
17-
func VXExportToPlayout(ctx workflow.Context, params VXExportChildWorkflowParams) (*VXExportResult, error) {
14+
func VXExportToXDCAM(ctx workflow.Context, params VXExportChildWorkflowParams) (*VXExportResult, error) {
1815
logger := workflow.GetLogger(ctx)
19-
logger.Info("Starting ExportToPlayout")
16+
logger.Info("Starting ExportToXDCAM")
2017

2118
ctx = workflow.WithActivityOptions(ctx, wfutils.GetDefaultActivityOptions())
2219

@@ -53,25 +50,13 @@ func VXExportToPlayout(ctx workflow.Context, params VXExportChildWorkflowParams)
5350
return nil, err
5451
}
5552

56-
// Rclone to playout
57-
destination := "playout:/tmp"
58-
if err != nil {
59-
return nil, err
60-
}
53+
destination := "brunstad:/Delivery/XDCAM"
6154
err = wfutils.RcloneCopyDir(ctx, params.OutputDir.Rclone(), destination, rclone.PriorityNormal)
6255
if err != nil {
6356
return nil, err
6457
}
6558

66-
err = wfutils.Execute(ctx, activities.Util.FtpPlayoutRename, activities.FtpPlayoutRenameParams{
67-
From: filepath.Join("/tmp/", muxResult.Path.Base()),
68-
To: filepath.Join("/dropbox/", muxResult.Path.Base()),
69-
}).Get(ctx, nil)
70-
if err != nil {
71-
return nil, err
72-
}
73-
74-
notifyExportDone(ctx, telegram.ChatOslofjord, params, "playout", '🟩')
59+
notifyExportDone(ctx, telegram.ChatOslofjord, params, "xdcam", '🟩')
7560

7661
return &VXExportResult{
7762
ID: params.ParentParams.VXID,

workflows/vb_export/vb_export.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var (
3131
DestinationHippo = Destination{Value: "hippo"}
3232
DestinationHippoV2 = Destination{Value: "hippo_v2"}
3333
DestinationDubbing = Destination{Value: "dubbing"}
34+
DestinationXDCAM = Destination{Value: "xdcam"}
3435
Destinations = enum.New(
3536
DestinationAbekas,
3637
DestinationBStage,
@@ -39,6 +40,7 @@ var (
3940
DestinationHippoV2,
4041
DestinationDubbing,
4142
DestinationHyperdeck,
43+
DestinationXDCAM,
4244
)
4345
deliveryFolder = paths.New(paths.BrunstadDrive, "/Delivery/FraMB/")
4446
)
@@ -212,6 +214,8 @@ func VBExport(ctx workflow.Context, params VBExportParams) ([]wfutils.ResultOrEr
212214
w = VBExportToHippoV2
213215
case DestinationDubbing:
214216
w = VBExportToDubbing
217+
case DestinationXDCAM:
218+
w = VBExportToXDCAM
215219

216220
default:
217221
return nil, fmt.Errorf("destination not implemented: %s", dest)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package vb_export
2+
3+
import (
4+
"github.com/bcc-code/bcc-media-flows/activities"
5+
"github.com/bcc-code/bcc-media-flows/services/rclone"
6+
"github.com/bcc-code/bcc-media-flows/services/telegram"
7+
"github.com/bcc-code/bcc-media-flows/utils"
8+
wfutils "github.com/bcc-code/bcc-media-flows/utils/workflows"
9+
"go.temporal.io/sdk/workflow"
10+
)
11+
12+
func VBExportToXDCAM(ctx workflow.Context, params VBExportChildWorkflowParams) (*VBExportResult, error) {
13+
logger := workflow.GetLogger(ctx)
14+
logger.Info("Starting XDCAM")
15+
16+
ctx = workflow.WithActivityOptions(ctx, wfutils.GetDefaultActivityOptions())
17+
18+
outputDir := params.TempDir.Append("xdcam_output")
19+
err := wfutils.CreateFolder(ctx, outputDir)
20+
if err != nil {
21+
return nil, err
22+
}
23+
24+
videoResult, err := wfutils.Execute(ctx, activities.Video.TranscodeToXDCAMActivity, activities.EncodeParams{
25+
FilePath: params.InputFile,
26+
OutputDir: outputDir,
27+
Resolution: utils.Resolution1080,
28+
FrameRate: 25,
29+
Interlace: true,
30+
Bitrate: "50M",
31+
BurnInSubtitle: params.SubtitleFile,
32+
SubtitleStyle: params.SubtitleStyle,
33+
}).Result(ctx)
34+
if err != nil {
35+
return nil, err
36+
}
37+
38+
extraFileName := ""
39+
if params.SubtitleFile != nil {
40+
extraFileName += "_SUB_NOR"
41+
}
42+
43+
rcloneDestination := deliveryFolder.Append("XDCAM", params.OriginalFilenameWithoutExt+extraFileName+videoResult.OutputPath.Ext())
44+
45+
err = wfutils.RcloneWaitForFileGone(ctx, rcloneDestination, telegram.ChatOslofjord, 10)
46+
if err != nil {
47+
return nil, err
48+
}
49+
50+
err = wfutils.RcloneCopyFileWithNotifications(ctx, videoResult.OutputPath, rcloneDestination, rclone.PriorityHigh, rcloneNotificationOptions)
51+
if err != nil {
52+
return nil, err
53+
}
54+
55+
notifyExportDone(ctx, params, "xdcam", videoResult.OutputPath)
56+
57+
return &VBExportResult{
58+
ID: params.ParentParams.VXID,
59+
}, nil
60+
}

workflows/workflows.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var WorkerWorkflows = []any{
4444
ingestworkflows.BmmIngestUpload,
4545
export.VXExport,
4646
export.VXExportToVOD,
47-
export.VXExportToPlayout,
47+
export.VXExportToXDCAM,
4848
export.MergeExportData,
4949
export.VXExportToBMM,
5050
export.IsilonExport,
@@ -76,6 +76,7 @@ var WorkerWorkflows = []any{
7676
vb_export.VBExportToHippoV2,
7777
vb_export.VBExportToDubbing,
7878
vb_export.VBExportToHyperdeck,
79+
vb_export.VBExportToXDCAM,
7980
scheduled.CleanupTemp,
8081
scheduled.MediabankenPurgeTrash,
8182
// Massive.app import workflow

0 commit comments

Comments
 (0)