forked from photoprism/photoprism
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Video: Add ffmpeg-bitrate config option photoprism#703
- Loading branch information
Showing
7 changed files
with
56 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package config | ||
|
||
// FFmpegBin returns the ffmpeg executable file name. | ||
func (c *Config) FFmpegBin() string { | ||
return findExecutable(c.options.FFmpegBin, "ffmpeg") | ||
} | ||
|
||
// FFmpegEncoder returns the ffmpeg AVC encoder name. | ||
func (c *Config) FFmpegEncoder() string { | ||
if c.options.FFmpegEncoder == "" { | ||
return "libx264" | ||
} | ||
|
||
return c.options.FFmpegEncoder | ||
} | ||
|
||
// FFmpegBuffers returns the number of ffmpeg capture buffers. | ||
func (c *Config) FFmpegBuffers() int { | ||
if c.options.FFmpegBuffers <= 8 { | ||
return 8 | ||
} | ||
|
||
if c.options.FFmpegBuffers >= 2048 { | ||
return 2048 | ||
} | ||
|
||
return c.options.FFmpegBuffers | ||
} | ||
|
||
// FFmpegBitrate returns the ffmpeg bitrate limit in MBit/s. | ||
func (c *Config) FFmpegBitrate() int { | ||
switch { | ||
case c.options.FFmpegBitrate <= 0: | ||
return 50 | ||
case c.options.FFmpegBitrate >= 960: | ||
return 960 | ||
default: | ||
return c.options.FFmpegBitrate | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters