Compare commits

...

4 Commits

  1. 2
      controllers/admin/serverConfig.go
  2. 20
      core/data/datastoreMigrations.go
  3. 248
      core/transcoder/codecs.go
  4. 10
      core/transcoder/transcoder.go
  5. 50
      core/transcoder/transcoder_vaapi-legacy_test.go
  6. 4
      core/transcoder/transcoder_vaapi_test.go
  7. 7
      models/videoCodec.go
  8. 2
      static/web/404.html
  9. 2
      static/web/404/index.html
  10. 1
      static/web/_next/static/-4yiuyziZt_OmyIpMdoZe/_buildManifest.js
  11. 1
      static/web/_next/static/-4yiuyziZt_OmyIpMdoZe/_ssgManifest.js
  12. 1
      static/web/_next/static/chunks/4281-f024035bb909af4e.js
  13. 1
      static/web/_next/static/chunks/5056-b14d7a3d2aee94c3.js
  14. 11
      static/web/_next/static/chunks/5283-23ec4c27947dae66.js
  15. 1
      static/web/_next/static/chunks/5584.08b6806ea3012a43.js
  16. 19
      static/web/_next/static/chunks/6017-bb9b0312a26c35dd.js
  17. 1
      static/web/_next/static/chunks/7268.461abbd8430d83c0.js
  18. 1
      static/web/_next/static/chunks/7521-9644c656878abfe6.js
  19. 1
      static/web/_next/static/chunks/9069.663a9f4ff16078e0.js
  20. 6
      static/web/_next/static/chunks/ee8b1517-4bb4890d4ff38215.js
  21. 1
      static/web/_next/static/chunks/pages/admin/config-video-49377987a1ea18f7.js
  22. 1
      static/web/_next/static/chunks/pages/admin/upgrade-ba6e73bb555cba17.js
  23. 1
      static/web/_next/static/chunks/webpack-17c574c3c0f8700e.js
  24. 1
      static/web/_next/static/cwpGoEeRre4E9Q5BBUvdu/_buildManifest.js
  25. 1
      static/web/_next/static/cwpGoEeRre4E9Q5BBUvdu/_ssgManifest.js
  26. 2
      static/web/admin/access-tokens/index.html
  27. 2
      static/web/admin/actions/index.html
  28. 2
      static/web/admin/chat/emojis/index.html
  29. 2
      static/web/admin/chat/messages/index.html
  30. 2
      static/web/admin/chat/users/index.html
  31. 2
      static/web/admin/config-chat/index.html
  32. 2
      static/web/admin/config-federation/index.html
  33. 2
      static/web/admin/config-notify/index.html
  34. 2
      static/web/admin/config-social-items/index.html
  35. 2
      static/web/admin/config-video/index.html
  36. 2
      static/web/admin/config/general/index.html
  37. 2
      static/web/admin/config/server/index.html
  38. 2
      static/web/admin/federation/actions/index.html
  39. 2
      static/web/admin/federation/followers/index.html
  40. 2
      static/web/admin/hardware-info/index.html
  41. 2
      static/web/admin/help/index.html
  42. 2
      static/web/admin/index.html
  43. 2
      static/web/admin/logs/index.html
  44. 2
      static/web/admin/stream-health/index.html
  45. 2
      static/web/admin/upgrade/index.html
  46. 2
      static/web/admin/viewer-info/index.html
  47. 2
      static/web/admin/webhooks/index.html
  48. 4
      static/web/embed/chat/readonly/index.html
  49. 4
      static/web/embed/chat/readwrite/index.html
  50. 4
      static/web/embed/video/index.html
  51. 4
      static/web/index.html
  52. 2
      static/web/sw.js
  53. 35
      web/components/admin/CodecSelector.tsx
  54. 4
      web/types/config-section.ts
  55. 5
      web/types/video-codec.ts

2
controllers/admin/serverConfig.go

