简体   繁体   中英

node.js reading file multiple instances

my node.js server is going to spawn a child proccess which launches VLC for taking a photo of a video and then send back the photo.

With nginx as a load balancer I'm going to have 4 node.js instances (the number of my server's cores). Is it better to have 4 different video files (one per instance)?

Since you are spawning a child process, node isn't technically interactive with the video at all, it is interacting with VLC, which is interacting with the video. So it will spawn four different VLC process. So really it would be more of a questions if the child process would have any benefit from having it's own video, and you will have as many child processes as you do requests.

From what I understand from the question, this video is probably streaming, and you want to take a still-shot from it, in which case I would take the time as a paramater, and launch the VLC child process like so:

C:\VideoLAN\VLC>vlc "path/to/video" --video-filter=scene 
--vout=dummy --start-time=1 --stop-time=5 --scene-ratio=1 
--scene-prefix=img- --scene-path=path/to/image vlc://quit

VLC should be able to handle accessing this file multiple times (one per request).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM