지난 블로그 자동포스팅에 이어 디지털 노마드의 삶을 살기위해 오늘도 새로운걸 가져왔다..
요즘 유튜브 보면 과일 자르는 ASMR로 인기가 많은데 이런 영상은 어떻게 만들고 자동으로 업로드 하는지를 포스팅해보겠다!

Veo3 API

Veo3는 구글에서 만든 영상모델이다. 영상에 더해 소리까지 생성할 수 있는 모델이다. 본래는 Gemini Pro(월 30,000원)나 Ultra(월 300,000)를 가입해야 사용할 수 있지만 이것도 월에 만들 수 있는 제한이 있다.(credit 형식임)
하지만 가입하기는 너무 비싸고 원하고 싶을때만 만들 수 있는 API를 지원하는 서비스가 있다.
바로 KIEAI라는 곳이다. 우선 회원가입을 하고 API키를 발급받아야 한다. 영상을 만들기 위해서 크레딧도 충전해주자.
img.png
가격은 위에 사진과 같다. Veo3 한번 요청에 400크레딧이 소요되고, Veo3 fast를 사용하면 80크레딧이 소요된다. 똑같은 Veo3이지만 뭔가 품질 차이가 있는듯(?) 대충 환산하면 Veo3는 한번 생성하는데 약 2719원, Veo3 fast는 약 544원이 든다.

POST 요청

HTTP 요청으로 쉽게 영상을 얻을 수 있다.
자세한 설명은 여기를 참고하자.

url = "https://kieai.erweima.ai/api/v1/veo/generate"
payload = json.dumps({
    "prompt": prompt,
    "model": "veo3",  # veo3_fast
    "imageUrls": []
})
headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': f'Bearer {KIEAI_API_KEY}'
}

response = requests.request("POST", url, headers=headers, data=payload)

우선 POST 요청 코드이다. prompt와 API키를 적절히 넣어주자.
코드를 실행하게 되면 logs 에 방금 요청한 프로세스가 떠있을 것이다.

요청 진행상황 확인

url = f"https://kieai.erweima.ai/api/v1/veo/record-info?taskId={task_id}"

headers = {
    'Accept': 'application/json',
    'Authorization': f'Bearer {KIEAI_API_KEY}'
}

response = requests.get(url, headers=headers)
print(response.text)
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "27e354b53ca0e7c2c178985cb19fc064",
    "paramJson": "{\"enableTranslation\":true,\"model\":\"veo3_fast\",\"prompt\":\"\\nAn 8-second hyper-realistic ASMR video, fully focused on slicing sounds and visual crystal clarity.\\n\\nScene:\\nSet in the pixelated world of Minecraft, a classic dark oak wood block with rich, visible grain texture serves as the cutting surface. On top of it rests a Minecraft sand block — meticulously rendered in ultra-high detail to highlight its iconic pale beige pixels subtly shifting in hue The block appears delicately compacted, with occasional shimmer as if grains of sand are catching the light. \\n\\nAction:\\nA polished, razor-sharp chef’s knife with a flawless mirror-finish blade slowly lowers toward the sand block. As it makes contact, the edge glides effortlessly through the pixelated material. Instead of shattering, the sand block parts smoothly — almost fluidly — with soft cascades of pixelated sand flowing down from the cut. Each slice reveals an internal texture resembling layered granular pixels, which ripple and shift slightly, as though reacting to gravity.\\n\\nSound Design:\\nThe soundscape features a calming, fine shhhh akin to slicing through soft sand, layered with subtle granular textures and a mellow rustling. The ambient noise is low and peaceful, mimicking the serene sound of smooth sand being cut and slowly sifting. The blade's gentle contact with the wood surface adds delicate micro-scraping elements. The entire auditory experience is spatial and softly enveloping, delivering a refined ASMR sensation designed to soothe.\\n\\nVisual Style:\\nCaptured in 4K ultra-high definition, the extreme macro lens focuses tightly on the interaction between knife and block. The lighting is warm and diffused from above, highlighting every individual grain and pixel. As the knife slices through, pixelated sand particles catch the light with subtle sparkle before flowing down like slow-motion liquid pixels.\\n\\nAesthetic:\\nA captivating intersection of tactile ASMR realism and Minecraft's iconic voxel world — where digital sand behaves with graceful, almost organic fluidity.\"}",
    "response": {
      "taskId": "e28261442622419b9ec2978157cce65d",
      "resultUrls": [
        "https://tempfile.aiquickdraw.com/p/7a2c767e82c44c2bba99301fe2d19670_1750655859.mp4"
      ]
    },
    "successFlag": 1,
    "completeTime": 1750658163000,
    "createTime": 1750658065000,
    "errorCode": null,
    "errorMessage": null
  }
}

