From 1993950cd7e098638d63b6fb5bd712ca75db5b76 Mon Sep 17 00:00:00 2001 From: Sergey Stepanov Date: Mon, 4 Dec 2023 18:20:05 +0300 Subject: [PATCH] Downgrade requirements for an old Ubuntu --- README.md | 3 +++ pkg/encoder/h264/x264.go | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ae86ce7e0..943eb664a 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,9 @@ a better sense of performance. , [libopus](http://opus-codec.org/), [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/) , [sdl2](https://wiki.libsdl.org/Installation) +(If you need to use the app on an older version of Ubuntu that does not have libyuv, you can add a custom apt repository: +`add sudo add-apt-repository ppa:savoury1/graphics`) + ``` # Ubuntu / Windows (WSL2) apt-get install -y make gcc pkg-config libvpx-dev libx264-dev libopus-dev libsdl2-dev libyuv-dev libjpeg-turbo8-dev diff --git a/pkg/encoder/h264/x264.go b/pkg/encoder/h264/x264.go index 8b10ce58a..c55f1502e 100644 --- a/pkg/encoder/h264/x264.go +++ b/pkg/encoder/h264/x264.go @@ -33,8 +33,8 @@ type Options struct { func NewEncoder(w, h int, th int, opts *Options) (encoder *H264, err error) { libVersion := LibVersion() - if libVersion < 156 { - return nil, fmt.Errorf("x264: the library version should be newer than v155, you have got version %v", libVersion) + if libVersion < 150 { + return nil, fmt.Errorf("x264: the library version should be newer than v150, you have got version %v", libVersion) } if opts == nil { @@ -64,7 +64,11 @@ func NewEncoder(w, h int, th int, opts *Options) (encoder *H264, err error) { ww, hh := int32(w), int32(h) param.IBitdepth = 8 - param.ICsp = CspI420 + if libVersion > 155 { + param.ICsp = CspI420 + } else { + param.ICsp = 1 + } param.IWidth = ww param.IHeight = hh param.ILogLevel = opts.LogLevel