์ด ํ์ด์ง์์๋ ์ผ๊ด ๋ชจ๋์์ Transcoder API ์์ ์ ๋ง๋๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ค๋๋ค. ์ผ๊ด ๋ชจ๋๋ฅผ ์ฌ์ฉํ๋ฉด ์ฒ๋ฆฌ ์ง์ฐ ์๊ฐ์ด ๊ธฐ๋ณธ ๋ํํ ๋ชจ๋๋ก ์ ์ถ๋ ์์ ๋งํผ ์ค์ํ์ง ์์ ๋ง์ ์์ ์ ์ ์ถํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ๊ฐ์๋ฅผ ์ฐธ์กฐํ์ธ์.
์ด ๋ชจ๋์ ์์
์ ๋ํด ์์
์ฒ๋ฆฌ ์ฐ์ ์์๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค. ์ผ๊ด ๋ชจ๋์์ ์ ์ถ๋ ์ฐ์ ์์ ๊ฐ์ด ๋์ผํ ์์
์ ์ ์
์ ์ถ ํ์ ๋ฐฐ์น๋๊ณ ์คํ ๋๊ธฐ ์ค์ธ ์์
์ํ๋ PENDING
์ด ๋ฉ๋๋ค.
Google Cloud ํ๋ก์ ํธ ๋ฐ ์ธ์ฆ ์ค์
Google Cloud ํ๋ก์ ํธ์ ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด๋ฅผ ๋ง๋ค์ง ์์ ๊ฒฝ์ฐ ์์ํ๊ธฐ ์ ์๋ฅผ ์ฐธ๊ณ ํ์ธ์.์์ ๋ชจ๋ ์ค์
์ผ๊ด ๋ชจ๋์์ ์์
์ ์์ํ๋ ค๋ฉด mode
์์
์ PROCESSING_MODE_BATCH
๋ก ์ค์ ํฉ๋๋ค.
๋ค์ ์ํ์ ๊ธฐ๋ณธ ์์ ๋ฏธ๋ฆฌ ์ค์ ์ ์ฌ์ฉํฉ๋๋ค.
REST
์์ฒญ ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ๊ธฐ ์ ์ ๋ค์์ ๋ฐ๊ฟ๋๋ค.
PROJECT_ID
: IAM ์ค์ ์ ๋์ด๋ Google Cloud ํ๋ก์ ํธ ID์ ๋๋ค.LOCATION
: ์์ ์ด ์คํ๋ ์์น์ ๋๋ค. ์ง์๋๋ ๋ฆฌ์ ์ค ํ๋๋ฅผ ์ฌ์ฉํฉ๋๋ค.์์น ํ์us-central1
us-west1
us-west2
us-east1
us-east4
southamerica-east1
northamerica-northeast1
asia-east1
asia-northeast1
asia-northeast3
asia-south1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west4
me-west1
me-central1
me-central2
STORAGE_BUCKET_NAME
: ๋ง๋ Cloud Storage ๋ฒํท์ ์ด๋ฆ์ ๋๋ค.STORAGE_INPUT_VIDEO
: Cloud Storage ๋ฒํท์ ์๋ ํธ๋์ค์ฝ๋ฉํ๋ ๋์์์ ์ด๋ฆ์ ๋๋ค(์:my-vid.mp4
). ์ด ํ๋๋ ๋ฒํท์์ ๋ง๋ ํด๋๋ฅผ ๊ณ ๋ คํด์ผ ํฉ๋๋ค(์:input/my-vid.mp4
).STORAGE_OUTPUT_FOLDER
: ์ธ์ฝ๋ฉ๋ ๋์์ ์ถ๋ ฅ์ ์ ์ฅํ Cloud Storage ํด๋ ์ด๋ฆ์ ๋๋ค.
์์ฒญ์ ๋ณด๋ด๋ ค๋ฉด ๋ค์ ์ต์ ์ค ํ๋๋ฅผ ํผ์นฉ๋๋ค.
๋ค์๊ณผ ๋น์ทํ JSON ์๋ต์ด ํ์๋ฉ๋๋ค.
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/jobs/JOB_ID", "config": { "inputs": [ { "key": "input0", "uri": "gs://STORAGE_BUCKET_NAME/STORAGE_INPUT_VIDEO" } ], "editList": [ { "key": "atom0", "inputs": [ "input0" ], "startTimeOffset": "0s" } ], "elementaryStreams": [ { "videoStream": { "h264": { "widthPixels": 640, "heightPixels": 360, "frameRate": 30, "bitrateBps": 550000, "pixelFormat": "yuv420p", "rateControlMode": "vbr", "crfLevel": 21, "gopDuration": "3s", "vbvSizeBits": 550000, "vbvFullnessBits": 495000, "entropyCoder": "cabac", "bFrameCount": 3, "aqStrength": 1, "profile": "high", "preset": "veryfast" } }, "key": "video-stream0" }, { "videoStream": { "h264": { "widthPixels": 1280, "heightPixels": 720, "frameRate": 30, "bitrateBps": 2500000, "pixelFormat": "yuv420p", "rateControlMode": "vbr", "crfLevel": 21, "gopDuration": "3s", "vbvSizeBits": 2500000, "vbvFullnessBits": 2250000, "entropyCoder": "cabac", "bFrameCount": 3, "aqStrength": 1, "profile": "high", "preset": "veryfast" } }, "key": "video-stream1" }, { "audioStream": { "codec": "aac", "bitrateBps": 64000, "channelCount": 2, "channelLayout": [ "fl", "fr" ], "sampleRateHertz": 48000 }, "key": "audio-stream0" } ], "muxStreams": [ { "key": "sd", "fileName": "sd.mp4", "container": "mp4", "elementaryStreams": [ "video-stream0", "audio-stream0" ] }, { "key": "hd", "fileName": "hd.mp4", "container": "mp4", "elementaryStreams": [ "video-stream1", "audio-stream0" ] }, { "key": "media-sd", "fileName": "media-sd.ts", "container": "ts", "elementaryStreams": [ "video-stream0", "audio-stream0" ] }, { "key": "media-hd", "fileName": "media-hd.ts", "container": "ts", "elementaryStreams": [ "video-stream1", "audio-stream0" ] }, { "key": "video-only-sd", "fileName": "video-only-sd.m4s", "container": "fmp4", "elementaryStreams": [ "video-stream0" ] }, { "key": "video-only-hd", "fileName": "video-only-hd.m4s", "container": "fmp4", "elementaryStreams": [ "video-stream1" ] }, { "key": "audio-only", "fileName": "audio-only.m4s", "container": "fmp4", "elementaryStreams": [ "audio-stream0" ] } ], "manifests": [ { "fileName": "manifest.m3u8", "type": "HLS", "muxStreams": [ "media-sd", "media-hd" ] }, { "fileName": "manifest.mpd", "type": "DASH", "muxStreams": [ "video-only-sd", "video-only-hd", "audio-only" ] } ], "output": { "uri": "gs://STORAGE_BUCKET_NAME/STORAGE_OUTPUT_FOLDER/" } }, "state": "PENDING", "createTime": CREATE_TIME, "ttlAfterCompletionDays": 30 }
gcloud
์๋์ ๋ช ๋ น์ด ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ๊ธฐ ์ ์ ๋ค์์ ๋ฐ๊ฟ๋๋ค.
LOCATION
: ์์ ์ด ์คํ๋ ์์น์ ๋๋ค. ์ง์๋๋ ๋ฆฌ์ ์ค ํ๋๋ฅผ ์ฌ์ฉํฉ๋๋ค.์์น ํ์us-central1
us-west1
us-west2
us-east1
us-east4
southamerica-east1
northamerica-northeast1
asia-east1
asia-northeast1
asia-northeast3
asia-south1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west4
me-west1
me-central1
me-central2
STORAGE_BUCKET_NAME
: ๋ง๋ Cloud Storage ๋ฒํท์ ์ด๋ฆ์ ๋๋ค.STORAGE_INPUT_VIDEO
: Cloud Storage ๋ฒํท์ ์๋ ํธ๋์ค์ฝ๋ฉํ๋ ๋์์์ ์ด๋ฆ์ ๋๋ค(์:my-vid.mp4
). ์ด ํ๋๋ ๋ฒํท์์ ๋ง๋ ํด๋๋ฅผ ๊ณ ๋ คํด์ผ ํฉ๋๋ค(์:input/my-vid.mp4
).STORAGE_OUTPUT_FOLDER
: ์ธ์ฝ๋ฉ๋ ๋์์ ์ถ๋ ฅ์ ์ ์ฅํ Cloud Storage ํด๋ ์ด๋ฆ์ ๋๋ค.
๋ค์ ๋ช ๋ น์ด๋ฅผ ์คํํฉ๋๋ค.
Linux, macOS ๋๋ Cloud Shell
gcloud transcoder jobs create \ --input-uri="gs://STORAGE_BUCKET_NAME/STORAGE_INPUT_VIDEO" \ --location=LOCATION \ --output-uri="gs://STORAGE_BUCKET_NAME/STORAGE_OUTPUT_FOLDER/" \ --template-id="preset/web-hd" \ --batch-mode-priority=10
Windows(PowerShell)
gcloud transcoder jobs create ` --input-uri="gs://STORAGE_BUCKET_NAME/STORAGE_INPUT_VIDEO" ` --location=LOCATION ` --output-uri="gs://STORAGE_BUCKET_NAME/STORAGE_OUTPUT_FOLDER/" ` --template-id="preset/web-hd" ` --batch-mode-priority=10
Windows(cmd.exe)
gcloud transcoder jobs create ^ --input-uri="gs://STORAGE_BUCKET_NAME/STORAGE_INPUT_VIDEO" ^ --location=LOCATION ^ --output-uri="gs://STORAGE_BUCKET_NAME/STORAGE_OUTPUT_FOLDER/" ^ --template-id="preset/web-hd" ^ --batch-mode-priority=10
๋ค์๊ณผ ๋น์ทํ ์๋ต์ด ํ์๋ฉ๋๋ค.
์๋ต
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/jobs/JOB_ID", "config": { "inputs": [ { "key": "input0", "uri": "gs://STORAGE_BUCKET_NAME/STORAGE_INPUT_VIDEO" } ], "editList": [ { "key": "atom0", "inputs": [ "input0" ], "startTimeOffset": "0s" } ], "elementaryStreams": [ { "videoStream": { "h264": { "widthPixels": 640, "heightPixels": 360, "frameRate": 30, "bitrateBps": 550000, "pixelFormat": "yuv420p", "rateControlMode": "vbr", "crfLevel": 21, "gopDuration": "3s", "vbvSizeBits": 550000, "vbvFullnessBits": 495000, "entropyCoder": "cabac", "bFrameCount": 3, "aqStrength": 1, "profile": "high", "preset": "veryfast" } }, "key": "video-stream0" }, { "videoStream": { "h264": { "widthPixels": 1280, "heightPixels": 720, "frameRate": 30, "bitrateBps": 2500000, "pixelFormat": "yuv420p", "rateControlMode": "vbr", "crfLevel": 21, "gopDuration": "3s", "vbvSizeBits": 2500000, "vbvFullnessBits": 2250000, "entropyCoder": "cabac", "bFrameCount": 3, "aqStrength": 1, "profile": "high", "preset": "veryfast" } }, "key": "video-stream1" }, { "audioStream": { "codec": "aac", "bitrateBps": 64000, "channelCount": 2, "channelLayout": [ "fl", "fr" ], "sampleRateHertz": 48000 }, "key": "audio-stream0" } ], "muxStreams": [ { "key": "sd", "fileName": "sd.mp4", "container": "mp4", "elementaryStreams": [ "video-stream0", "audio-stream0" ] }, { "key": "hd", "fileName": "hd.mp4", "container": "mp4", "elementaryStreams": [ "video-stream1", "audio-stream0" ] }, { "key": "media-sd", "fileName": "media-sd.ts", "container": "ts", "elementaryStreams": [ "video-stream0", "audio-stream0" ] }, { "key": "media-hd", "fileName": "media-hd.ts", "container": "ts", "elementaryStreams": [ "video-stream1", "audio-stream0" ] }, { "key": "video-only-sd", "fileName": "video-only-sd.m4s", "container": "fmp4", "elementaryStreams": [ "video-stream0" ] }, { "key": "video-only-hd", "fileName": "video-only-hd.m4s", "container": "fmp4", "elementaryStreams": [ "video-stream1" ] }, { "key": "audio-only", "fileName": "audio-only.m4s", "container": "fmp4", "elementaryStreams": [ "audio-stream0" ] } ], "manifests": [ { "fileName": "manifest.m3u8", "type": "HLS", "muxStreams": [ "media-sd", "media-hd" ] }, { "fileName": "manifest.mpd", "type": "DASH", "muxStreams": [ "video-only-sd", "video-only-hd", "audio-only" ] } ], "output": { "uri": "gs://STORAGE_BUCKET_NAME/STORAGE_OUTPUT_FOLDER/" } }, "state": "PENDING", "createTime": CREATE_TIME, "ttlAfterCompletionDays": 30 }
C#
์ด ์ํ์ ์ฌ์ฉํด ๋ณด๊ธฐ ์ ์ Transcoder API ๋น ๋ฅธ ์์: ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์ C# ์ค์ ์๋ด๋ฅผ ๋ฐ๋ฅด์ธ์. ์์ธํ ๋ด์ฉ์ Transcoder API C# API ์ฐธ๊ณ ๋ฌธ์๋ฅผ ํ์ธํ์ธ์.
Transcoder API์ ์ธ์ฆํ๋ ค๋ฉด ์ ํ๋ฆฌ์ผ์ด์ ๊ธฐ๋ณธ ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด๋ฅผ ์ค์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ธ์ฆ ์ค์ ์ ์ฐธ์กฐํ์ธ์.
Go
์ด ์ํ์ ์ฌ์ฉํด ๋ณด๊ธฐ ์ ์ Transcoder API ๋น ๋ฅธ ์์: ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์ Go ์ค์ ์๋ด๋ฅผ ๋ฐ๋ฅด์ธ์. ์์ธํ ๋ด์ฉ์ Transcoder API Go API ์ฐธ๊ณ ๋ฌธ์๋ฅผ ํ์ธํ์ธ์.
Transcoder API์ ์ธ์ฆํ๋ ค๋ฉด ์ ํ๋ฆฌ์ผ์ด์ ๊ธฐ๋ณธ ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด๋ฅผ ์ค์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ธ์ฆ ์ค์ ์ ์ฐธ์กฐํ์ธ์.
Java
์ด ์ํ์ ์ฌ์ฉํด ๋ณด๊ธฐ ์ ์ Transcoder API ๋น ๋ฅธ ์์: ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์ Java ์ค์ ์๋ด๋ฅผ ๋ฐ๋ฅด์ธ์. ์์ธํ ๋ด์ฉ์ Transcoder API Java API ์ฐธ๊ณ ๋ฌธ์๋ฅผ ํ์ธํ์ธ์.
Transcoder API์ ์ธ์ฆํ๋ ค๋ฉด ์ ํ๋ฆฌ์ผ์ด์ ๊ธฐ๋ณธ ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด๋ฅผ ์ค์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ธ์ฆ ์ค์ ์ ์ฐธ์กฐํ์ธ์.
Node.js
์ด ์ํ์ ์ฌ์ฉํด ๋ณด๊ธฐ ์ ์ Transcoder API ๋น ๋ฅธ ์์: ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์ Node.js ์ค์ ์๋ด๋ฅผ ๋ฐ๋ฅด์ธ์. ์์ธํ ๋ด์ฉ์ Transcoder API Node.js API ์ฐธ๊ณ ๋ฌธ์๋ฅผ ํ์ธํ์ธ์.
Transcoder API์ ์ธ์ฆํ๋ ค๋ฉด ์ ํ๋ฆฌ์ผ์ด์ ๊ธฐ๋ณธ ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด๋ฅผ ์ค์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ธ์ฆ ์ค์ ์ ์ฐธ์กฐํ์ธ์.
PHP
์ด ์ํ์ ์ฌ์ฉํด ๋ณด๊ธฐ ์ ์ Transcoder API ๋น ๋ฅธ ์์: ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์ PHP ์ค์ ์๋ด๋ฅผ ๋ฐ๋ฅด์ธ์. ์์ธํ ๋ด์ฉ์ Transcoder API PHP API ์ฐธ๊ณ ๋ฌธ์๋ฅผ ํ์ธํ์ธ์.
Transcoder API์ ์ธ์ฆํ๋ ค๋ฉด ์ ํ๋ฆฌ์ผ์ด์ ๊ธฐ๋ณธ ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด๋ฅผ ์ค์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ธ์ฆ ์ค์ ์ ์ฐธ์กฐํ์ธ์.
Python
์ด ์ํ์ ์ฌ์ฉํด ๋ณด๊ธฐ ์ ์ Transcoder API ๋น ๋ฅธ ์์: ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์ Python ์ค์ ์๋ด๋ฅผ ๋ฐ๋ฅด์ธ์. ์์ธํ ๋ด์ฉ์ Transcoder API Python API ์ฐธ๊ณ ๋ฌธ์๋ฅผ ํ์ธํ์ธ์.
Transcoder API์ ์ธ์ฆํ๋ ค๋ฉด ์ ํ๋ฆฌ์ผ์ด์ ๊ธฐ๋ณธ ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด๋ฅผ ์ค์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ธ์ฆ ์ค์ ์ ์ฐธ์กฐํ์ธ์.
Ruby
์ด ์ํ์ ์ฌ์ฉํด ๋ณด๊ธฐ ์ ์ Transcoder API ๋น ๋ฅธ ์์: ํด๋ผ์ด์ธํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ์ Ruby ์ค์ ์๋ด๋ฅผ ๋ฐ๋ฅด์ธ์. ์์ธํ ๋ด์ฉ์ Transcoder API Ruby API ์ฐธ๊ณ ๋ฌธ์๋ฅผ ํ์ธํ์ธ์.
Transcoder API์ ์ธ์ฆํ๋ ค๋ฉด ์ ํ๋ฆฌ์ผ์ด์ ๊ธฐ๋ณธ ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด๋ฅผ ์ค์ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ๋ก์ปฌ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ธ์ฆ ์ค์ ์ ์ฐธ์กฐํ์ธ์.