This message was deleted.
# helpdesk
s
This message was deleted.
d
Here is the code :
Copy code
var egressID string

	egress, err := EgressClient.StartTrackEgress(context.Background(), &livekit.TrackEgressRequest{
		RoomName: meta.RoomKey,
		TrackId:  track.ID(),
		Output: &livekit.TrackEgressRequest_File{File: &livekit.DirectFileOutput{
			Filepath: "/out/test",
		}},
	})

	egressID = egress.EgressId
Copy code
func onTrackUnsubscribed(track *webrtc.TrackRemote, publication *lksdk.RemoteTrackPublication, rp *lksdk.RemoteParticipant) {
	egress, err := EgressClient.StopEgress(context.Background(), &livekit.StopEgressRequest{EgressId: egressID})
	if err != nil {
		return
	}
	log.Println(egress.String())
}
d
CC @able-gigabyte-21598 I don't believe we are continuing to support
DirectFileOutput
a
DirectFileOutput
is for track egress
Is this an H264 video track? Can you share the log that says
writer finished
and includes some stats about the track?
d
yes it's a h264 track.
here is the livekit server log :
Copy code
rtc/participant.go:1817	unpublished track	{"room": "test", "roomID": "RM_6ooVkzE3AUCZ", "participant": "9idUkz34YDb9go", "pID": "PA_PcJrtnA9jpTy", "remote": false, "trackID": "TR_VSGzcvbvPT7eRq", "trackInfo": "sid:\"TR_VSGzcvbvPT7eRq\" type:VIDEO width:1457 height:819 source:SCREEN_SHARE layers:{quality:HIGH width:1457 height:819 bitrate:256000} mime_type:\"video/H264\" codecs:{mime_type:\"video/h264\" cid:\"5fae84d2-2c2c-4403-bff4-d93f7f63eb2c\"}"}

service/ioinfo.go:76	egress failed	{"egressID": "EG_oLhHseu8dUeB", "error": "pipeline frozen"}
<http://github.com/livekit/livekit-server/pkg/service.(*IOInfoService).UpdateEgressInfo|github.com/livekit/livekit-server/pkg/service.(*IOInfoService).UpdateEgressInfo>
	/home/runner/go/pkg/mod/github.com/livekit/livekit-server@v1.4.4/pkg/service/ioinfo.go:76
<http://github.com/livekit/psrpc/pkg/server.(*rpcHandlerImpl[...]).handleRequest|github.com/livekit/psrpc/pkg/server.(*rpcHandlerImpl[...]).handleRequest>
	/home/runner/go/pkg/mod/github.com/livekit/psrpc@v0.3.1/pkg/server/rpc.go:171
<http://github.com/livekit/psrpc/pkg/server.(*rpcHandlerImpl[...]).run.func1.1|github.com/livekit/psrpc/pkg/server.(*rpcHandlerImpl[...]).run.func1.1>
	/home/runner/go/pkg/mod/github.com/livekit/psrpc@v0.3.1/pkg/server/rpc.go:119
here is the egress log :
Copy code
cudaloader gstcudaloader.c:169:gst_cuda_load_library: Could not open library libcuda.so.1, libcuda.so.1: cannot open shared object file: No such file or directory
nvcodec plugin.c:94:plugin_init: Failed to load cuda library

[gst warning] gst_pad_query_accept_caps_default: caps: video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)0142c01fffe200106742c01f8c8d4020024f5c03c2211a8000186742c01f0fd91f888884000003000400000300c83c60c9200100066887cb83cb20, level=(string)3.1, profile=(string)baseline, width=(int)2, height=(int)2, framerate=(fraction)25/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true were not compatible with: EMPTY	{"nodeID": "NE_oRenvxnMrEdK", "handlerID": "EGH_7Uu8tEeACTxj", "clusterID": "", "egressID": "EG_oLhHseu8dUeB", "caller": "../gst/gstpad.c:3240", "object": "video_0"}

[gst warning] pre_eventfunc_check: caps video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)0142c01fffe200106742c01f8c8d4020024f5c03c2211a8000186742c01f0fd91f888884000003000400000300c83c60c9200100066887cb83cb20, level=(string)3.1, profile=(string)baseline, width=(int)2, height=(int)2, framerate=(fraction)25/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true not accepted	{"nodeID": "NE_oRenvxnMrEdK", "handlerID": "EGH_7Uu8tEeACTxj", "clusterID": "", "egressID": "EG_oLhHseu8dUeB", "caller": "../gst/gstpad.c:5787", "object": "proxypad1"}

