0

I have a nodejs server running on localhost that examines the incoming URL and if it sees a .m3u8 extension serves up the HLS streaming files to the client for playback. I also have the server start an FFMPEG child process to convert a UDP stream to HLS.

An example URL passed to the server might be http://localhost:7070/udphelp/239.255.1.1:59001/out.m3u8

Right now my server extracts that UDP address, starts FFMPEG to convert that UDP stream to HLS fine. However, I am finding that since UDP streams are "never ending" this is causing a block on the server from serving up the .m3u8 and .ts files for playback.

Is there a way to get FFMPEG to not block the server while its running? Or is there a better server to be using for this other than nodejs?

shreddish
  • 1,637
  • 8
  • 24
  • 38
  • Possible duplicate of [How to create threads in nodejs](http://stackoverflow.com/questions/18613023/how-to-create-threads-in-nodejs) – jperezov Feb 25 '16 at 23:03

1 Answers1

0

So since I didn't care about the IO of the FFMPEG process I used

ffmpegProc = process.spawn('../start-ffmpeg', [udpAddress], stdio: 'ignore', detached: true}).unref()

the start-ffmpeg is a bash script that calls ffmpeg with some parameters set and i pass in the udp address. This allowed my nodejs server to continue to server the HLS content after I started the FFMPEG process.

shreddish
  • 1,637
  • 8
  • 24
  • 38