Skip to content

Commit

Permalink
Added portrait flag to generate portrait videos
Browse files Browse the repository at this point in the history
This is only needed for image to video, for text to video you should use
width and height parameters.

Portrait image to video mode is currently only available with gen3-turbo
mode.
  • Loading branch information
igolaizola committed Dec 14, 2024
1 parent 103ae28 commit f4ca967
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func newGenerateCommand() *ffcli.Command {
fs.BoolVar(&cfg.Watermark, "watermark", false, "add watermark (optional)")
fs.IntVar(&cfg.Width, "width", 0, "output video width (optional)")
fs.IntVar(&cfg.Height, "height", 0, "output video height (optional)")
fs.BoolVar(&cfg.Portrait, "portrait", false, "portrait mode (optional) (only for gen3-turbo)")
fs.BoolVar(&cfg.Explore, "explore", false, "explore mode (optional)")
fs.BoolVar(&cfg.LastFrame, "last-frame", false, "use source image as the last frame (optional)")
fs.IntVar(&cfg.Seconds, "seconds", 10, "duration of the video in seconds (optional)")
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Config struct {
Watermark bool
Width int
Height int
Portrait bool
Explore bool
LastFrame bool
Seconds int
Expand Down Expand Up @@ -88,6 +89,7 @@ func Run(ctx context.Context, cfg *Config) error {
Extend: false,
Width: cfg.Width,
Height: cfg.Height,
Portrait: cfg.Portrait,
ExploreMode: cfg.Explore,
LastFrame: cfg.LastFrame,
Seconds: cfg.Seconds,
Expand Down
5 changes: 5 additions & 0 deletions pkg/runway/runway.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ type gen3Options struct {
EnhancePrompt bool `json:"enhance_prompt"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Flip bool `json:"flip,omitempty"`
Resolution string `json:"resolution,omitempty"`
InitImage string `json:"init_image,omitempty"`
ImageAsEndFrame bool `json:"image_as_end_frame"`
Expand Down Expand Up @@ -355,6 +356,7 @@ type GenerateRequest struct {
Extend bool
Width int
Height int
Portrait bool
ExploreMode bool
LastFrame bool
Seconds int
Expand Down Expand Up @@ -426,6 +428,7 @@ func (c *Client) Generate(ctx context.Context, cfg *GenerateRequest) (*Generatio

var width, height int
var resolution string
var flip bool
if len(imageURL) == 0 {
width = cfg.Width
height = cfg.Height
Expand All @@ -435,6 +438,7 @@ func (c *Client) Generate(ctx context.Context, cfg *GenerateRequest) (*Generatio
}
} else {
resolution = "720p"
flip = cfg.Portrait
}

// Create task
Expand Down Expand Up @@ -522,6 +526,7 @@ func (c *Client) Generate(ctx context.Context, cfg *GenerateRequest) (*Generatio
EnhancePrompt: true,
Width: width,
Height: height,
Flip: flip,
InitImage: imageURL,
Resolution: resolution,
AssetGroupName: c.folder,
Expand Down

0 comments on commit f4ca967

Please sign in to comment.