ππ»μλλ miniMediaserver μλ²μ λν μ€λͺ
μ
λλ€.
Below is a description of the miniMediaserver server.
ππ» λ‘컬μμ ν
μ€νΈ κ°λ₯ν λ―Έλμ΄μλ²μ κ°μ₯ κΈ°λ³Ένμ
λλ€.
This is the most basic type of media server that can be tested locally.
ππ» λλ ν 리 ꡬ쑰 /
directory structure
βοΈ CMakeLists.txt : λΉλλꡬ / Build Tools
βοΈ main.cpp : μ± μ§μ μ cppνμΌ / App entry point cpp file
βοΈ src : cppλ° hνμΌ λλ ν 리 / cpp and h file directories
mini_mediaserver_1/
βββ CMakeLists.txt
βββ main.cpp
βββ src/
βββ rtmp_server.h
βββ rtmp_server.cpp
βββ rtmp_session.h
βββ rtmp_session.cpp
βββ amf0.h
βββ amf0.cpp
βββ flv_writer.h
βββ flv_writer.cpp
ππ» μ¬κΈ°μλ obsμμ rtmpνλ‘ν μ½λ‘ μλ²μ μ μνκ³ flvνμΌλ‘ μ μ₯νκ³ VLC Playerλ‘ μ¬μκΉμ§ νμΈν΄λ΄
λλ€.
Here, we connect to the server using the RTMP protocol in OBS, save it as an FLV file, and verify playback using VLC Player.
ππ» rtmp(Real-Time Messaging Protocol)λ μ΄λλΉκ° Flashμ©μΌλ‘ λ§λ μ€μκ° μ€νΈλ¦¬λ° νλ‘ν μ½μ
λλ€.
RTMP (Real-Time Messaging Protocol) is a real-time streaming protocol created by Adobe for Flash.
ππ» rtmpνλ‘ν μ½μ OBSμμ μλ²λ‘ μμ μ‘μΆν λ μ¬μ©λ©λλ€.
The RTMP protocol is used to send video from OBS to the server.
ππ» flvνμΌμ νλμ λΉλμ€ ν¬λ§·μ
λλ€.
FLV files are Flash video formats.
ππ» μλμ λꡬλ€μ μ€μΉν©λλ€. / Install the tools below.
βοΈopenssl : 보μ,μνΈν λ΄λΉ λꡬ / Security and encryption tools
βοΈ FFmpeg(ffmpeg + ffprobe + ffplay) :
μμ, μμ±, μ΄λ―Έμ§ νμΌ λ³ν/νΈμ§νλ λꡬ / A tool for converting/editing video, audio, and image files
— ffmpeg , ffprobe , ffplay)
ffmpeg : λ³ν, μΈμ½λ©, μλ₯΄κΈ°, ν©μΉκΈ°, μμΆ / Convert, Encode, Crop, Merge, Compress.
ffprobe : νμΌ μ 보 λΆμ. μ½λ±, ν΄μλ, λΉνΈλ μ΄νΈ νμΈμ© /
File information analysis. For checking codec, resolution, and bitrate.
ffplay : κ°λ¨ν μ¬μκΈ°, ν μ€νΈμ© / Simple player, for testing
βοΈ VLC Player : λλΆλΆμ λ―Έλμ΄νμΌ μ¬μ κ°λ₯ν νλ μ΄μ΄(flvνμΌ μ¬μκ°λ₯)
Player capable of playing most media files (plays FLV files)
ππ» λΉλ / Build
project dir/
cd build
cmake ..
make
ππ» μ€ν / Run
./media_server
βοΈ μ μλκΈ° / Waiting for connection
MacBookAir build % ./media_server
RTMP Server listening on 1935...
βοΈ OBSμμμ μνκΈ° / Connecting from OBS
— OBSμ€μ / OBS Settings

— OBSμμ μλ²μ μ μνλ©΄ ν°λ―Έλμ λ‘κ·Έκ° νλ¦°νΈ λ©λλ€.
When you connect to the server in OBS, logs are printed in the terminal.
[Server] Ack sent: 16149755 bytes
[Server] Ack sent: 16153851 bytes
[Server] Ack sent: 16157947 bytes
[Server] Ack sent: 16162043 bytes
[Server] Ack sent: 16166139 bytes
[Server] Ack sent: 16170235 bytes
[Server] Ack sent: 16174331 bytes
[Server] Ack sent: 16178427 bytes
[Server] Ack sent: 16182523 bytes
[Server] Ack sent: 16186619 bytes
[Server] Ack sent: 16190715 bytes
[Server] Ack sent: 16194811 bytes
–10~20μ΄μ λ λ°©μ‘νμ μλ²μ obsλ₯Ό μ’
λ£ν©λλ€.
Close the server and OBS after broadcasting for about 10 to 20 seconds.
— project dir/buildλλ ν 리 λ΄μ test.flvνμΌμ΄ μμ±λ κ²μ νμΈ ν μ μμ΅λλ€.
You can verify that the test.flv file has been created in the project dir/build directory.
MacBookAir build % ls -hl
total 43112
-rw-r--r-- 1 user staff 2.0K 5μ 16 13:43 cmake_install.cmake
-rw-r--r-- 1 user staff 16K 5μ 16 13:42 CMakeCache.txt
drwxr-xr-x 13 user staff 416B 5μ 16 13:43 CMakeFiles
-rw-r--r-- 1 user staff 8.8K 5μ 16 13:43 Makefile
-rwxr-xr-x 1 user staff 975K 5μ 16 13:43 media_server
-rw-r--r--@ 1 user staff 20M 5μ 16 14:34 test.flv
— VLC νλ μ΄μ΄μμ μ΄ test.flvνμΌμ μ¬μν΄ λ΄
λλ€.
Try playing this test.flv file in VLC Player.
