Skip to content

Commit

Permalink
go-vod: add software transpose config
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Apr 25, 2024
1 parent 62d1110 commit 1d810df
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions go-vod/transcoder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ type Config struct {

// Use transpose workaround for streaming (VA-API)
UseTranspose bool `json:"useTranspose"`
// Force tranpose in software
ForceSwTranspose bool `json:"forceSwTranspose"`

// Use GOP size workaround for streaming (NVENC)
UseGopSize bool `json:"useGopSize"`
Expand Down
4 changes: 2 additions & 2 deletions go-vod/transcoder/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,9 @@ func (s *Stream) transcodeArgs(startAt float64, isHls bool) []string {

// Force rotation in software instead.
// For example, if we desire not to use transpose_vaapi for some reason.
forceSwTranspose := transposer != "transpose" && (false || transposer == "transpose_cuda")
forceSwTranspose := transposer != "transpose" && (s.c.ForceSwTranspose || transposer == "transpose_cuda")

// If we are forcing software, download the video and rotate it
// Use CPU transpose if forcing software
if forceSwTranspose {
transposer = "transpose"
}
Expand Down
1 change: 1 addition & 0 deletions lib/Service/BinExt.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ public static function getGoVodConfig(bool $local = false): array
'nvencScale' => SystemConfig::get('memories.vod.nvenc.scale'),

'useTranspose' => SystemConfig::get('memories.vod.use_transpose'),
'forceSwTranspose' => SystemConfig::get('memories.vod.use_transpose.force_sw'),
'useGopSize' => SystemConfig::get('memories.vod.use_gop_size'),
];

Expand Down
1 change: 1 addition & 0 deletions lib/Settings/SystemConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class SystemConfig

// Extra streaming configuration
'memories.vod.use_transpose' => false,
'memories.vod.use_transpose.force_sw' => false,
'memories.vod.use_gop_size' => false,

// Paths to ffmpeg and ffprobe binaries
Expand Down
1 change: 1 addition & 0 deletions src/components/admin/AdminTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type ISystemConfig = {
'memories.vod.nvenc.scale': string;

'memories.vod.use_transpose': boolean;
'memories.vod.use_transpose.force_sw': boolean;
'memories.vod.use_gop_size': boolean;

'memories.db.triggers.fcu': boolean;
Expand Down
15 changes: 15 additions & 0 deletions src/components/admin/sections/VideoAccel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
'Due to a bug in certain hardware drivers, videos may appear in incorrect orientations when streaming. This can be resolved in some cases by rotating the video on the accelerator.',
)
}}
{{
t(
'memories',
'Some drivers (e.g. AMD and older Intel) do not support hardware accelerated rotation. You can attempt to force software-based transpose in this case.',
)
}}
<br />
<b>
{{ t('memories', 'Try this option only if you have incorrectly oriented videos during playback.') }}
Expand All @@ -126,6 +132,15 @@
{{ t('memories', 'Enable streaming transpose workaround') }}
</NcCheckboxRadioSwitch>

<NcCheckboxRadioSwitch
:disabled="!enableTranscoding || !config['memories.vod.use_transpose']"
:checked.sync="config['memories.vod.use_transpose.force_sw']"
@update:checked="update('memories.vod.use_transpose.force_sw')"
type="switch"
>
{{ t('memories', 'Force transpose in software') }}
</NcCheckboxRadioSwitch>

{{ t('memories', 'Some NVENC devices have issues with force_key_frames.') }}
<br />
<b>{{ t('memories', 'Try this option only if you use NVENC and have issues with video playback.') }}</b>
Expand Down

0 comments on commit 1d810df

Please sign in to comment.