shaka-project / shaka-streamer

A simple config-file based approach to preparing streaming media, based on FFmpeg and Shaka Packager.
https://shaka-project.github.io/shaka-streamer/
Apache License 2.0
198 stars 62 forks source link

feat: Do not use libaom options, prefer libsvt-av1 #146

Open joeyparrish opened 10 months ago

joeyparrish commented 10 months ago

libsvt-av1 can encode in real time with no special options, and does not recognize the options we used in libaom to get as little as 0.2x encoding in our "Player History" live stream.

From now on, let's assume that anyone who wants to use AV1 is using libsvt-av1, which seems to be the only reasonable encoder. If someone is still using libaom, it will still work, but it will be using slower default settings.

mariocynicys commented 10 months ago

to get as little as 0.2x encoding

Do you mean +0.2x the speed of libaom?

Encoding is much much slower for AV1 after applying this patch (never got the finish the 6MB/40sec video I was testing with).

I am using my system ffmpeg since the static one from https://github.com/shaka-project/static-ffmpeg-binaries is segfaulting for some reason. My ffmpeg config:

ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.1.1 (GCC) 20230429
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
mariocynicys commented 10 months ago

My ffmpeg supports both libaom & libsvtav1, but looks like it defaults to using libaom anyways: image

Is there anyway to make it prefer one lib over the other?

joeyparrish commented 10 months ago

Do you mean +0.2x the speed of libaom?

No, I mean the live stream I mentioned can only be encoded at 0.2x in libaom on our hardware. In libsvt-av1, it can be encoded in realtime.

My ffmpeg supports both libaom & libsvtav1, but looks like it defaults to using libaom anyways. Is there anyway to make it prefer one lib over the other?

Yes, we can set something like -c:v libsvt-av1. Then streamer could only be used for AV1 with ffmpeg builds that have libsvt-av1. But given the performance difference, and the fact that the AOMedia group has dropped libaom in favor of libsvt-av1, I think I would be comfortable with that.