service/handler.go:210	egress updated	{"nodeID": "NE_oRenvxnMrEdK", "handlerID": "EGH_7Uu8tEeACTxj", "clusterID": "", "egressID": "EG_oLhHseu8dUeB", "egressID": "EG_oLhHseu8dUeB", "requestType": "track", "outputType": "file", "status": "EGRESS_ENDING"}

pipeline/pipeline.go:406	sending EOS to pipeline	{"nodeID": "NE_oRenvxnMrEdK", "handlerID": "EGH_7Uu8tEeACTxj", "clusterID": "", "egressID": "EG_oLhHseu8dUeB"}

sdk/appwriter.go:180	writer finished	{"nodeID": "NE_oRenvxnMrEdK", "handlerID": "EGH_7Uu8tEeACTxj", "clusterID": "", "egressID": "EG_oLhHseu8dUeB", "trackID": "TR_VSGzcvbvPT7eRq", "kind": "video", "sampleDuration": "65.666667ms", "avgDrift": "107.937µs", "maxDrift": "528.597µs", "packetLoss": "0.00%"}

pipeline/pipeline.go:409	pipeline frozen	{"nodeID": "NE_oRenvxnMrEdK", "handlerID": "EGH_7Uu8tEeACTxj", "clusterID": "", "egressID": "EG_oLhHseu8dUeB", "stream": false}

<http://github.com/livekit/egress/pkg/pipeline.(*Pipeline).SendEOS.func1.1.1|github.com/livekit/egress/pkg/pipeline.(*Pipeline).SendEOS.func1.1.1>
	/workspace/pkg/pipeline/pipeline.go:409

pipeline/pipeline.go:540	SetStateNull timed out	{"nodeID": "NE_oRenvxnMrEdK", "handlerID": "EGH_7Uu8tEeACTxj", "clusterID": "", "egressID": "EG_oLhHseu8dUeB"}
<http://github.com/livekit/egress/pkg/pipeline.(*Pipeline).stop|github.com/livekit/egress/pkg/pipeline.(*Pipeline).stop>
	/workspace/pkg/pipeline/pipeline.go:540
<http://github.com/livekit/egress/pkg/pipeline.(*Pipeline).Run.func3|github.com/livekit/egress/pkg/pipeline.(*Pipeline).Run.func3>
	/workspace/pkg/pipeline/pipeline.go:216

pipeline/pipeline.go:544	pipeline stopped	{"nodeID": "NE_oRenvxnMrEdK", "handlerID": "EGH_7Uu8tEeACTxj", "clusterID": "", "egressID": "EG_oLhHseu8dUeB"}
service/handler.go:198	egress failed	{"nodeID": "NE_oRenvxnMrEdK", "handlerID": "EGH_7Uu8tEeACTxj", "clusterID": "", "egressID": "EG_oLhHseu8dUeB", "egressID": "EG_oLhHseu8dUeB", "requestType": "track", "outputType": "file", "error": "pipeline frozen"}
@able-gigabyte-21598 any update on this?? :(
a
will be investigating today. I’ll let you know when I have a fix
d
@able-gigabyte-21598 I'm just curious why didn't you use ultrafast preset instead of veryfast and tune=zerolatency for x264enc ?🤔
a
It was a while ago when I tested out the options, but I think the image quality was better with veryfast/zerolatency. @chilly-animal-65189 might know more details
by the way, I’ve merged some changes to try to fix the pipeline frozen issue. I’ll know tomorrow whether it fixed the issue or not. If those don’t fix it, https://github.com/livekit/egress/pull/437 should also help, but we need to wait for the author to sign the CLA
🙏 1
c
While we haven't made tons of tests for the specific egress use case, veryfast is typically considered a sweet spot for the encoding speed vs performance trade off. zerolatency tuning has a large impact on output quality at a given rate because it disables b frames and lookahead. It also enables slice threads, which also has a quality impact and has compatibility issues with some decoders. Codec latency should also not be that relevant for egress (ingress would be a bit more impacted)
👍 1