OS/NanoPi
NanoPi M4V2 : GStreamer HLS 스트리밍 서버 구축
파란크리스마스
2021. 3. 1. 15:32
728x90
출처
- Stream live video to browser using GStreamer
- [Raspberry Pi 3] RTSP Server 설정
- [GStreamer] Gstreamer RTSP Server source code - Geany
- 라즈베리파이와 OpenCV 이야기 1 - OpenCV 영상 gstreamer로 보내기 : 네이버 블로그
- _공부하는 개발자_ :: II. 애플리케이션 만들기 : 4장. GStreamer 초기화
- 1. GStreamer 튜토리얼 : Hello World. 본 포스트는 gstreamer 공식 사이트의 문서를 요약 및 번역한… | by 최인탁 | Medium
- [Kinesis Video Streams] Raspberry PiからGStreamerを使用してTCPストリーム配信してみました。 | DevelopersIO
- GStreamer 프로그래밍 입문하기 | Life with Base Technology
- [NNStreamer] Gstreamer 기본 튜토리얼 1 - NiklasJang’s Blog
임시 디렉토리 생성
GStreamer HLS 관련 임시 파일 생성을 위한 디렉토리 생성합니다.
pi@NanoPi-M4v2:~$ mkdir hlstest
GStreamer 실행
playlist-root 옵션은 playlist.m3u8 파일 내 호출 주소를 전달 하기 위해서 외부 플레이어에서 접근 가능한 주소를 설정하고, location 옵션은 hls 관련 파일이 생성될 임시 작업 폴더를 지정합니다.
pi@NanoPi-M4v2:~$ gst-launch-1.0 rkisp device=/dev/video1 io-mode=4 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 \
! videoconvert ! clockoverlay ! x264enc tune=zerolatency ! mpegtsmux \
! hlssink playlist-root=http://192.168.0.5:8080 location=/home/pi/hlstest/segment_%05d.ts target-duration=5 max-files=5
Setting pipeline to PAUSED ...
media get entity by name: lens is null
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR rkisp_control_loop_impl.cpp:99: failed to get camera module info
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
XCAM ERROR rkisp_device.cpp:72: atomisp device(/dev/video1) try subdev format failed
Redistribute latency...
(gst-launch-1.0:2254): GStreamer-CRITICAL **: 09:06:59.673: gst_object_unref: assertion 'object != NULL' failed
윕서버 실행
HLS는 웹 스트리밍 프로토콜로 웹서버를 통해서 스트리밍 관련 파일을 전달하는데 GStreamer는 웹서버 기능이 없어서 python으로 웹서버를 이용하게 됩니다. 웹서비스 root 디렉토리로 이동하고 간이 웹서버를 실행합니다.
pi@NanoPi-M4v2:~$ cd hlstest/
pi@NanoPi-M4v2:~/hlstest$ python --version
Python 2.7.17
pi@NanoPi-M4v2:~/hlstest$ python -m SimpleHTTPServer 8080
Serving HTTP on 0.0.0.0 port 8080 ...
hls 주소
http://192.168.0.5:8080/playlist.m3u8
hls 재생



임시 디렉토리 목록 조회
pi@NanoPi-M4v2:~/hlstest$ ls
playlist.m3u8 segment_00180.ts segment_00181.ts segment_00182.ts segment_00183.ts segment_00184.ts
728x90