우분투 서버에 ffmpeg 설정하기

leverest96·2023년 9월 25일
0

Trouble Shooting

목록 보기
19/20
post-thumbnail

문제 인지

rtsp를 이용하여 카메라를 화면에 보여주기 위해 서버에 ffmpeg를 설치하는 도중 아래 에러 메세지를 보았다.

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn ffmpeg ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn ffmpeg',
  path: 'ffmpeg',
  spawnargs: [
    '-i',
    'rtsp://admin:ssafy@192.168.119.162:554/stream_ch00_0',
    '-f',
    'mpegts',
    '-codec:v',
    'mpeg1video',
    '-stats',
    '-r',
    '30',
    '-'
  ]
}

Node.js v18.16.1

문제해결 1

인터넷에 돌아다니는 것을 참고한 결과 수동으로 서버에 설치하는 방법이 있었다.

참고 사이트 : https://ysbsb.github.io/linux/2020/08/18/Linux-ffmpeg.html

하지만 나의 경우 전혀 먹지 않았다.

문제해결 2

단순하게 가보자라는 생각에 그냥 Dockerfile을 건드려보기로했다.

FROM node:18.16.1
WORKDIR /app/rtsp-camera

COPY rtsp-camera/package*.json ./
RUN npm install

RUN apt update && apt install -y sudo
RUN sudo apt install -y ffmpeg

COPY rtsp-camera/ ./

EXPOSE 9999

CMD ["node", "index.js"]

바로 먹었다. 이유는 모르겠다... 찾아보는 중...

profile
응애 난 애기 개발자

0개의 댓글