Cannot set headers after they are sent to the client

Getting this error.

FFMPEG ERROR { code: 255, cmd: '-threads 8 -ss 929.82 -t 318.436 -re -i http://192.168.53.151:32400/library/parts/65997/1544871312/file.mp4?X-Plex-Token=REDACTED- -filter_complex [0:0]null[v1];[v1]yadif[v] -map [v] -map 0:1 -c:v libx264 -c:a ac3 -ac 2 -ar 48000 -b:a 192k -b:v 10000k -s 1920x1080 -r 30 -flags cgop+ilme -sc_threshold 1000000000 -minrate:v 10000k -maxrate:v 10000k -bufsize:v 10000k -metadata service_provider="PseudoTV" -metadata service_name="Friends Channel" -f mpegts -output_ts_offset 0 -muxdelay 0 -muxpreload 0 pipe:1' } _http_outgoing.js:526 throw new ERR_HTTP_HEADERS_SENT('set'); ^

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at ServerResponse.setHeader (_http_outgoing.js:526:11) at ServerResponse.header (/snapshot/pseudotv-plex/node_modules/express/lib/response.js:771:10) at ServerResponse.contentType (/snapshot/pseudotv-plex/node_modules/express/lib/response.js:599:15) at ServerResponse.send (/snapshot/pseudotv-plex/node_modules/express/lib/response.js:145:14) at FFMPEG. (/snapshot/pseudotv-plex/dist/src/video.js:77:23) at FFMPEG.emit (events.js:311:20) at ChildProcess. (/snapshot/pseudotv-plex/dist/src/ffmpeg.js:153:99) at ChildProcess.emit (events.js:311:20) at maybeClose (internal/child_process.js:1021:16) at Socket. (internal/child_process.js:443:11) at Socket.emit (events.js:311:20) at Pipe. (net.js:668:12) { code: 'ERR_HTTP_HEADERS_SENT' }

Edited by Tim Dowker