Skip to content

Commit d354ef8

Browse files
committed
avcodec: Add librav1e encoder
Port to the new send/receive API by: James Almer <[email protected]>. Signed-off-by: Derek Buitenhuis <[email protected]>
1 parent a80fdbc commit d354ef8

File tree

6 files changed

+647
-0
lines changed

6 files changed

+647
-0
lines changed

configure

+5
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ External library support:
254254
--enable-libopenmpt enable decoding tracked files via libopenmpt [no]
255255
--enable-libopus enable Opus de/encoding via libopus [no]
256256
--enable-libpulse enable Pulseaudio input via libpulse [no]
257+
--enable-librav1e enable AV1 encoding via rav1e [no]
257258
--enable-librsvg enable SVG rasterization via librsvg [no]
258259
--enable-librubberband enable rubberband needed for rubberband filter [no]
259260
--enable-librtmp enable RTMP[E] support via librtmp [no]
@@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST="
17841785
libopenmpt
17851786
libopus
17861787
libpulse
1788+
librav1e
17871789
librsvg
17881790
librtmp
17891791
libshine
@@ -3190,6 +3192,8 @@ libopenmpt_demuxer_deps="libopenmpt"
31903192
libopus_decoder_deps="libopus"
31913193
libopus_encoder_deps="libopus"
31923194
libopus_encoder_select="audio_frame_queue"
3195+
librav1e_encoder_deps="librav1e"
3196+
librav1e_encoder_select="extract_extradata_bsf"
31933197
librsvg_decoder_deps="librsvg"
31943198
libshine_encoder_deps="libshine"
31953199
libshine_encoder_select="audio_frame_queue"
@@ -6261,6 +6265,7 @@ enabled libopus && {
62616265
}
62626266
}
62636267
enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
6268+
enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new
62646269
enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
62656270
enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
62666271
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"

doc/encoders.texi

+37
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,43 @@ makes it possible to store non-rgb pix_fmts.
13781378

13791379
@end table
13801380

1381+
@section librav1e
1382+
1383+
rav1e AV1 encoder wrapper.
1384+
1385+
Requires the presence of the rav1e headers and library during configuration.
1386+
You need to explicitly configure the build with @code{--enable-librav1e}.
1387+
1388+
@subsection Options
1389+
1390+
@table @option
1391+
@item qmax
1392+
Sets the maximum quantizer to use when using bitrate mode.
1393+
1394+
@item qmin
1395+
Sets the minimum quantizer to use when using bitrate mode.
1396+
1397+
@item qp
1398+
Uses quantizer mode to encode at the given quantizer.
1399+
1400+
@item speed
1401+
Selects the speed preset (0-10) to encode with.
1402+
1403+
@item tiles
1404+
Selects how many tiles to encode with.
1405+
1406+
@item rav1e-params
1407+
Set rav1e options using a list of @var{key}=@var{value} pairs separated
1408+
by ":". See @command{rav1e --help} for a list of options.
1409+
1410+
For example to specify librav1e encoding options with @option{-rav1e-params}:
1411+
1412+
@example
1413+
ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params speed=5:low_latency=true output.mp4
1414+
@end example
1415+
1416+
@end table
1417+
13811418
@section libaom-av1
13821419

13831420
libaom AV1 encoder wrapper.

doc/general.texi

+7
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,13 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to
253253
instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to
254254
@file{./configure}.
255255

256+
@section rav1e
257+
258+
FFmpeg can make use of rav1e (Rust AV1 Encoder) via its C bindings to encode videos.
259+
Go to @url{https://github.com/xiph/rav1e/} and follow the instructions to build
260+
the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e}
261+
to @file{./configure}.
262+
256263
@section TwoLAME
257264

258265
FFmpeg can make use of the TwoLAME library for MP2 encoding.

libavcodec/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ OBJS-$(CONFIG_LIBOPUS_DECODER) += libopusdec.o libopus.o \
989989
vorbis_data.o
990990
OBJS-$(CONFIG_LIBOPUS_ENCODER) += libopusenc.o libopus.o \
991991
vorbis_data.o
992+
OBJS-$(CONFIG_LIBRAV1E_ENCODER) += librav1e.o
992993
OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o
993994
OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o
994995
OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o

libavcodec/allcodecs.c

+1
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,7 @@ extern AVCodec ff_libopenjpeg_encoder;
703703
extern AVCodec ff_libopenjpeg_decoder;
704704
extern AVCodec ff_libopus_encoder;
705705
extern AVCodec ff_libopus_decoder;
706+
extern AVCodec ff_librav1e_encoder;
706707
extern AVCodec ff_librsvg_decoder;
707708
extern AVCodec ff_libshine_encoder;
708709
extern AVCodec ff_libspeex_encoder;

0 commit comments

Comments
 (0)