This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/blenkernel/BKE_writeffmpeg.h
Stephen Seo 59a0b49c10 Video rendering: FFMpeg AV1 codec encoding support
Previously, the Blender video renderer did not have support for
encoding video to AV1 (not to be confused with the container AVI).
The proposed solution is to leverage the existing FFMpeg renderer
to encode to AV1.

Note that avcodec_find_encoder(AV_CODEC_ID_AV1) usually returns
"libaom-av1" which is the "reference implementation" for AV1 encoding
(the default for FFMpeg, and is slow). "libsvtav1" is faster and
preferred so there is extra handling when fetching the AV1 codec for
encoding such that "libsvtav1" is used when possible.

This commit should only affect the options available for video
rendering, which includes the additional AV1 codec to choose from, and
setting "-crf".

Also note that the current release of FFMpeg for ArchLinux does not
support "-crf" for "libsvtav1", but the equivalent option "-qp" is
supported and used as a fallback when "libsvtav1" is used (as
mentioned here: https://trac.ffmpeg.org/wiki/Encode/AV1#SVT-AV1 ).
(Actually, both "-crf" and "-qp" is specified with the same value in
the code. When a release of FFMpeg obtains support for "-crf" for
"libsvtav1" is released, the code shouldn't be needed to change.)

The usage of the AV1 codec should be very similar to the usage of the
H264 codec, but is limited to the "mp4" and "mkv" containers.

This patch pertains to the "VFX & Video" module, as its main purpose
is to supplement the Video Sequencer tool with the additional AV1
codec for encoded video output.

Differential Revision: https://developer.blender.org/D14920

Reviewed By: sergey , ISS, zeddb
2022-10-21 20:10:17 -06:00

84 lines
2.0 KiB
C++

/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2001-2002 NaN Holding BV. All rights reserved. */
#pragma once
/** \file
* \ingroup bke
*/
#ifdef WITH_FFMPEG
# ifdef __cplusplus
extern "C" {
# endif
enum {
FFMPEG_MPEG1 = 0,
FFMPEG_MPEG2 = 1,
FFMPEG_MPEG4 = 2,
FFMPEG_AVI = 3,
FFMPEG_MOV = 4,
FFMPEG_DV = 5,
FFMPEG_H264 = 6,
FFMPEG_XVID = 7,
FFMPEG_FLV = 8,
FFMPEG_MKV = 9,
FFMPEG_OGG = 10,
FFMPEG_INVALID = 11,
FFMPEG_WEBM = 12,
FFMPEG_AV1 = 13,
};
enum {
FFMPEG_PRESET_NONE = 0,
FFMPEG_PRESET_DVD = 1,
FFMPEG_PRESET_SVCD = 2,
FFMPEG_PRESET_VCD = 3,
FFMPEG_PRESET_DV = 4,
FFMPEG_PRESET_H264 = 5,
FFMPEG_PRESET_THEORA = 6,
FFMPEG_PRESET_XVID = 7,
FFMPEG_PRESET_AV1 = 8,
};
struct RenderData;
struct ReportList;
struct Scene;
int BKE_ffmpeg_start(void *context_v,
const struct Scene *scene,
struct RenderData *rd,
int rectx,
int recty,
struct ReportList *reports,
bool preview,
const char *suffix);
void BKE_ffmpeg_end(void *context_v);
int BKE_ffmpeg_append(void *context_v,
struct RenderData *rd,
int start_frame,
int frame,
int *pixels,
int rectx,
int recty,
const char *suffix,
struct ReportList *reports);
void BKE_ffmpeg_filepath_get(char *string,
const struct RenderData *rd,
bool preview,
const char *suffix);
void BKE_ffmpeg_preset_set(struct RenderData *rd, int preset);
void BKE_ffmpeg_image_type_verify(struct RenderData *rd, const struct ImageFormatData *imf);
bool BKE_ffmpeg_alpha_channel_is_supported(const struct RenderData *rd);
void *BKE_ffmpeg_context_create(void);
void BKE_ffmpeg_context_free(void *context_v);
# ifdef __cplusplus
}
# endif
#endif