PageSourceSearch

https://short-gpt-dcs.vercel.app/assets/js/4842b7bb.8e621ca1.js

js short-gpt-dcs.vercel.app collected 2026-10-03 07:42:08 UTC 10,279 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkshortgpt_documentation=self.webpackChunkshortgpt_documentation||[]).push([[471],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>g});var i=t(7294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function r(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?a(Object(t),!0).forEach((function(n){o(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function s(e,n){if(null==e)return{};var t,i,o=function(e,n){if(null==e)return{};var t,i,o={},a=Object.keys(e);for(i=0;i<a.length;i++)t=a[i],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)t=a[i],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=i.createContext({}),d=function(e){var n=i.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},p=function(e){var n=d(e.components);return i.createElement(l.Provider,{value:n},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},m=i.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(t),m=o,g=c["".concat(l,".").concat(m)]||c[m]||u[m]||a;return t?i.createElement(g,r(r({ref:n},p),{},{components:t})):i.createElement(g,r({ref:n},p))}));function g(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,r=new Array(a);r[0]=m;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s[c]="string"==typeof e?e:o,r[1]=s;for(var d=2;d<a;d++)r[d]=t[d];return i.createElement.apply(null,r)}return i.createElement.apply(null,t)}m.displayName="MDXCreateElement"},3946:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>d});var i=t(7462),o=(t(7294),t(3905));const a={title:"ContentVideoEngine",sidebar_label:"ContentVideoEngine"},r=void 0,s={unversionedId:"content-video-engine",id:"content-video-engine",title:"ContentVideoEngine",description:"The ContentVideoEngine in ShortGPT is a powerful tool that encapsulates all the automation required to create a video. This guide will provide you with an overview of how to use the ContentVideoEngine.",source:"@site/docs/content-video-engine.mdx",sourceDirName:".",slug:"/content-video-engine",permalink:"/docs/content-video-engine",draft:!1,editUrl:"https://github.com/RayVentura/ShortGPT/edit/stable/docs/docs/content-video-engine.mdx",tags:[],version:"current",lastUpdatedBy:"Rayventura",lastUpdatedAt:1708110554,formattedLastUpdatedAt:"Feb 16, 2024",frontMatter:{title:"ContentVideoEngine",sidebar_label:"ContentVideoEngine"},sidebar:"docs",previous:{title:"ShortGPT Hello World Example",permalink:"/docs/getting-started"},next:{title:"ContentTranslationEngine",permalink:"/docs/content-translation-engine"}},l={},d=[{value:"Importing ContentVideoEngine",id:"importing-contentvideoengine",level:2},{value:"Initializing ContentVideoEngine",id:"initializing-contentvideoengine",level:2},{value:"Example",id:"example",level:2},{value:"How ContentVideoEngine Works",id:"how-contentvideoengine-works",level:2},{value:"Using Pexels API",id:"using-pexels-api",level:2},{value:"Providing a Script",id:"providing-a-script",level:2}],p={toc:d},c="wrapper";
1function u(e){let{components:n,...t}=e;return(0,o.kt)(c,(0,i.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"ContentVideoEngine")," in ShortGPT is a powerful tool that encapsulates all the automation required to create a video. This guide will provide you with an overview of how to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"ContentVideoEngine"),"."),(0,o.kt)("h2",{id:"importing-contentvideoengine"},"Importing ContentVideoEngine"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},"from shortGPT.engine.content_video_engine import ContentVideoEngine\n")),(0,o.kt)("h2",{id:"initializing-contentvideoengine"},"Initializing ContentVideoEngine"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"ContentVideoEngine")," requires a ",(0,o.kt)("inlineCode",{parentName:"p"},"VoiceModule"),", a script, and optionally a background music name, a watermark (string with the name of your channel / brand), a flag indicating whether the video you want is in vertical format, and a language."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'content_engine = ContentVideoEngine(voice_module, script, background_music_name="", watermark=None, isVerticalFormat=False, language=Language.ENGLISH)\n')),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'from shortGPT.config.api_db import ApiKeyManager, ApiProvider\nfrom shortGPT.config.asset_db import AssetDatabase, AssetType\nfrom shortGPT.engine.content_video_engine import ContentVideoEngine\nfrom shortGPT.config.languages import Language\nfrom shortGPT.audio.edge_voice_module import EdgeTTSVoiceModule, EDGE_TTS_VOICENAME_MAPPING\n\n# Set API Keys\nApiKeyManager.set_api_key(ApiProvider.OPENAI, "your_openai_key")\nApiKeyManager.set_api_key(ApiProvider.PEXELS, "your_pexels_key")\n\n# Add Assets\nAssetDatabase.add_remote_asset(\'chill music\', AssetType.BACKGROUND_MUSIC, "https://www.youtube.com/watch?v=uUu1NcSHg2E")\n\n# Configure the Voice Module\nvoice_name = EDGE_TTS_VOICENAME_MAPPING[Language.SPANISH][\'male\']\nvoice_module = EdgeTTSVoiceModule(voice_name)\n\n# Prepare the script\nscript = "La inteligencia artificial (IA) est\xe1 revolucionando nuestro mundo de manera sorprendente. Los robots y asistentes virtuales nos ayudan en nuestras tareas diarias y simplifican nuestra vida. En la medicina, la IA permite diagn\xf3sticos m\xe1s precisos y avances en tratamientos. En la industria automotriz, los veh\xedculos aut\xf3nomos est\xe1n cambiando la forma en que nos desplazamos. Sin embargo, surgen interrogantes sobre el impacto en el empleo y la \xe9tica de su uso. A pesar de los desaf\xedos, la IA promete un futuro emocionante y lleno de posibilidades. \xbfEstamos preparados para abrazar este avance tecnol\xf3gico?"\n\n# Configure Content Engine\ncontent_engine = ContentVideoEngine(voice_module, script, background_music_name=\'chill music\', language=Language.SPANISH)\n\n# Generate Content\nfor step_num, step_logs in content_engine.makeContent():\n    print(f" {step_logs}")\n\n# Get Video Output Path\nprint(content_engine.get_video_output_path())\n')),(0,o.kt)("p",null,"In this example, we first set the API keys for OpenAI, and Pexels. We then add a remote asset for background music. We configure the voice module to use EdgeTTS for voice synthesis. We prepare a script for the video and then configure the ",(0,o.kt)("inlineCode",{parentName:"p"},"ContentVideoEngine")," with the voice module, script, and background music. We then generate the content and print the output path of the video."),(0,o.kt)("h2",{id:"how-contentvideoengine-works"},"How ContentVideoEngine Works"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"ContentVideoEngine")," works by executing a series of steps defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"stepDict")," dictionary. Each step is a method that performs a specific task in the video creation process. Here's what each step does:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"_generateTempAudio"),": Generates a temporary audio file from the provided script using the specified ",(0,o.kt)("inlineCode",{parentName:"li"},"VoiceModule"),"."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"_speedUpAudio"),": Speeds up the generated audio file to match the pace of a typical video."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"_timeCaptions"),": Generates timed captions for the video based on the script."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"_generateVideoSearchTerms"),": Generates search terms to find relevant videos on Pexels based on the script."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"_generateVideoUrls"),": Retrieves video URLs from Pexels using the generated search terms."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"}
1,"_chooseBackgroundMusic"),": Chooses background music for the video."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"_prepareBackgroundAssets"),": Prepares the background assets for the video."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"_prepareCustomAssets"),": Prepares any custom assets for the video."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"_editAndRenderShort"),": Edits and renders the video."),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"_addMetadata"),": Adds metadata to the video.")),(0,o.kt)("h2",{id:"using-pexels-api"},"Using Pexels API"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"ContentVideoEngine")," sources video assets from the Pexels API. To use it, you need to provide your Pexels API key. The engine uses this key to retrieve relevant videos based on the search terms generated from the script."),(0,o.kt)("h2",{id:"providing-a-script"},"Providing a Script"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"ContentVideoEngine")," requires a script to generate the video. The script is used to generate the audio, captions, and search terms for sourcing videos from Pexels. The script should be a string containing the narration for the video."))}u.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.