위 코드를 실행하면 아래와같은 출력이 나온다. 여기서 successFlag 는 0은 생성중, 1은 완료, 2는 task 생성 실패, 3은 영상생성실패 이다.
완료되면 resultUrls에 만들어진 영상을 확인할 수 있다.

업스케일링

url = f"https://kieai.erweima.ai/api/v1/veo/get-1080p-video?taskId={task_id}"

headers = {
    'Accept': 'application/json',
    'Authorization': f'Bearer {KIEAI_API_KEY}'
}

response = requests.get(url, headers=headers)

위 요청은 영상을 1080p로 업스케일링 한다. 추가로 5크레딧이 소모된다.
마찬가지로 완료되면 resultUrls에 영상이 만들어진다.
영상을 다운로드해서 유튜브에 업로드 하면 된다!!

유튜브 업로드

유튜브에 자동으로 업로드 하려면 구글 클라우드 콘솔(GCP)에서 Youtube Data API v3를 사용해야한다.
Youtube Data API v3을 찾아서 활성화 하고 Oauth 동의 화면에서 클라이언트를 만들어 준다. 그 다음 대상 - 테스트 사용자에 영상을 업로드할 계정을 추가해준다.
클라이언트를 만들 때 ~~.json 이라는 json 파일을 주는데 다운받아 준다.

유튜브는 영상 크기에 따라 일반인지 쇼츠인지를 구분한다. 영상이 1920 * 1080 인 경우에는 일반, 1080 * 1920은 쇼츠이다. 만들어진 영상을 쇼츠로 올리고 싶다면 영상 resize를 해야한다. ```python import os import google_auth_oauthlib.flow import googleapiclient.discovery import googleapiclient.errors import googleapiclient.http

scopes = [“https://www.googleapis.com/auth/youtube.upload”]

OAuth 2.0 인증 플로우

api_service_name = “youtube” api_version = “v3” client_secrets_file = “다운받은 json 경로 넣기”

인증 및 API 클라이언트 생성

flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file( client_secrets_file, scopes) credentials = flow.run_local_server(port=0) youtube = googleapiclient.discovery.build( api_service_name, api_version, credentials=credentials)

요청 바디 정의

request_body = { “snippet”: { “title”: title + “#ai #asmr #AICutting #satisfying”, “description”: description, }, “status”: { “privacyStatus”: “public” } }

동영상 업로드 요청 생성

media = googleapiclient.http.MediaFileUpload(video_file, chunksize=-1, resumable=True, mimetype=”video/mp4”)

request = youtube.videos().insert( part=”snippet,status”, body=request_body, media_body=media )

response = None while response is None: status, response = request.next_chunk() if status: print(f”업로드 중… {int(status.progress() * 100)}% 완료”)

print(“업로드 완료! 동영상 ID:”, response.get(“id”)) ``` client_secrets_file에 다운받은 json 경로를 입력해주고 영상의 제목과 description을 작성해주면 완료!!

영상

▶ 영상 보기

카테고리:

업데이트:

댓글남기기