[ 목차 ]
- Amazon Kinesis Video Streams 생성하기
- Amazon Kinesis Video Streams Producer SDK for C/C++ 및 GStreamer Plugin (kvssink), JNI 설치
- Kinesis Video Streams로 실시간 웹캠 스트리밍
1. Amazon Kinesis Video Streams 생성하기
2. Amazon Kinesis Video Streams Producer SDK for C/C++ 및 GStreamer Plugin (kvssink), JNI 설치
아래 링크를 참고하여 진행하였다.
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
2-0. 사전 준비 ( JAVA가 설치되어 있는 경우 생략)
1. brew 설치
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. JAVA 및 JDK 설치 / 환경 변수 설정
#jdk17 설치하기
brew install openjdk@17
#jdk17 경로 확인
brew --prefix openjdk@17
#설치된 JDK의 버전 확인하기
#설치된 JDK의 정확한 경로를 확인한 후, 해당 경로로 이동하여 'java' 명령어로 버전을 확인 가능
/usr/local/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home/bin/java -version
3. Xcode 설치 후 Developer로 설정 (CommandLineTools)
#현재 xcode 설정 확인하기
xcode-select -p
2-1. SDK CPP 설치
git clone https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp.git
2-2. 설치한 폴더로 이동하여 build 폴더 생성
mkdir build
cd build
2-3. cmake, openssl, gstreamer 및 기타 플러그인 설치
brew install pkg-config openssl cmake gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly log4cplus gst-libav
2-4. 환경 변수 설정
#bashrc 파일 열기
nano ~/.bashrc
bashrc 파일에 접근한 다음, 아래 내용을 추가하여 환경 변수를 업데이트한다.
export JAVA_HOME=/usr/local/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
export GST_PLUGIN_PATH=/Users/kaist_admin/desktop/aws/video_stream_test/amazon-kinesis-video-streams-producer-sdk-cpp/build
export LD_LIBRARY_PATH=/Users/kaist_admin/desktop/aws/video_stream_test/amazon-kinesis-video-streams-producer-sdk-cpp/build/open-source/local/lib
#bashrc 파일 수정 후 환경 변수 업데이트하기
source ~/.bashrc
2-5. cmake 실행
cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DBUILD_JNI=TRUE DCMAKE_C_FLAGS="-Wno-int-conversion -Wno-incompatible-pointer-types"
☞ 참고!!
다음과 같은 Threadpool.c.o issue 에러나 다른 에러들이 발생할 경우에는
build 폴더를 삭제하고 다시 생성한 후 cmake를 다시 해본다!!
https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp/issues/1191
[BUG] KVS Fails to build due to Threadpool.c.o issue · Issue #1191 · awslabs/amazon-kinesis-video-streams-producer-sdk-cpp
Describe the bug When trying to build I keep hitting the same issue outlined below To Reproduce Steps to reproduce the behavior: Download amazon-kinesis-video-streams-producer-sdk-cpp-3.4.1 Make bu...
github.com
2-6. App 컴파일하기
make
2-7. App 실행 전 테스트
gst-inspect-1.0 kvssink
3. Kinesis Video Streams로 실시간 웹캠 스트리밍
3-1. App 실행하기 ( GStreamer를 통해 Kinesis Video Streams로 데이터를 전송 )
stream-name, access-key, secret-key, aws-region은 별도로 설정하기
gst-launch-1.0 avfvideosrc ! videoconvert ! vtenc_h264_hw allow-frame-reordering=FALSE realtime=TRUE max-keyframe-interval=45 ! kvssink stream-name="test_webcam" storage-size=512 access-key="AKIAQ3EGWOB2TRWDO7TY" secret-key="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" aws-region="us-east-1"
3-2. Kinesis video stream의 미디어 재생에서 스트리밍 확인하기
이번 프로젝트에서는 MacBook 웹캠 영상을 Amazon Kinesis Video Streams에 실시간으로 스트리밍하고, AWS 콘솔에서 미디어 재생을 확인하였다. 스트리밍이 잘 동작했지만, 약 10초의 지연과 영상의 버벅거림이 관찰되었다.
이를 해결하기 위해서는 인코딩 설정 최적화, 네트워크 대역폭 확인, 또는 Kinesis Video Streams의 버퍼링 전략을 조정하는 추가적인 개선이 필요하다.
'Cloud > AWS' 카테고리의 다른 글
AWS ECR에 helm chart(.tgz) 업로드하기 _ 404 Not Found 해결 (0) | 2025.03.27 |
---|---|
[AWS] Visual Studio Code에 EC2 연결하기 (0) | 2024.07.06 |
[AWS] EC2 서버에 Python 개발 환경 구축 _ Miniconda, Jupyter Notebook (0) | 2024.06.25 |
[AWS] EC2 서버에 Spark 설치하기 (0) | 2024.06.25 |
[AWS] EC2 서버에 MySQL 환경 세팅 및 Workbench 연결 (0) | 2024.05.28 |