Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 15/07/2019 15:53, James Almer wrote: >>> AV_BASE64_DECODE_SIZE(strlen(avctx->stats_in)); >> >> I copied this directly from libtheoraenc.c which has had this for more than >> 10 >> years... is it wrong? Should it be changed too? > > It's not wrong, that helper macro was added three years ago and it > expands to the same code, except promoting the intermediary result to > int64_t to prevent overflow. > And i think it should ideally be changed in libtheora/libvpx as well, yes. OK. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 7/15/2019 11:23 AM, Derek Buitenhuis wrote: > On 13/07/2019 19:37, James Almer wrote: >> Just use av_reallocp(). Each call will make the buffer bigger, so you're >> not really making use the no-op benefits from av_fast_realloc(), which >> only trigger if newsize <= size. > > I'll wait for your reply to Nicholas and do whichevr people agree on. Leave it as av_fast_realloc(). My suggestion was only a NIT. > >>> +ctx->pass_size = (strlen(avctx->stats_in) * 3) / 4; >> >> AV_BASE64_DECODE_SIZE(strlen(avctx->stats_in)); > > I copied this directly from libtheoraenc.c which has had this for more than 10 > years... is it wrong? Should it be changed too? It's not wrong, that helper macro was added three years ago and it expands to the same code, except promoting the intermediary result to int64_t to prevent overflow. And i think it should ideally be changed in libtheora/libvpx as well, yes. > > - Derek > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 13/07/2019 19:37, James Almer wrote: > Just use av_reallocp(). Each call will make the buffer bigger, so you're > not really making use the no-op benefits from av_fast_realloc(), which > only trigger if newsize <= size. I'll wait for your reply to Nicholas and do whichevr people agree on. >> +ctx->pass_size = (strlen(avctx->stats_in) * 3) / 4; > > AV_BASE64_DECODE_SIZE(strlen(avctx->stats_in)); I copied this directly from libtheoraenc.c which has had this for more than 10 years... is it wrong? Should it be changed too? - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
James Almer (12019-07-13): > > +uint8_t *tmp = av_fast_realloc(ctx->pass_data, &ctx->pass_size, > > + ctx->pass_pos + buf_size); > Just use av_reallocp(). Each call will make the buffer bigger, so you're > not really making use the no-op benefits from av_fast_realloc(), which > only trigger if newsize <= size. av_fast_realloc() also allocates 17/16 of the requested memory, which makes the incremental building of a buffer linear instead of quadratic. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 7/9/2019 3:34 PM, Derek Buitenhuis wrote: > Port to the new send/receive API by: James Almer . > > Signed-off-by: Derek Buitenhuis > --- > Lots of stuff happened since v3! > > * The C API / library is now in rav1e's main repo, and officially supported. > * rav1e will bump the soname and pkg-config version on any breaking changes. > * C API is now as fast as the Rust API. > * Added two pass support. > * Added min quantizer support. > * Added tiles / speed to AVOptions. > * Mapped min/max keyint. > * Applied all the fixes requested in the last round. > --- > configure | 4 + > doc/encoders.texi | 37 +++ > doc/general.texi | 7 + > libavcodec/Makefile| 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/librav1e.c | 578 + > 6 files changed, 628 insertions(+) > create mode 100644 libavcodec/librav1e.c > +static int get_stats(AVCodecContext *avctx, int eos) > +{ > +librav1eContext *ctx = avctx->priv_data; > +uint8_t *buf; > +size_t buf_size = 0; > + > +buf = rav1e_twopass_out(ctx->ctx, &buf_size); > +if (!buf) > +return 0; > + > +if (!eos) { > +uint8_t *tmp = av_fast_realloc(ctx->pass_data, &ctx->pass_size, > + ctx->pass_pos + buf_size); Just use av_reallocp(). Each call will make the buffer bigger, so you're not really making use the no-op benefits from av_fast_realloc(), which only trigger if newsize <= size. > +static av_cold int librav1e_encode_init(AVCodecContext *avctx) > +{ > +librav1eContext *ctx = avctx->priv_data; > +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); > +RaConfig *cfg = NULL; > +int rret; > +int ret = 0; > + > +cfg = rav1e_config_default(); > +if (!cfg) { > +av_log(avctx, AV_LOG_ERROR, "Could not allocate rav1e config.\n"); > +return AVERROR_EXTERNAL; > +} > + > +rav1e_config_set_time_base(cfg, (RaRational) { > + avctx->time_base.num * avctx->ticks_per_frame, > + avctx->time_base.den > + }); > + > +if (avctx->flags & AV_CODEC_FLAG_PASS2) { > +if (!avctx->stats_in) { > +av_log(avctx, AV_LOG_ERROR, "No stats file provided for second > pass.\n"); > +ret = AVERROR(EINVAL); > +goto end; > +} > + > +ctx->pass_size = (strlen(avctx->stats_in) * 3) / 4; AV_BASE64_DECODE_SIZE(strlen(avctx->stats_in)); ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 10/07/2019 13:56, James Almer wrote: >> Heavily disagree. rav1e has its own 'tiles' option that determines the right >> cols/rows to use for a reason, and I will not be emulating libaomenc's algo >> instead of using the one provided by rav1e. It's confusing at best (since >> it goes against the rav1e API, and makes the official CLI and ffmpeg work >> differently). > > It's not libaom code, it's Mark Thompson's code. It derives > tile_rows_log2 and tile_cols_log2 values, which are what libaom expects, > from a Cols X Rows string (image size AVOption type), so you can tell > the encoder if you want a sample with exactly 4x2 tiles or such. That should be handled by the tile-columns and tile-rows options below, I think. > > But if you prefer the tiles option to match the behavior or rav1e's CLI, > then I'm fine with it. I do prefer this. >> Why? What's the use-case? "Being the same as libaomenc" is not a good use >> case. > > Command line option consistency between encoders is a good reason. It's > why you're using "qp" instead of "quantizer" or whatever, after all. > Rav1e lets you set cols and rows in log2 values much like libaom, right? > Then why not add options that map directly to them? Even if you don't > use Mark's code to convert Cols x Rows strings, both a tiles and > tile-cols/rows options can coexist, with the latter two taking > precedence over the former, since they give the user more control over > tiling. That's fair enough, having users set log2 values is crappy. I'll add these. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 7/10/2019 9:22 AM, Derek Buitenhuis wrote: > On 09/07/2019 22:06, James Almer wrote: >>> @@ -3174,6 +3176,7 @@ libopenmpt_demuxer_deps="libopenmpt" >>> libopus_decoder_deps="libopus" >>> libopus_encoder_deps="libopus" >>> libopus_encoder_select="audio_frame_queue" >>> +librav1e_encoder_deps="librav1e" >> >> Needs to enable extract_extradata_bsf with a _select line as well. > > Fixed locally. > >>> +if (ctx->tiles >= 0) { >>> +rret = rav1e_config_parse_int(cfg, "tiles", ctx->speed); >> >> ctx->tiles > > Fixed locally. > >> >> Also, it may be a good idea to instead look into making the "tiles" >> option parsing code in libaomenc shared and reuse it here, so it's >> consistent between encoders. With it you can pass a Cols x Rows string >> using the AV_OPT_TYPE_IMAGE_SIZE AVOption type and derive values you can >> then map to rav1e's tile_rows_log2 and tile_cols_log2 options. > > Heavily disagree. rav1e has its own 'tiles' option that determines the right > cols/rows to use for a reason, and I will not be emulating libaomenc's algo > instead of using the one provided by rav1e. It's confusing at best (since > it goes against the rav1e API, and makes the official CLI and ffmpeg work > differently). It's not libaom code, it's Mark Thompson's code. It derives tile_rows_log2 and tile_cols_log2 values, which are what libaom expects, from a Cols X Rows string (image size AVOption type), so you can tell the encoder if you want a sample with exactly 4x2 tiles or such. But if you prefer the tiles option to match the behavior or rav1e's CLI, then I'm fine with it. > >> In the meantime, you can define tile-columns and tile-rows AVOptions and >> directly map them to the aforementioned rav1e options. > > Why? What's the use-case? "Being the same as libaomenc" is not a good use > case. Command line option consistency between encoders is a good reason. It's why you're using "qp" instead of "quantizer" or whatever, after all. Rav1e lets you set cols and rows in log2 values much like libaom, right? Then why not add options that map directly to them? Even if you don't use Mark's code to convert Cols x Rows strings, both a tiles and tile-cols/rows options can coexist, with the latter two taking precedence over the former, since they give the user more control over tiling. > >>> +case RA_ENCODER_STATUS_ENCODED: >>> +if (avctx->internal->draining) >>> +goto retry; >>> +return AVERROR(EAGAIN); >> >> Is rav1e_send_frame() guaranteed to not return >> RA_ENCODER_STATUS_ENOUGH_DATA if called right after >> rav1e_receive_packet() returned RA_ENCODER_STATUS_ENCODED? >> In other words, if it encoded a frame but didn't return it, is it safe >> to assume its buffers are not full and will not reject new data passed >> to it? > > rav1e, in fact, never returns this error. I need to check what the > guarantee is, though - I'm not sure what the future plans are. Ok, should be good then. > >> If not, then we would have to do goto retry here unconditionally, >> draining or not. The doxy for avcodec_receive_packet and >> avcodec_send_frame state that when one returns EAGAIN, the other is >> guaranteed to return something else. > > [...] > > - Derek > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 09/07/2019 21:23, Moritz Barsnick wrote: >> +Sets the minimum quantizer (ceiling) to use when in bitrate mdoe. > > Typo -> "mode" Fixed locally. > >> +av_log(avctx, AV_LOG_ERROR, "Unknown return code from >> rav1e_send_frame.\n"); >> +return AVERROR_UNKNOWN; > > Feel free to include the error code in the message, as you did in > librav1e_receive_packet(). OK. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 09/07/2019 22:06, James Almer wrote: >> @@ -3174,6 +3176,7 @@ libopenmpt_demuxer_deps="libopenmpt" >> libopus_decoder_deps="libopus" >> libopus_encoder_deps="libopus" >> libopus_encoder_select="audio_frame_queue" >> +librav1e_encoder_deps="librav1e" > > Needs to enable extract_extradata_bsf with a _select line as well. Fixed locally. >> +if (ctx->tiles >= 0) { >> +rret = rav1e_config_parse_int(cfg, "tiles", ctx->speed); > > ctx->tiles Fixed locally. > > Also, it may be a good idea to instead look into making the "tiles" > option parsing code in libaomenc shared and reuse it here, so it's > consistent between encoders. With it you can pass a Cols x Rows string > using the AV_OPT_TYPE_IMAGE_SIZE AVOption type and derive values you can > then map to rav1e's tile_rows_log2 and tile_cols_log2 options. Heavily disagree. rav1e has its own 'tiles' option that determines the right cols/rows to use for a reason, and I will not be emulating libaomenc's algo instead of using the one provided by rav1e. It's confusing at best (since it goes against the rav1e API, and makes the official CLI and ffmpeg work differently). > In the meantime, you can define tile-columns and tile-rows AVOptions and > directly map them to the aforementioned rav1e options. Why? What's the use-case? "Being the same as libaomenc" is not a good use case. >> +case RA_ENCODER_STATUS_ENCODED: >> +if (avctx->internal->draining) >> +goto retry; >> +return AVERROR(EAGAIN); > > Is rav1e_send_frame() guaranteed to not return > RA_ENCODER_STATUS_ENOUGH_DATA if called right after > rav1e_receive_packet() returned RA_ENCODER_STATUS_ENCODED? > In other words, if it encoded a frame but didn't return it, is it safe > to assume its buffers are not full and will not reject new data passed > to it? rav1e, in fact, never returns this error. I need to check what the guarantee is, though - I'm not sure what the future plans are. > If not, then we would have to do goto retry here unconditionally, > draining or not. The doxy for avcodec_receive_packet and > avcodec_send_frame state that when one returns EAGAIN, the other is > guaranteed to return something else. [...] - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 7/9/2019 3:34 PM, Derek Buitenhuis wrote: > Port to the new send/receive API by: James Almer . > > Signed-off-by: Derek Buitenhuis > --- > Lots of stuff happened since v3! > > * The C API / library is now in rav1e's main repo, and officially supported. > * rav1e will bump the soname and pkg-config version on any breaking changes. > * C API is now as fast as the Rust API. > * Added two pass support. > * Added min quantizer support. > * Added tiles / speed to AVOptions. > * Mapped min/max keyint. > * Applied all the fixes requested in the last round. > --- > configure | 4 + > doc/encoders.texi | 37 +++ > doc/general.texi | 7 + > libavcodec/Makefile| 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/librav1e.c | 578 + > 6 files changed, 628 insertions(+) > create mode 100644 libavcodec/librav1e.c > > diff --git a/configure b/configure > index 4005987409..7e93812824 100755 > --- a/configure > +++ b/configure > @@ -254,6 +254,7 @@ External library support: >--enable-libopenmpt enable decoding tracked files via libopenmpt [no] >--enable-libopus enable Opus de/encoding via libopus [no] >--enable-libpulseenable Pulseaudio input via libpulse [no] > + --enable-librav1eenable AV1 encoding via rav1e [no] >--enable-librsvg enable SVG rasterization via librsvg [no] >--enable-librubberband enable rubberband needed for rubberband filter > [no] >--enable-librtmp enable RTMP[E] support via librtmp [no] > @@ -1778,6 +1779,7 @@ EXTERNAL_LIBRARY_LIST=" > libopenmpt > libopus > libpulse > +librav1e > librsvg > librtmp > libshine > @@ -3174,6 +3176,7 @@ libopenmpt_demuxer_deps="libopenmpt" > libopus_decoder_deps="libopus" > libopus_encoder_deps="libopus" > libopus_encoder_select="audio_frame_queue" > +librav1e_encoder_deps="librav1e" Needs to enable extract_extradata_bsf with a _select line as well. > librsvg_decoder_deps="librsvg" > libshine_encoder_deps="libshine" > libshine_encoder_select="audio_frame_queue" > @@ -6215,6 +6218,7 @@ enabled libopus && { > } > } > enabled libpulse && require_pkg_config libpulse libpulse > pulse/pulseaudio.h pa_context_new > +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" > rav1e.h rav1e_context_new > enabled librsvg && require_pkg_config librsvg librsvg-2.0 > librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo > enabled librtmp && require_pkg_config librtmp librtmp > librtmp/rtmp.h RTMP_Socket > enabled librubberband && require_pkg_config librubberband "rubberband >= > 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append > librubberband_extralibs "-lstdc++" > diff --git a/doc/encoders.texi b/doc/encoders.texi > index eefd124751..f316725409 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -1378,6 +1378,43 @@ makes it possible to store non-rgb pix_fmts. > > @end table > > +@section librav1e > + > +rav1e AV1 encoder wrapper. > + > +Requires the presence of the rav1e headers and library during configuration. > +You need to explicitly configure the build with @code{--enable-librav1e}. > + > +@subsection Options > + > +@table @option > +@item qmax > +Sets the maximum quantizer (floor) to use when using bitrate mode. > + > +@item qmin > +Sets the minimum quantizer (ceiling) to use when in bitrate mdoe. > + > +@item qp > +Uses quantizer mode to encode at the given quantizer. > + > +@item speed > +Selects the speed preset (0-9) to encode with. > + > +@item tiles > +Selects how many tiles to encode with. > + > +@item rav1e-params > +Set rav1e options using a list of @var{key}=@var{value} pairs separated > +by ":". See @command{rav1e --help} for a list of options. > + > +For example to specify librav1e encoding options with @option{-rav1e-params}: > + > +@example > +ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params > speed=5:low_latency=true output.mp4 > +@end example > + > +@end table > + > @section libaom-av1 > > libaom AV1 encoder wrapper. > diff --git a/doc/general.texi b/doc/general.texi > index 3c0c803449..72a6d73f33 100644 > --- a/doc/general.texi > +++ b/doc/general.texi > @@ -243,6 +243,13 @@ FFmpeg can use the OpenJPEG libraries for > decoding/encoding J2K videos. Go to > instructions. To enable using OpenJPEG in FFmpeg, pass > @code{--enable-libopenjpeg} to > @file{./configure}. > > +@section rav1e > + > +FFmpeg can make use of rav1e (Rust AV1 Encoder) via its C bindings to encode > videos. > +Go to @url{https://github.com/lu-zero/crav1e/} and follow the instructions > to build > +the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e} > +to @file{./configure}. > + > @section TwoLAME > > FFmpeg can make use of the TwoLAME library for MP2 encoding. > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 3cd73fbcc6..cebc9d2
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
Hi, On Tue, Jul 09, 2019 at 19:34:33 +0100, Derek Buitenhuis wrote: > Port to the new send/receive API by: James Almer . Two nits: > +Sets the minimum quantizer (ceiling) to use when in bitrate mdoe. Typo -> "mode" > +av_log(avctx, AV_LOG_ERROR, "Unknown return code from > rav1e_send_frame.\n"); > +return AVERROR_UNKNOWN; Feel free to include the error code in the message, as you did in librav1e_receive_packet(). Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 09/07/2019 19:34, Derek Buitenhuis wrote: > * Added two pass support. As a side note, I really dislike the stats_out/stats_in API, since it requires the whole stats be held in memory. This my become problematic when rav1e adds temporal RDO (think mbtree) and the stats files grow a lot. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
On 09/07/2019 19:34, Derek Buitenhuis wrote: > +Go to @url{https://github.com/lu-zero/crav1e/} and follow the instructions > to build > +the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e} > +to @file{./configure}. Eugh. This is supposed to point to https://github.com/xiph/rav1e/. Woops. Amended locally. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCHv4] avcodec: Add librav1e encoder
Port to the new send/receive API by: James Almer . Signed-off-by: Derek Buitenhuis --- Lots of stuff happened since v3! * The C API / library is now in rav1e's main repo, and officially supported. * rav1e will bump the soname and pkg-config version on any breaking changes. * C API is now as fast as the Rust API. * Added two pass support. * Added min quantizer support. * Added tiles / speed to AVOptions. * Mapped min/max keyint. * Applied all the fixes requested in the last round. --- configure | 4 + doc/encoders.texi | 37 +++ doc/general.texi | 7 + libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/librav1e.c | 578 + 6 files changed, 628 insertions(+) create mode 100644 libavcodec/librav1e.c diff --git a/configure b/configure index 4005987409..7e93812824 100755 --- a/configure +++ b/configure @@ -254,6 +254,7 @@ External library support: --enable-libopenmpt enable decoding tracked files via libopenmpt [no] --enable-libopus enable Opus de/encoding via libopus [no] --enable-libpulseenable Pulseaudio input via libpulse [no] + --enable-librav1eenable AV1 encoding via rav1e [no] --enable-librsvg enable SVG rasterization via librsvg [no] --enable-librubberband enable rubberband needed for rubberband filter [no] --enable-librtmp enable RTMP[E] support via librtmp [no] @@ -1778,6 +1779,7 @@ EXTERNAL_LIBRARY_LIST=" libopenmpt libopus libpulse +librav1e librsvg librtmp libshine @@ -3174,6 +3176,7 @@ libopenmpt_demuxer_deps="libopenmpt" libopus_decoder_deps="libopus" libopus_encoder_deps="libopus" libopus_encoder_select="audio_frame_queue" +librav1e_encoder_deps="librav1e" librsvg_decoder_deps="librsvg" libshine_encoder_deps="libshine" libshine_encoder_select="audio_frame_queue" @@ -6215,6 +6218,7 @@ enabled libopus && { } } enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++" diff --git a/doc/encoders.texi b/doc/encoders.texi index eefd124751..f316725409 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1378,6 +1378,43 @@ makes it possible to store non-rgb pix_fmts. @end table +@section librav1e + +rav1e AV1 encoder wrapper. + +Requires the presence of the rav1e headers and library during configuration. +You need to explicitly configure the build with @code{--enable-librav1e}. + +@subsection Options + +@table @option +@item qmax +Sets the maximum quantizer (floor) to use when using bitrate mode. + +@item qmin +Sets the minimum quantizer (ceiling) to use when in bitrate mdoe. + +@item qp +Uses quantizer mode to encode at the given quantizer. + +@item speed +Selects the speed preset (0-9) to encode with. + +@item tiles +Selects how many tiles to encode with. + +@item rav1e-params +Set rav1e options using a list of @var{key}=@var{value} pairs separated +by ":". See @command{rav1e --help} for a list of options. + +For example to specify librav1e encoding options with @option{-rav1e-params}: + +@example +ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params speed=5:low_latency=true output.mp4 +@end example + +@end table + @section libaom-av1 libaom AV1 encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index 3c0c803449..72a6d73f33 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -243,6 +243,13 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section rav1e + +FFmpeg can make use of rav1e (Rust AV1 Encoder) via its C bindings to encode videos. +Go to @url{https://github.com/lu-zero/crav1e/} and follow the instructions to build +the C library. To enable using rav1e in FFmpeg, pass @code{--enable-librav1e} +to @file{./configure}. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3cd73fbcc6..cebc9d2ebc 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -988,6 +988,7 @@ OBJS-$(CONFIG_LIBOPUS_DECODER)+= libopusdec.o libopus.o \ vorbis_data.o OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ vorbis_data.o +OBJS-$(CONFIG_LIBRAV1E_ENCODER)