ν΅μ¬ λ¬Έμ ν΄κ²° μ λ΅ λ° λΆμ π§
FFmpeg λ° FFprobe μ€μΉ κ°μ΄λ (Windows 10)
# π FFmpeg λ° FFprobe μ€μΉ
- [FFmpeg λ€μ΄λ‘λ νμ΄μ§](https://ffmpeg.org/download.html)λ‘ μ΄λ
- Windows λΉλ μ ν (κΆμ₯: [gyan.dev](https://www.gyan.dev/ffmpeg/builds/))
- "Release builds"μμ `ffmpeg-release-essentials.zip` λ€μ΄λ‘λ
- ZIP νμΌμ `C:\ffmpeg`μ μμΆ ν΄μ
# π PATH νκ²½ λ³μ μΆκ°
- `C:\ffmpeg\bin` κ²½λ‘ λ³΅μ¬
- λ΄ PC β μμ± β κ³ κΈ μμ€ν
μ€μ β νκ²½ λ³μ ν΄λ¦
- μμ€ν
λ³μμμ `Path` νΈμ§ β μ κ²½λ‘μ `C:\ffmpeg\bin` μΆκ°
- λͺ¨λ μ°½ λ«κΈ°
# π μ€μΉ νμΈ
- Win + R β "cmd" μ
λ ₯ ν μ€ν
- `ffmpeg -version` λ° `ffprobe -version` μ
λ ₯ν΄ μ€μΉ νμΈ
μ κ³Όμ μ μ§νν΄μΌ Local νκ²½μμ ffmpeg λΌμ΄λΈλ¬λ¦¬λ₯Ό μ¬μ©ν μ μμ΅λλ€.
MariaDB 컨ν
μ΄λ μ€ν (Windows Powershell)
docker network create --driver bridge mynetwork
docker network ls
docker run -d --name mariadb -p 3310:3306 -v mysql_db:/var/lib/mysql --network mynetwork -e MYSQL_DATABASE=ffmpeg-video-database -e MYSQL_ROOT_PASSWORD=password mariadb:latest
# π GoLand IDEμμ νλ‘κ·Έλ¨ μ€ν μ μ€μ νλ λ°©λ²
- Program arguments: Go νλ‘κ·Έλ¨μ μ€νν λ μ λ¬ν λͺ
λ Ήμ€ μΈμ.
- μ¬κΈ°μλ `-c deploy/dev/config.toml`μ μ λ¬νμ¬ `config.toml` νμΌμ μ€μ νμΌλ‘ μ¬μ©ν©λλ€.
- μ€μ λ°©λ²
1. GoLandμμ Run/Debug Configurationsλ₯Ό μ½λλ€.
2. Program arguments νλμ `-c deploy/dev/config.toml`μ μ
λ ₯ν©λλ€.
3. μ΄ μ€μ μ νλ‘κ·Έλ¨μ΄ `config.toml` νμΌμ μ½μ΄λ€μ΄λλ‘ νμ¬, μ§μ λ νκ²½ μ€μ μ λ‘λνκ² ν©λλ€.
4. μ€μ μ μ μ₯νκ³ , Run λ²νΌμ ν΄λ¦νμ¬ νλ‘κ·Έλ¨μ μ€νν©λλ€.
ν
μ€νΈ μ½λ μ€ν μν€κΈ° (Git Bash)
# π λͺ¨λ ν
μ€νΈ μ½λ μ€ν
go test ./internal/...
# π 컀λ²λ¦¬μ§ νλ‘νμΌ μμ± ν, HTML λ³΄κ³ μ μμ±
go test -v -coverprofile=coverage.out ./internal/...
go tool cover -html=coverage.out
ν¬μ€ μ²΄ν¬ API ν
μ€νΈ (Git Bash)
$ curl --http1.1 http://localhost:3031/api/health
ν
μ€νΈ λΉλμ€ μμ± ffmpeg λͺ
λ Ήμ΄ (Windows Powershell)
ffmpeg -f lavfi -i color=c=blue:s=320x240:d=5 -vf "drawtext=fontfile='C\\Windows\\Fonts\\arial.ttf': text='Test Video 1': fontcolor=white: fontsize=24: x=(w-text_w)/2: y=(h-text_h)/2" -c:v libx264 -t 5 -pix_fmt yuv420p "C:\test_video_1.mp4"
ffmpeg -f lavfi -i color=c=red:s=320x240:d=6 -vf "drawtext=fontfile='C\\Windows\\Fonts\\arial.ttf': text='Test Video 2': fontcolor=white: fontsize=24: x=(w-text_w)/2: y=(h-text_h)/2" -c:v libx264 -t 6 -pix_fmt yuv420p "C:\test_video_2.mp4"
ffmpeg -f lavfi -i color=c=green:s=320x240:d=7 -vf "drawtext=fontfile='C\\Windows\\Fonts\\arial.ttf': text='Test Video 3': fontcolor=white: fontsize=24: x=(w-text_w)/2: y=(h-text_h)/2" -c:v libx264 -t 7 -pix_fmt yuv420p "C:\test_video_3.mp4"
ffmpeg -f lavfi -i color=c=yellow:s=320x240:d=5 -vf "drawtext=fontfile='C\\Windows\\Fonts\\arial.ttf': text='Test Video 4': fontcolor=black: fontsize=24: x=(w-text_w)/2: y=(h-text_h)/2" -c:v libx264 -t 5 -pix_fmt yuv420p "C:\test_video_4.mp4"
ffmpeg -f lavfi -i color=c=purple:s=320x240:d=6 -vf "drawtext=fontfile='C\\Windows\\Fonts\\arial.ttf': text='Test Video 5': fontcolor=white: fontsize=24: x=(w-text_w)/2: y=(h-text_h)/2" -c:v libx264 -t 6 -pix_fmt yuv420p "C:\test_video_5.mp4"
μ λͺ
λ Ήμ΄λ₯Ό μ€ννλ©΄, ν
μ€νΈ λΉλμ€ νμΌλ€μ C λλΌμ΄λΈμ 루νΈμ μμ±λ©λλ€.
Swagger ν
μ€νΈ (Windows)
cd internal
swag init
ffmpeg-video-modules API Server μ€ν ν, `http://localhost:3031/docs/index.html` μ κ·Ό
Swagger ν
μ€νΈ μμ (π κΆμ₯)
[GET] /health -> [POST] /videos -> [POST] /videos/{id}/trim -> [POST] /videos/concat -> [POST] /jobs/execute -> [GET] /Videos -> [GET] /videos/{fid}/download
μ€ν μ UI
μ€ν ν UI
μ€ν μ UI
μ€ν ν UI
Swagger UIμμλ κΈ°λ³Έμ μΌλ‘ μ¬λ¬ κ°μ νμΌμ ν λ²μ μ
λ‘λν μ μλ κΈ°λ₯μ μ§μ μ 곡νμ§ μμ΅λλ€.
μ¬λ¬ κ°μ νμΌμ ν λ²μ μ
λ‘λνλ κΈ°λ₯μ μλμ μ΄λ―Έμ§λ₯Ό μ°Έκ³ νμ¬ PostmanμΌλ‘ μννκΈΈ λ°λλλ€.
λμμ μ»· νΈμ§ (Trim) API
μ€ν μ UI
μ€ν ν UI
π μΈκΈλ μꡬμ¬νμ μ¬μ©μκ° μ΄μ μ μμ²ν λͺ¨λ νΈλ¦Ό λ° μ΄μ΄λΆμ΄κΈ° μμ
μ ν λ²μ μνν μ μλλ‘ νλ κ²μ΄λ€.
π μ 곡λ μꡬμ¬ν λ²μ λ΄μμλ νΈλ¦Όκ³Ό μ΄μ΄ λΆμ΄κΈ° μμ
μ΄ μμ°¨μ μΌλ‘(ν λ²μ) μ²λ¦¬λλ λ°©μμΌλ‘ ꡬννλ©΄ μΆ©λΆν κ²μΌλ‘ νλ¨.
λμμ μ΄μ΄ λΆμ΄κΈ° (Concat) API
μ€ν μ UI
μ€ν ν UI
π μΈκΈλ μꡬμ¬νμ μ¬μ©μκ° μ΄μ μ μμ²ν λͺ¨λ νΈλ¦Ό λ° μ΄μ΄λΆμ΄κΈ° μμ
μ ν λ²μ μνν μ μλλ‘ νλ κ²μ΄λ€.
π μ 곡λ μꡬμ¬ν λ²μ λ΄μμλ νΈλ¦Όκ³Ό μ΄μ΄ λΆμ΄κΈ° μμ
μ΄ μμ°¨μ μΌλ‘(ν λ²μ) μ²λ¦¬λλ λ°©μμΌλ‘ ꡬννλ©΄ μΆ©λΆν κ²μΌλ‘ νλ¨.
μ€ν μ UI
μ€ν ν UI
μ΅μ’
λμμ λ€μ΄λ‘λ API
μ€ν μ UI
μ€ν ν UI
Application Server Architecture
π μ°Έκ³ Link
Go Clean Architecture κΈ°λ° ν΄λ ꡬ쑰
ERD(Entity Relationship Diagram)
HTTP Method
URI
Description
POST
/api/videos
λμμ μ
λ‘λ
POST
/api/videos/{id}/trim
λͺ
λ Ή λμμ μ»· νΈμ§ (Trim)
POST
/api/videos/concat
λͺ
λ Ή λμμ μ΄μ΄ λΆμ΄κΈ° (Concat)
POST
/api/jobs/execute
λͺ
λ Ή μμ
μν
GET
/api/videos/{id}/download
μ΅μ’
λμμ λ€μ΄λ‘λ
GET
/api/videos
λμμ λ° μμ
μ‘°ν
Git μ»€λ° λ©μμ§ κ·μΉ
Tag
Description
feat
μλ‘μ΄ κΈ°λ₯μ μΆκ°ν κ²½μ° μ¬μ©ν©λλ€.
fix
λ²κ·Έλ₯Ό μμ ν κ²½μ° μ¬μ©ν©λλ€.
refactor
μ½λ 리ν©ν λ§ν κ²½μ° μ¬μ©ν©λλ€.
style
μ½λ νμ, μ λ ¬, μ£Όμ λ±μ λ³κ²½(λμμ μν₯μ μ£Όλ μ½λ λ³κ²½ μμ)ν κ²½μ° μ¬μ©ν©λλ€.
test
ν
μ€νΈ μΆκ°, ν
μ€νΈ 리ν©ν λ§(μ ν μ½λ μμ μμ, ν
μ€νΈ μ½λμ κ΄λ ¨λ λͺ¨λ λ³κ²½μ ν΄λΉ)ν κ²½μ° μ¬μ©ν©λλ€.
docs
λ¬Έμλ₯Ό μμ (μ ν μ½λ μμ μμ)ν κ²½μ° μ¬μ©ν©λλ€.
chore
λΉλ μ
무 μμ , ν¨ν€μ§ λ§€λμ μ€μ λ± μμ ν΄λΉλμ§ μλ λͺ¨λ λ³κ²½(μ ν μ½λ μμ μμ)μΌ κ²½μ° μ¬μ©ν©λλ€.