Repository: livekit/egress

Issue:
[BUG] {publisher_identity} templating not working for segment output
**Describe the bug**
`{publisher_identity}` is not replaced when using `segment_outputs.filename_prefix`

<img width="412" height="462" alt="Image" src="https://github.com/user-attachments/assets/fcacf4f6-f937-41af-866e-9fc4cdd7ac80" />

**Egress Version**
`Image:          livekit/egress:v1.8.4`

**Egress Request**
Using participant auto-egress with the following json:
```
{
      "file_outputs": [{
        "file_type": "MP4",
        "filepath": "livekit-poc-auto/{room_name}/{time}-{publisher_identity}",
        "s3": {
          "region": "us-east-1",
          "bucket": "livekit-egress-buckett"
        }
      }],
      "segment_outputs": [
        {
          "filename_prefix": "livekit-poc-auto/{room_name}/hls/{time}-{publisher_identity}/",
          "playlist_name": "playlist.m3u8",
          "live_playlist_name": "playlist-live.m3u8",
          "segment_duration": 10,
          "s3": {
            "region": "us-east-1",
            "bucket": "livekit-egress-buckett"
          }
        }
      ]
}
```


**Additional context**
[Documentation ](https://docs.livekit.io/home/egress/outputs/#filename-templating)indicates that the `{publisher_identity}` token should be replaced for filename_prefix

**Logs**



Discussion:
@milos-lk: @aureus1 this should be fixed in the latest version:
https://github.com/livekit/egress/releases/tag/v1.11.0


Solution patch:
diff --git a/pkg/config/pipeline.go b/pkg/config/pipeline.go
index 4652340..28b986a 100644
--- a/pkg/config/pipeline.go
+++ b/pkg/config/pipeline.go
@@ -592,13 +592,14 @@ func (p *PipelineConfig) getRoomCompositeRequestType(req *livekit.RoomCompositeE
 
 // used for sdk input source
 func (p *PipelineConfig) UpdateInfoFromSDK(identifier string, replacements map[string]string, w, h uint32) error {
+	var err error
 	for egressType, c := range p.Outputs {
 		if len(c) == 0 {
 			continue
 		}
 		switch egressType {
 		case types.EgressTypeFile:
-			return c[0].(*FileConfig).updateFilepath(p, identifier, replacements)
+			err = c[0].(*FileConfig).updateFilepath(p, identifier, replacements)
 
 		case types.EgressTypeSegments:
 			o := c[0].(*SegmentConfig)
@@ -635,7 +636,7 @@ func (p *PipelineConfig) UpdateInfoFromSDK(identifier string, replacements map[s
 		}
 	}
 
-	return nil
+	return err
 }
 
 func (p *PipelineConfig) GetEncodedOutputs() []OutputConfig {



Test patch:
diff --git a/test/multi.go b/test/multi.go
index 49fd1be..630f8c1 100644
--- a/test/multi.go
+++ b/test/multi.go
@@ -79,11 +79,15 @@ func (r *Runner) testMulti(t *testing.T) {
 					videoDelay:     time.Second * 5,
 				},
 				fileOptions: &fileOptions{
-					filename: "participant_multiple_{time}",
+					filename: "participant_{publisher_identity}_multi_{time}.mp4",
 				},
 				streamOptions: &streamOptions{
 					outputType: types.OutputTypeRTMP,
 				},
+				segmentOptions: &segmentOptions{
+					prefix:   "participant_{publisher_identity}_multi_{time}",
+					playlist: "participant_{publisher_identity}_multi_{time}.m3u8",
+				},
 				multi: true,
 			},
 
@@ -144,6 +148,17 @@ func (r *Runner) runMultiTest(t *testing.T, test *testCase) {
 		r.verifyFile(t, test, p, res)
 	}
 	if test.segmentOptions != nil {
+		require.Len(t, res.GetSegmentResults(), 1)
+		segments := res.GetSegmentResults()[0]
+		require.Greater(t, segments.Size, int64(0))
+		require.NotContains(t, segments.PlaylistName, "{")
+		require.NotContains(t, segments.PlaylistLocation, "{")
+		if segments.LivePlaylistName != "" {
+			require.NotContains(t, segments.LivePlaylistName, "{")
+		}
+		if segments.LivePlaylistLocation != "" {
+			require.NotContains(t, segments.LivePlaylistLocation, "{")
+		}
 		r.verifySegments(t, test, p, test.segmentOptions.suffix, res, false)
 	}
 	if test.imageOptions != nil {