amazon kinesis video stream 다운로드
좀 더 자세한 설명은 https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp 에 들어가게 되면 상세하게 알려준다.
GitHub - awslabs/amazon-kinesis-video-streams-producer-sdk-cpp: Amazon Kinesis Video Streams Producer SDK for C++ is for develop
Amazon Kinesis Video Streams Producer SDK for C++ is for developers to install and customize for their connected camera and other devices to securely stream video, audio, and time-encoded data to K...
github.com
git clone --recursive https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp.git
우선 git clone을 통해 git 파일을 받아준다.
git을 받으면 이러한 폴더가 생성된것을 볼 수 있다.
sudo mkdir -p amazon-kinesis-video-streams-producer-sdk-cpp/build
cd amazon-kinesis-video-streams-producer-sdk-cpp/build
이전으로 돌아와
해당 명령어를 통해서 build 폴더를 만들고 build 위치로 이동하면 된다.
해당 위치에서
cmake ..
해당 명령어를 실행해주면 된다.
성공적으로 설치가 된다. 그뒤에는 라이브러리를 설치해주면 된다. 필요 라이브러리는 다음과 같다.
sudo apt-get install libssl-dev libcurl4-openssl-dev liblog4cplus-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-bad gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-tools
라이브러리를 설치가 완료 되었다면
상위 폴더로 올라와서
위와 같이 make 커맨드를 이용해주면 기본적으로 필요한 예제 코드나 빌드 파일들을 설치하게 된다.
예제 실행하기에 앞서서 환경 변수를 설정해준다. 설정하지 않으면 오류가 발생한다.
export GST_PLUGIN_PATH=`pwd`/build
export LD_LIBRARY_PATH=`pwd`/open-source/local/lib
gst-inspect-1.0 kvssink 해당 명령어를 실행하게 되면 아래와 같은 정보가 나오면 설치가 무사히 끝난것이다.(환경변수가 완료된 상태여야 해당 명령어를 사용 할 수 있다.
pi@raspberrypi:~/Desktop/amazon-kinesis-video-streams-producer-sdk-cpp $ export GST_PLUGIN_PATH=`pwd`/build
pi@raspberrypi:~/Desktop/amazon-kinesis-video-streams-producer-sdk-cpp $ export LD_LIBRARY_PATH=`pwd`/open-source/local/lib
pi@raspberrypi:~/Desktop/amazon-kinesis-video-streams-producer-sdk-cpp $ gst-inspect-1.0 kvssink
Factory Details:
Rank primary + 10 (266)
Long-name KVS Sink
Klass Sink/Video/Network
Description GStreamer AWS KVS plugin
Author AWS KVS <kinesis-video-support@amazon.com>
Plugin Details:
Name kvssink
Description GStreamer AWS KVS plugin
Filename /home/pi/Desktop/amazon-kinesis-video-streams-producer-sdk-cpp/build/libgstkvssink.so
Version 1.0
License Proprietary
Source module kvssinkpackage
Binary package GStreamer
Origin URL http://gstreamer.net/
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstKvsSink
Pad Templates:
SINK template: 'video_%u'
Availability: On request
Capabilities:
video/x-h264
stream-format: avc
alignment: au
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
video/x-h265
alignment: au
width: [ 16, 2147483647 ]
height: [ 16, 2147483647 ]
SINK template: 'audio_%u'
Availability: On request
Capabilities:
audio/mpeg
mpegversion: { (int)2, (int)4 }
stream-format: raw
channels: [ 1, 2147483647 ]
rate: [ 1, 2147483647 ]
audio/x-alaw
channels: { (int)1, (int)2 }
rate: [ 8000, 192000 ]
audio/x-mulaw
channels: { (int)1, (int)2 }
rate: [ 8000, 192000 ]
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
none
Element Properties:
name : The name of the object
flags: readable, writable
String. Default: "kvssink0"
parent : The parent of the object
flags: readable, writable
Object of type "GstObject"
stream-name : Name of the destination stream
flags: readable, writable
String. Default: "DEFAULT_STREAM"
retention-period : Length of time stream is preserved. Unit: hours
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 2
streaming-type : Streaming type
flags: readable, writable
Enum "GstKvsSinkStreamingType" Default: 0, "realtime"
(0): realtime - streaming type realtime
(1): near-realtime - streaming type near realtime
(2): offline - streaming type offline
content-type : content type
flags: readable, writable
String. Default: null
max-latency : Max Latency. Unit: seconds
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 60
fragment-duration : Fragment Duration. Unit: miliseconds
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 2000
timecode-scale : Timecode Scale. Unit: milliseconds
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 1
key-frame-fragmentation: If true, generate new fragment on each keyframe, otherwise generate new fragment on first keyframe after fragment-duration has passed.
flags: readable, writable
Boolean. Default: true
frame-timecodes : Do frame timecodes
flags: readable, writable
Boolean. Default: true
absolute-fragment-times: Use absolute fragment time
flags: readable, writable
Boolean. Default: true
fragment-acks : Do fragment acks
flags: readable, writable
Boolean. Default: true
restart-on-error : Do restart on error
flags: readable, writable
Boolean. Default: true
recalculate-metrics : Do recalculate metrics
flags: readable, writable
Boolean. Default: true
framerate : Framerate
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 25
avg-bandwidth-bps : Average bandwidth bps
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 4194304
buffer-duration : Buffer duration. Unit: seconds
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 120
replay-duration : Replay duration. Unit: seconds
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 40
connection-staleness: Connection staleness. Unit: seconds
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 60
codec-id : Codec ID
flags: readable, writable
String. Default: "V_MPEG4/ISO/AVC"
track-name : Track name
flags: readable, writable
String. Default: "kinesis_video"
access-key : AWS Access Key
flags: readable, writable
String. Default: "access_key"
secret-key : AWS Secret Key
flags: readable, writable
String. Default: "secret_key"
aws-region : AWS Region
flags: readable, writable
String. Default: "us-west-2"
rotation-period : Rotation Period. Unit: seconds
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 3600
log-config : Log Configuration Path
flags: readable, writable
String. Default: "./kvs_log_configuration"
storage-size : Storage Size. Unit: MB
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 128
credential-path : Credential File Path
flags: readable, writable
String. Default: ".kvs/credential"
iot-certificate : Use aws iot certificate to obtain credentials
flags: readable, writable
Boxed pointer of type "GstStructure"
stream-tags : key-value pair that you can define and assign to each stream
flags: readable, writable
Boxed pointer of type "GstStructure"
file-start-time : Epoch time that the file starts in kinesis video stream. By default, current time is used. Unit: Seconds
flags: readable, writable
Unsigned Integer64. Range: 0 - 4294967295 Default: 1602206036
빌드가 실패했거나 GST_PLUGIN_PATH제대로 설정되지 않은 경우 다음 과 같은 출력이 표시된다.
No such element or plugin 'kvssink'
성공적으로 완료가 되었다면
기본적으로 명령어로 실행이 가능하다. aws에서 비디오 스트리밍을 설정을 해두었다면
gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! video/x-raw,format=I420,width=640,height=480 ! omxh264enc control-rate=2 target-bitrate=512000 periodicity-idr=45 inline-header=FALSE ! h264parse ! video/x-h264,stream-format=avc,alignment=au,profile=baseline ! kvssink stream-name="스트림 이름" access-key="액세스키" secret-key="시크릿키" aws-region="설정된 지역"
이렇게 명령어를 입력하게 되면
위와 같이 실행 정보가 나오는 화면으로 가득 차게 된다.
아마존 서비스에 들어가게 되면 스트림이 생성되는것을 볼수 있다. 이를 통해서 명령어를 통해서 스트림 내용을 생성하는 것도 가능하다라는 것을 알 수 있다.
이렇게 재생되는 화면이 보인다면 정상적으로 된것이다.
스트림을 웹상에서 볼 수도 있는데 아래 사이트로 들어가서 필요한 부분에만 값을 넣어주면 확인할 수 있다.
https://aws-samples.github.io/amazon-kinesis-video-streams-media-viewer/
Amazon Kinesis Video Streams Media Viewer
aws-samples.github.io
하지만 Kinesis video streams 특성상 지연시간 3초에서 5초간이 있어 다른 스트리밍 방법도 찾아봐야 할 거 같다.
'RaspberryPi4' 카테고리의 다른 글
RaspberryPi - MQTT(Mosquit (0) | 2021.09.26 |
---|---|
라즈베리파이 - 실시간 웹 스트리밍(pi-camera-streaming-flask) (0) | 2021.07.23 |
라즈베리파이 - 실시간 웹 스트리밍(MJPG-Streamer) (0) | 2021.07.22 |
라즈베리파이 - 실시간 웹 스트리밍(UV4L) (1) | 2021.07.21 |