@ -111,7 +111,7 @@ type serverConfigAdminResponse struct { @@ -111,7 +111,7 @@ type serverConfigAdminResponse struct {
VideoServingEndpoint string `json:"videoServingEndpoint"`
S3 models.S3 `json:"s3"`
Federation federationConfigResponse `json:"federation"`
SupportedCodecs []string `json:"supportedCodecs"`
SupportedCodecs []models.VideoCodec `json:"supportedCodecs"`
ExternalActions []models.ExternalAction `json:"externalActions"`
ForbiddenUsernames []string `json:"forbiddenUsernames"`
SuggestedUsernames []string `json:"suggestedUsernames"`

20
core/data/datastoreMigrations.go

@ -8,7 +8,7 @@ import ( @@ -8,7 +8,7 @@ import (
)
const (
datastoreValuesVersion = 3
datastoreValuesVersion = 4
datastoreValueVersionKey = "DATA_STORE_VERSION"
)
@ -27,6 +27,8 @@ func migrateDatastoreValues(datastore *Datastore) { @@ -27,6 +27,8 @@ func migrateDatastoreValues(datastore *Datastore) {
migrateToDatastoreValues2(datastore)
case 2:
migrateToDatastoreValues3ServingEndpoint3(datastore)
case 3:
migrateToDatastoreVaapiCodecSettingValue4(datastore)
default:
log.Fatalln("missing datastore values migration step")
}
@ -73,3 +75,19 @@ func migrateToDatastoreValues3ServingEndpoint3(_ *Datastore) { @@ -73,3 +75,19 @@ func migrateToDatastoreValues3ServingEndpoint3(_ *Datastore) {
_ = SetVideoServingEndpoint(s3Config.ServingEndpoint)
}
func migrateToDatastoreVaapiCodecSettingValue4(_ *Datastore) {
// If the currently selected codec is "vaapi" then we need
// to migrate the name to the updated name.
currentCodec := GetVideoCodec()
if currentCodec != "h264_vaapi" {
return
}
// The updated name for the old vaapi codec is "h264_vaapi_legacy"
// so we update it. This is assuming existing users will be using older
// versions of ffmpeg.
_ = SetVideoCodec("h264_vaapi_legacy")
log.Println("An update to the vaapi video codec has been made. It will now be selected as vaapi (Legacy) in your video settings. However, if you are running a version of ffmpeg greater than 5.0 you should update your video codec settings to use the 5.0+ codec setting instead.")
}

248
core/transcoder/codecs.go

@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
"os/exec"
"strings"
"github.com/owncast/owncast/models"
log "github.com/sirupsen/logrus"
)
@ -14,6 +15,7 @@ import ( @@ -14,6 +15,7 @@ import (
type Codec interface {
Name() string
DisplayName() string
Key() string
GlobalFlags() string
PixelFormat() string
Scaler() string
@ -21,17 +23,18 @@ type Codec interface { @@ -21,17 +23,18 @@ type Codec interface {
ExtraFilters() string
VariantFlags(v *HLSVariant) string
GetPresetForLevel(l int) string
GetRepresentation() models.VideoCodec
}
var supportedCodecs = map[string]string{
(&Libx264Codec{}).Name(): "libx264",
(&OmxCodec{}).Name(): "omx",
(&VaapiCodec{}).Name(): "vaapi",
(&VaapiLegacyCodec{}).Name(): "vaapi (legacy)",
(&VaapiCodec{}).Name(): "vaapi (ffmpeg 5+)",
(&NvencCodec{}).Name(): "NVIDIA nvenc",
(&VideoToolboxCodec{}).Name(): "videotoolbox",
}
// Libx264Codec represents an instance of the Libx264 Codec.
type Libx264Codec struct{}
// Name returns the codec name.
@ -41,7 +44,12 @@ func (c *Libx264Codec) Name() string { @@ -41,7 +44,12 @@ func (c *Libx264Codec) Name() string {
// DisplayName returns the human readable name of the codec.
func (c *Libx264Codec) DisplayName() string {
return "x264"
return "x264 (Default)"
}
// Name returns the codec key.
func (c *Libx264Codec) Key() string {
return c.Name()
}
// GlobalFlags are the global flags used with this codec in the transcoder.
@ -100,6 +108,15 @@ func (c *Libx264Codec) GetPresetForLevel(l int) string { @@ -100,6 +108,15 @@ func (c *Libx264Codec) GetPresetForLevel(l int) string {
return preset
}
// GetRepresentation returns the simplified codec representation of this codec.
func (c *Libx264Codec) GetRepresentation() models.VideoCodec {
return models.VideoCodec{
Name: c.Name(),
DisplayName: c.DisplayName(),
Key: c.Key(),
}
}
// OmxCodec represents an instance of the Omx codec.
type OmxCodec struct{}
@ -113,6 +130,11 @@ func (c *OmxCodec) DisplayName() string { @@ -113,6 +130,11 @@ func (c *OmxCodec) DisplayName() string {
return "OpenMAX (omx)"
}
// Name returns the codec key.
func (c *OmxCodec) Key() string {
return c.Name()
}
// GlobalFlags are the global flags used with this codec in the transcoder.
func (c *OmxCodec) GlobalFlags() string {
return ""
@ -165,7 +187,99 @@ func (c *OmxCodec) GetPresetForLevel(l int) string { @@ -165,7 +187,99 @@ func (c *OmxCodec) GetPresetForLevel(l int) string {
return preset
}
// VaapiCodec represents an instance of the Vaapi codec.
// GetRepresentation returns the simplified codec representation of this codec.
func (c *OmxCodec) GetRepresentation() models.VideoCodec {
return models.VideoCodec{
Name: c.Name(),
DisplayName: c.DisplayName(),
Key: c.Key(),
}
}
// VaapiLegacyCodec represents an instance of the Vaapi codec.
type VaapiLegacyCodec struct{}
// Name returns the codec name.
func (c *VaapiLegacyCodec) Name() string {
return "h264_vaapi" //nolint:goconst
}
// DisplayName returns the human readable name of the codec.
func (c *VaapiLegacyCodec) DisplayName() string {
return "VA-API (Legacy)"
}
// Name returns the codec key.
func (c *VaapiLegacyCodec) Key() string {
return "h264_vaapi_legacy"
}
// GlobalFlags are the global flags used with this codec in the transcoder.
func (c *VaapiLegacyCodec) GlobalFlags() string {
flags := []string{
"-hwaccel", "vaapi",
"-hwaccel_output_format", "vaapi",
"-vaapi_device", "/dev/dri/renderD128",
}
return strings.Join(flags, " ")
}
// PixelFormat is the pixel format required for this codec.
func (c *VaapiLegacyCodec) PixelFormat() string {
return "vaapi_vld"
}
// Scaler is the scaler used for resizing the video in the transcoder.
func (c *VaapiLegacyCodec) Scaler() string {
return "scale_vaapi"
}
// ExtraFilters are the extra filters required for this codec in the transcoder.
func (c *VaapiLegacyCodec) ExtraFilters() string {
return ""
}
// ExtraArguments are the extra arguments used with this codec in the transcoder.
func (c *VaapiLegacyCodec) ExtraArguments() string {
return ""
}
// VariantFlags returns a string representing a single variant processed by this codec.
func (c *VaapiLegacyCodec) VariantFlags(v *HLSVariant) string {
return ""
}
// GetPresetForLevel returns the string preset for this codec given an integer level.
func (c *VaapiLegacyCodec) GetPresetForLevel(l int) string {
presetMapping := map[int]string{
0: "ultrafast",
1: "superfast",
2: "veryfast",
3: "faster",
4: "fast",
}
preset, ok := presetMapping[l]
if !ok {
defaultPreset := presetMapping[1]
log.Errorf("Invalid level for vaapi preset %d, defaulting to %s", l, defaultPreset)
return defaultPreset
}
return preset
}
// GetRepresentation returns the simplified codec representation of this codec.
func (c *VaapiLegacyCodec) GetRepresentation() models.VideoCodec {
return models.VideoCodec{
Name: c.Name(),
DisplayName: c.DisplayName(),
Key: c.Key(),
}
}
// VaapiCodec represents the vaapi codec included in ffmpeg 5.0+.
type VaapiCodec struct{}
// Name returns the codec name.
@ -175,7 +289,12 @@ func (c *VaapiCodec) Name() string { @@ -175,7 +289,12 @@ func (c *VaapiCodec) Name() string {
// DisplayName returns the human readable name of the codec.
func (c *VaapiCodec) DisplayName() string {
return "VA-API"
return "VA-API (ffmpeg 5+)"
}
// Name returns the codec key.
func (c *VaapiCodec) Key() string {
return "h264_vaapi"
}
// GlobalFlags are the global flags used with this codec in the transcoder.
@ -191,7 +310,7 @@ func (c *VaapiCodec) GlobalFlags() string { @@ -191,7 +310,7 @@ func (c *VaapiCodec) GlobalFlags() string {
// PixelFormat is the pixel format required for this codec.
func (c *VaapiCodec) PixelFormat() string {
return "vaapi_vld"
return "vaapi"
}
// Scaler is the scaler used for resizing the video in the transcoder.
@ -234,6 +353,15 @@ func (c *VaapiCodec) GetPresetForLevel(l int) string { @@ -234,6 +353,15 @@ func (c *VaapiCodec) GetPresetForLevel(l int) string {
return preset
}
// GetRepresentation returns the simplified codec representation of this codec.
func (c *VaapiCodec) GetRepresentation() models.VideoCodec {
return models.VideoCodec{
Name: c.Name(),
DisplayName: c.DisplayName(),
Key: c.Key(),
}
}
// NvencCodec represents an instance of the Nvenc Codec.
type NvencCodec struct{}
@ -247,6 +375,11 @@ func (c *NvencCodec) DisplayName() string { @@ -247,6 +375,11 @@ func (c *NvencCodec) DisplayName() string {
return "nvidia nvenc"
}
// Name returns the codec key.
func (c *NvencCodec) Key() string {
return c.Name()
}
// GlobalFlags are the global flags used with this codec in the transcoder.
func (c *NvencCodec) GlobalFlags() string {
flags := []string{
@ -302,6 +435,15 @@ func (c *NvencCodec) GetPresetForLevel(l int) string { @@ -302,6 +435,15 @@ func (c *NvencCodec) GetPresetForLevel(l int) string {
return preset
}
// GetRepresentation returns the simplified codec representation of this codec.
func (c *NvencCodec) GetRepresentation() models.VideoCodec {
return models.VideoCodec{
Name: c.Name(),
DisplayName: c.DisplayName(),
Key: c.Key(),
}
}
// QuicksyncCodec represents an instance of the Intel Quicksync Codec.
type QuicksyncCodec struct{}
@ -315,6 +457,11 @@ func (c *QuicksyncCodec) DisplayName() string { @@ -315,6 +457,11 @@ func (c *QuicksyncCodec) DisplayName() string {
return "Intel QuickSync"
}
// Name returns the codec key.
func (c *QuicksyncCodec) Key() string {
return c.Name()
}
// GlobalFlags are the global flags used with this codec in the transcoder.
func (c *QuicksyncCodec) GlobalFlags() string {
return ""
@ -365,6 +512,15 @@ func (c *QuicksyncCodec) GetPresetForLevel(l int) string { @@ -365,6 +512,15 @@ func (c *QuicksyncCodec) GetPresetForLevel(l int) string {
return preset
}
// GetRepresentation returns the simplified codec representation of this codec.
func (c *QuicksyncCodec) GetRepresentation() models.VideoCodec {
return models.VideoCodec{
Name: c.Name(),
DisplayName: c.DisplayName(),
Key: c.Key(),
}
}
// Video4Linux represents an instance of the V4L Codec.
type Video4Linux struct{}
@ -378,6 +534,11 @@ func (c *Video4Linux) DisplayName() string { @@ -378,6 +534,11 @@ func (c *Video4Linux) DisplayName() string {
return "Video4Linux"
}
// Name returns the codec key.
func (c *Video4Linux) Key() string {
return c.Name()
}
// GlobalFlags are the global flags used with this codec in the transcoder.
func (c *Video4Linux) GlobalFlags() string {
return ""
@ -427,6 +588,15 @@ func (c *Video4Linux) GetPresetForLevel(l int) string { @@ -427,6 +588,15 @@ func (c *Video4Linux) GetPresetForLevel(l int) string {
return preset
}
// GetRepresentation returns the simplified codec representation of this codec.
func (c *Video4Linux) GetRepresentation() models.VideoCodec {
return models.VideoCodec{
Name: c.Name(),
DisplayName: c.DisplayName(),
Key: c.Key(),
}
}
// VideoToolboxCodec represents an instance of the VideoToolbox codec.
type VideoToolboxCodec struct{}
@ -440,6 +610,11 @@ func (c *VideoToolboxCodec) DisplayName() string { @@ -440,6 +610,11 @@ func (c *VideoToolboxCodec) DisplayName() string {
return "VideoToolbox"
}
// Name returns the codec key.
func (c *VideoToolboxCodec) Key() string {
return c.Name()
}
// GlobalFlags are the global flags used with this codec in the transcoder.
func (c *VideoToolboxCodec) GlobalFlags() string {
var flags []string
@ -502,25 +677,35 @@ func (c *VideoToolboxCodec) GetPresetForLevel(l int) string { @@ -502,25 +677,35 @@ func (c *VideoToolboxCodec) GetPresetForLevel(l int) string {
return preset
}
// GetRepresentation returns the simplified codec representation of this codec.
func (c *VideoToolboxCodec) GetRepresentation() models.VideoCodec {
return models.VideoCodec{
Name: c.Name(),
DisplayName: c.DisplayName(),
Key: c.Key(),
}
}
// GetCodecs will return the supported codecs available on the system.
func GetCodecs(ffmpegPath string) []string {
codecs := make([]string, 0)
func GetCodecs(ffmpegPath string) []models.VideoCodec {
codecs := make([]models.VideoCodec, 0)
cmd := exec.Command(ffmpegPath, "-encoders")
out, err := cmd.CombinedOutput()
if err != nil {
log.Errorln(err)
return codecs
}
response := string(out)
lines := strings.Split(response, "\n")
for _, line := range lines {
if strings.Contains(line, "H.264") {
fields := strings.Fields(line)
codec := fields[1]
if _, supported := supportedCodecs[codec]; supported {
codecs = append(codecs, codec)
codecString := fields[1]
supportedCodecsForName := getCodec(codecString)
for _, codec := range supportedCodecsForName {
if _, supported := supportedCodecs[codecString]; supported {
codecs = append(codecs, codec.GetRepresentation())
}
}
}
}
@ -528,19 +713,44 @@ func GetCodecs(ffmpegPath string) []string { @@ -528,19 +713,44 @@ func GetCodecs(ffmpegPath string) []string {
return codecs
}
func getCodec(name string) Codec {
func getCodec(name string) []Codec {
switch name {
case (&NvencCodec{}).Name():
return &NvencCodec{}
return []Codec{&NvencCodec{}}
case (&VaapiLegacyCodec{}).Name():
return []Codec{&VaapiLegacyCodec{}, &VaapiCodec{}}
case (&VaapiCodec{}).Name():
return &VaapiCodec{}
return []Codec{&VaapiLegacyCodec{}, &VaapiCodec{}}
case (&QuicksyncCodec{}).Name():
return &QuicksyncCodec{}
return []Codec{&QuicksyncCodec{}}
case (&OmxCodec{}).Name():
return &OmxCodec{}
return []Codec{&OmxCodec{}}
case (&Video4Linux{}).Name():
return &Video4Linux{}
return []Codec{&Video4Linux{}}
case (&VideoToolboxCodec{}).Name():
return []Codec{&VideoToolboxCodec{}}
case (&Libx264Codec{}).Name():
return []Codec{&Libx264Codec{}}
default:
return []Codec{}
}
}
func getCodecForKey(key string) Codec {
switch key {
case (&NvencCodec{}).Key():
return &NvencCodec{}
case (&VaapiLegacyCodec{}).Key():
return &VaapiLegacyCodec{}
case (&VaapiCodec{}).Key():
return &VaapiCodec{}
case (&QuicksyncCodec{}).Key():
return &QuicksyncCodec{}
case (&OmxCodec{}).Key():
return &OmxCodec{}
case (&Video4Linux{}).Key():
return &Video4Linux{}
case (&VideoToolboxCodec{}).Key():
return &VideoToolboxCodec{}
default:
return &Libx264Codec{}

10
core/transcoder/transcoder.go

@ -274,6 +274,8 @@ func getVariantFromConfigQuality(quality models.StreamOutputVariant, index int) @@ -274,6 +274,8 @@ func getVariantFromConfigQuality(quality models.StreamOutputVariant, index int)
// NewTranscoder will return a new Transcoder, populated by the config.
func NewTranscoder() *Transcoder {
ffmpegPath := utils.ValidatedFfmpegPath(data.GetFfMpegPath())
codecKey := data.GetVideoCodec()
codec := getCodecForKey(codecKey)
transcoder := new(Transcoder)
transcoder.ffmpegPath = ffmpegPath
@ -281,7 +283,7 @@ func NewTranscoder() *Transcoder { @@ -281,7 +283,7 @@ func NewTranscoder() *Transcoder {
transcoder.currentStreamOutputSettings = data.GetStreamOutputVariants()
transcoder.currentLatencyLevel = data.GetStreamLatencyLevel()
transcoder.codec = getCodec(data.GetVideoCodec())
transcoder.codec = codec
transcoder.segmentOutputPath = config.HLSStoragePath
transcoder.playlistOutputPath = config.HLSStoragePath
@ -448,7 +450,7 @@ func (t *Transcoder) SetInternalHTTPPort(port string) { @@ -448,7 +450,7 @@ func (t *Transcoder) SetInternalHTTPPort(port string) {
t.internalListenerPort = port
}
// SetCodec will set the codec to be used for the transocder.
func (t *Transcoder) SetCodec(codecName string) {
t.codec = getCodec(codecName)
// SetCodec will set the codec to be used for the transcoder.
func (t *Transcoder) SetCodec(codecKey string) {
t.codec = getCodecForKey(codecKey)
}

50
core/transcoder/transcoder_vaapi-legacy_test.go

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
package transcoder
import (
"path/filepath"
"testing"
"github.com/owncast/owncast/models"
)
func TestFFmpegVaapiLegacyCommand(t *testing.T) {
latencyLevel := models.GetLatencyLevel(2)
codec := VaapiLegacyCodec{}
transcoder := new(Transcoder)
transcoder.ffmpegPath = filepath.Join("fake", "path", "ffmpeg")
transcoder.SetInput("fakecontent.flv")
transcoder.SetOutputPath("fakeOutput")
transcoder.SetIdentifier("jdofFGg")
transcoder.SetInternalHTTPPort("8123")
transcoder.SetCodec(codec.Key())
transcoder.currentLatencyLevel = latencyLevel
variant := HLSVariant{}
variant.videoBitrate = 1200
variant.isAudioPassthrough = true
variant.SetVideoFramerate(30)
variant.SetCPUUsageLevel(2)
transcoder.AddVariant(variant)
variant2 := HLSVariant{}
variant2.videoBitrate = 3500
variant2.isAudioPassthrough = true
variant2.SetVideoFramerate(24)
variant2.SetCPUUsageLevel(4)
transcoder.AddVariant(variant2)
variant3 := HLSVariant{}
variant3.isAudioPassthrough = true
variant3.isVideoPassthrough = true
transcoder.AddVariant(variant3)
cmd := transcoder.getString()
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_vaapi -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 h264_vaapi -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt vaapi_vld -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT http://127.0.0.1:8123/%v/stream.m3u8`
if cmd != expected {
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)
}
}

4
core/transcoder/transcoder_vaapi_test.go

@ -17,7 +17,7 @@ func TestFFmpegVaapiCommand(t *testing.T) { @@ -17,7 +17,7 @@ func TestFFmpegVaapiCommand(t *testing.T) {
transcoder.SetOutputPath("fakeOutput")
transcoder.SetIdentifier("jdofFGg")
transcoder.SetInternalHTTPPort("8123")
transcoder.SetCodec(codec.Name())
transcoder.SetCodec(codec.Key())
transcoder.currentLatencyLevel = latencyLevel
variant := HLSVariant{}
@ -42,7 +42,7 @@ func TestFFmpegVaapiCommand(t *testing.T) { @@ -42,7 +42,7 @@ func TestFFmpegVaapiCommand(t *testing.T) {
cmd := transcoder.getString()
expectedLogPath := filepath.Join("data", "logs", "transcoder.log")
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_vaapi -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 h264_vaapi -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt vaapi_vld -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT http://127.0.0.1:8123/%v/stream.m3u8`
expected := `FFREPORT=file="` + expectedLogPath + `":level=32 ` + transcoder.ffmpegPath + ` -hide_banner -loglevel warning -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -fflags +genpts -flags +cgop -i fakecontent.flv -map v:0 -c:v:0 h264_vaapi -b:v:0 1008k -maxrate:v:0 1088k -g:v:0 90 -keyint_min:v:0 90 -r:v:0 30 -map a:0? -c:a:0 copy -preset veryfast -map v:0 -c:v:1 h264_vaapi -b:v:1 3308k -maxrate:v:1 3572k -g:v:1 72 -keyint_min:v:1 72 -r:v:1 24 -map a:0? -c:a:1 copy -preset fast -map v:0 -c:v:2 copy -map a:0? -c:a:2 copy -preset ultrafast -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 " -f hls -hls_time 3 -hls_list_size 10 -hls_flags program_date_time+independent_segments+omit_endlist -segment_format_options mpegts_flags=mpegts_copyts=1 -pix_fmt vaapi -sc_threshold 0 -master_pl_name stream.m3u8 -hls_segment_filename http://127.0.0.1:8123/%v/stream-jdofFGg-%d.ts -max_muxing_queue_size 400 -method PUT http://127.0.0.1:8123/%v/stream.m3u8`
if cmd != expected {
t.Errorf("ffmpeg command does not match expected.\nGot %s\n, want: %s", cmd, expected)

7
models/videoCodec.go

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
package models
type VideoCodec struct {
Name string `json:"name"`
DisplayName string `json:"displayName"`
Key string `json:"key"`
}

2
static/web/404.html vendored

File diff suppressed because one or more lines are too long

2
static/web/404/index.html vendored

File diff suppressed because one or more lines are too long

1
static/web/_next/static/-4yiuyziZt_OmyIpMdoZe/_buildManifest.js

File diff suppressed because one or more lines are too long

1
static/web/_next/static/-4yiuyziZt_OmyIpMdoZe/_ssgManifest.js

@ -1 +0,0 @@ @@ -1 +0,0 @@
self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB();

1
static/web/_next/static/chunks/4281-f024035bb909af4e.js vendored

File diff suppressed because one or more lines are too long

1
static/web/_next/static/chunks/5056-b14d7a3d2aee94c3.js vendored

File diff suppressed because one or more lines are too long

11
static/web/_next/static/chunks/5283-23ec4c27947dae66.js vendored

File diff suppressed because one or more lines are too long

1
static/web/_next/static/chunks/5584.08b6806ea3012a43.js vendored

@ -1 +0,0 @@ @@ -1 +0,0 @@
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5584],{15584:function(e,t,n){n.r(t);var r,a,s,o,i,l=n(67294);function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}t.default=function(e){return l.createElement("svg",_extends({xmlns:"http://www.w3.org/2000/svg",width:500,height:500,viewBox:"0 0 132.292 132.292"},e),r||(r=l.createElement("linearGradient",{id:"like_svg__a",x1:432.851,x2:464.644,y1:49.977,y2:49.977,gradientUnits:"userSpaceOnUse"},l.createElement("stop",{offset:0,stopColor:"#2087e2"}),l.createElement("stop",{offset:1,stopColor:"#b63fff"}))),a||(a=l.createElement("path",{fill:"url(#like_svg__a)",d:"M438.672 34.08h20.151a5.82 5.82 45 0 1 5.82 5.821v20.151a5.82 5.82 135 0 1-5.82 5.821h-20.15a5.82 5.82 45 0 1-5.822-5.82V39.9a5.82 5.82 135 0 1 5.821-5.82z",transform:"matrix(4.1611 0 0 4.1611 -1801.14 -141.813)"})),s||(s=l.createElement("path",{fill:"#853dd0",d:"M106.243 25.198 110 33.435l5.378 24.12-20.557 29.696-28.676 20.66-35.66-24.468 49.536 48.849h28.048a24.221 24.221 0 0 0 24.222-24.222V44.165z",opacity:.75})),o||(o=l.createElement("path",{fill:"#8392ee",d:"M51.275 39.14s-36.386-7.356-17.999 25.83c13.869 25.032 29.59 23.091 29.59 23.091S47.512 65.822 51.275 39.14"})),i||(i=l.createElement("path",{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:7.865,d:"M674.216 70.254c-21.056-22.863-45.943 2.215-45.943 2.215s-24.888-25.078-45.943-2.216c-21.056 22.863 16.89 64.133 45.943 78.023 29.053-13.89 66.998-55.16 45.943-78.022",transform:"matrix(.95455 0 0 .95455 -533.57 -33.626)"})))}}}]);

19
static/web/_next/static/chunks/6017-bb9b0312a26c35dd.js vendored

File diff suppressed because one or more lines are too long

1
static/web/_next/static/chunks/7268.461abbd8430d83c0.js vendored

@ -1 +0,0 @@ @@ -1 +0,0 @@
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7268],{97268:function(e,t,r){r.r(t);var a,n,s,o,l=r(67294);function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}t.default=function(e){return l.createElement("svg",_extends({xmlns:"http://www.w3.org/2000/svg",width:500,height:500,viewBox:"0 0 132.292 132.292"},e),a||(a=l.createElement("linearGradient",{id:"repost_svg__a",x1:432.851,x2:464.644,y1:49.977,y2:49.977,gradientUnits:"userSpaceOnUse"},l.createElement("stop",{offset:0,stopColor:"#2087e2"}),l.createElement("stop",{offset:1,stopColor:"#b63fff"}))),n||(n=l.createElement("path",{fill:"url(#repost_svg__a)",d:"M438.672 34.08h20.151a5.82 5.82 45 0 1 5.82 5.821v20.151a5.82 5.82 135 0 1-5.82 5.821h-20.15a5.82 5.82 45 0 1-5.822-5.82V39.9a5.82 5.82 135 0 1 5.821-5.82z",transform:"matrix(4.16112 0 0 4.1611 -1801.146 -141.813)"})),s||(s=l.createElement("path",{fill:"#7f40cf",d:"m103.028 50.073-.794 41.033-10.18 12.882-49.412 3.477 26.027 24.827h39.4c13.378 0 24.223-10.845 24.222-24.222V68.265l-9.86-12.31z",opacity:.75})),o||(o=l.createElement("g",{fill:"none",stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:7.865},l.createElement("path",{d:"M741.453 94.965h-41.418a14.744 14.744 0 0 0-14.777 14.777v41.418m14.777 14.777h41.418c8.187 0 14.777-6.59 14.777-14.777v-41.418",transform:"translate(-696.642 -71.915)scale(1.05833)"}),l.createElement("path",{d:"m670.076 143.371 15.182 13.79 15.5-13.6",transform:"translate(-696.642 -71.915)scale(1.05833)"}),l.createElement("path",{d:"m670.076 143.371 15.182 13.79 15.5-13.6",transform:"rotate(180 414.466 105.278)scale(1.05833)"}))))}}}]);

1
static/web/_next/static/chunks/7521-9644c656878abfe6.js vendored

File diff suppressed because one or more lines are too long

1
static/web/_next/static/chunks/9069.663a9f4ff16078e0.js vendored

@ -1 +0,0 @@ @@ -1 +0,0 @@
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9069],{49069:function(e,t,r){r.r(t);var a,n,o,l,s=r(67294);function _extends(){return(_extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}t.default=function(e){return s.createElement("svg",_extends({xmlns:"http://www.w3.org/2000/svg",width:500,height:500,viewBox:"0 0 132.292 132.292"},e),a||(a=s.createElement("linearGradient",{id:"follow_svg__a",x1:432.851,x2:464.644,y1:49.977,y2:49.977,gradientUnits:"userSpaceOnUse"},s.createElement("stop",{offset:0,stopColor:"#2087e2"}),s.createElement("stop",{offset:1,stopColor:"#b63fff"}))),n||(n=s.createElement("path",{fill:"url(#follow_svg__a)",d:"M438.672 34.08h20.151a5.82 5.82 45 0 1 5.82 5.821v20.151a5.82 5.82 135 0 1-5.82 5.821h-20.15a5.82 5.82 45 0 1-5.822-5.82V39.9a5.82 5.82 135 0 1 5.821-5.82z",transform:"matrix(4.16112 0 0 4.1611 -1801.146 -141.813)"})),o||(o=s.createElement("path",{fill:"#8842da",d:"m99.29 73.002-1.238 22.769-22.423.995 25.259 35.526h7.183c13.377-.001 24.22-10.845 24.22-24.222V89.683z",opacity:.85})),l||(l=s.createElement("g",{stroke:"#fff",strokeLinecap:"round",strokeLinejoin:"round"},s.createElement("circle",{cx:876.218,cy:118.03,r:21.554,fill:"none",strokeWidth:8.788,transform:"matrix(.90817 0 0 .9124 -737.017 -65.428)"}),s.createElement("path",{fill:"none",strokeWidth:6.641,d:"M845.107 163.996c0-16.543 13.41-29.953 29.953-29.953a29.953 29.953 0 0 1 19.632 7.331",transform:"matrix(1.14743 0 0 1.26483 -944.188 -103.004)"}),s.createElement("g",{fill:"#fff",strokeWidth:7.559},s.createElement("path",{d:"m881.641 159.874 34.92.28",transform:"translate(-853.609 -74.031)scale(1.05833)"}),s.createElement("path",{d:"m881.641 159.874 34.92.28",transform:"rotate(90 561.76 -294.47)scale(1.05833)"})))))}}}]);

6
static/web/_next/static/chunks/ee8b1517-4bb4890d4ff38215.js vendored

File diff suppressed because one or more lines are too long

1
static/web/_next/static/chunks/pages/admin/config-video-49377987a1ea18f7.js vendored

File diff suppressed because one or more lines are too long

1
static/web/_next/static/chunks/pages/admin/upgrade-ba6e73bb555cba17.js vendored

@ -1 +0,0 @@ @@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9262],{70918:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/upgrade",function(){return a(7494)}])},7494:function(e,t,a){"use strict";a.r(t);var n=a(85893),s=a(67294),l=a(59899),r=a(2307),d=a(53740),u=a(92863),i=a(15578);let{Title:o}=d.default,AssetTable=e=>{let t=Object.values(e);return(0,n.jsx)(r.Z,{dataSource:t,columns:[{title:"Name",dataIndex:"name",key:"name",render:(e,t)=>(0,n.jsx)("a",{href:t.browser_download_url,children:e})},{title:"Size",dataIndex:"size",key:"size",render:e=>"".concat((e/1024/1024).toFixed(2)," MB")}],rowKey:e=>e.id,size:"large",pagination:!1})},Logs=()=>{let[e,t]=(0,s.useState)({html_url:"",name:"",created_at:null,body:"",assets:[]}),getRelease=async()=>{try{let e=await (0,u.Kt)();t(e)}catch(e){console.log("==== error",e)}};return((0,s.useEffect)(()=>{getRelease()},[]),e)?(0,n.jsxs)("div",{className:"upgrade-page",children:[(0,n.jsx)(o,{level:2,children:(0,n.jsx)("a",{href:e.html_url,children:e.name})}),(0,n.jsx)(o,{level:5,children:new Date(e.created_at).toDateString()}),(0,n.jsx)(l.U,{children:e.body}),(0,n.jsx)("h3",{children:"Downloads"}),(0,n.jsx)(AssetTable,{...e.assets})]}):null};Logs.getLayout=function(e){return(0,n.jsx)(i.l,{page:e})},t.default=Logs}},function(e){e.O(0,[5596,1130,4104,9403,1024,3942,971,6697,1664,1749,1700,2122,7752,5891,2891,4749,6627,8966,7521,5578,9774,2888,179],function(){return e(e.s=70918)}),_N_E=e.O()}]);

1
static/web/_next/static/chunks/webpack-17c574c3c0f8700e.js vendored

File diff suppressed because one or more lines are too long

1
static/web/_next/static/cwpGoEeRre4E9Q5BBUvdu/_buildManifest.js

File diff suppressed because one or more lines are too long

1
static/web/_next/static/cwpGoEeRre4E9Q5BBUvdu/_ssgManifest.js

@ -1 +0,0 @@ @@ -1 +0,0 @@
self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB();

2
static/web/admin/access-tokens/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/actions/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/chat/emojis/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/chat/messages/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/chat/users/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/config-chat/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/config-federation/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/config-notify/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/config-social-items/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/config-video/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/config/general/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/config/server/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/federation/actions/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/federation/followers/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/hardware-info/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/help/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/logs/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/stream-health/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/upgrade/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/viewer-info/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/admin/webhooks/index.html vendored

File diff suppressed because one or more lines are too long

4
static/web/embed/chat/readonly/index.html vendored

File diff suppressed because one or more lines are too long

4
static/web/embed/chat/readwrite/index.html vendored

File diff suppressed because one or more lines are too long

4
static/web/embed/video/index.html vendored

File diff suppressed because one or more lines are too long

4
static/web/index.html vendored

File diff suppressed because one or more lines are too long

2
static/web/sw.js vendored

File diff suppressed because one or more lines are too long

35
web/components/admin/CodecSelector.tsx

@ -77,30 +77,12 @@ export const CodecSelector: FC<CodecSelectorProps> = () => { @@ -77,30 +77,12 @@ export const CodecSelector: FC<CodecSelectorProps> = () => {
});
}
const items = supportedCodecs.map(codec => {
let title = codec;
if (title === 'libx264') {
title = 'Default (libx264)';
} else if (title === 'h264_nvenc') {
title = 'NVIDIA GPU acceleration';
} else if (title === 'h264_vaapi') {
title = 'VA-API hardware encoding';
} else if (title === 'h264_qsv') {
title = 'Intel QuickSync';
} else if (title === 'h264_v4l2m2m') {
title = 'Video4Linux hardware encoding';
} else if (title === 'h264_omx') {
title = 'OpenMax (omx) for Raspberry Pi';
} else if (title === 'h264_videotoolbox') {
title = 'Apple VideoToolbox (hardware)';
}
return (
<Option key={codec} value={codec}>
{title}
</Option>
);
});
// console.log(supportedCodecs);
const items = supportedCodecs.map(codec => (
<Option key={codec.key} value={codec.key}>
{codec.displayName}
</Option>
));
let description = '';
if (selectedCodec === 'libx264') {
@ -109,9 +91,12 @@ export const CodecSelector: FC<CodecSelectorProps> = () => { @@ -109,9 +91,12 @@ export const CodecSelector: FC<CodecSelectorProps> = () => {
} else if (selectedCodec === 'h264_nvenc') {
description =
'You can use your NVIDIA GPU for encoding if you have a modern NVIDIA card with encoding cores.';
} else if (selectedCodec === 'h264_vaapi_legacy') {
description =
'For versions of ffmpeg < 5.0. VA-API may be supported by your NVIDIA proprietary drivers, Mesa open-source drivers for AMD or Intel graphics.';
} else if (selectedCodec === 'h264_vaapi') {
description =
'VA-API may be supported by your NVIDIA proprietary drivers, Mesa open-source drivers for AMD or Intel graphics.';
'For versions of ffmpeg > 5.0. VA-API may be supported by your NVIDIA proprietary drivers, Mesa open-source drivers for AMD or Intel graphics.';
} else if (selectedCodec === 'h264_qsv') {
description =
"Quick Sync Video is Intel's brand for its dedicated video encoding and decoding hardware. It may be an option if you have a modern Intel CPU with integrated graphics.";

4
web/types/config-section.ts

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
// TS types for elements on the Config pages
import { VideoCodec } from './video-codec';
// for dropdown
export interface SocialHandleDropdownItem {
icon: string;
@ -147,7 +149,7 @@ export interface ConfigDetails { @@ -147,7 +149,7 @@ export interface ConfigDetails {
socketHostOverride: string;
videoServingEndpoint: string;
yp: ConfigDirectoryFields;
supportedCodecs: string[];
supportedCodecs: VideoCodec[];
videoCodec: string;
forbiddenUsernames: string[];
suggestedUsernames: string[];

5
web/types/video-codec.ts

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
export interface VideoCodec {
name: string;
displayName: string;
key: string;
}
Loading…
Cancel
Save