Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3310,6 +3310,11 @@ scale_npp_filter_deps="ffnvcodec libnpp"
scale2ref_npp_filter_deps="ffnvcodec libnpp"
scale_cuda_filter_deps="ffnvcodec"
scale_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
showinfo_cuda_filter_deps="ffnvcodec"
lut3d_cuda_filter_deps="ffnvcodec"
lut3d_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
tonemap_cuda_filter_deps="ffnvcodec"
tonemap_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
thumbnail_cuda_filter_deps="ffnvcodec"
thumbnail_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
transpose_npp_filter_deps="ffnvcodec libnpp"
Expand Down
7 changes: 7 additions & 0 deletions fftools/ffmpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ typedef struct OptionsContext {
SpecifierOptList hwaccel_output_formats;
SpecifierOptList autorotate;
SpecifierOptList apply_cropping;
SpecifierOptList force_cfr;

/* output options */
StreamMap *stream_maps;
Expand Down Expand Up @@ -276,6 +277,9 @@ typedef struct InputFilterOptions {
* accurate */
AVRational framerate;

/* convert input stream to CFR at this framerate before inserting additional filters */
AVRational force_cfr;

unsigned crop_top;
unsigned crop_bottom;
unsigned crop_left;
Expand Down Expand Up @@ -451,6 +455,9 @@ typedef struct InputStream {

/* framerate forced with -r */
AVRational framerate;

/* convert input stream to CFR at this framerate before inserting additional filters */
AVRational force_cfr;
#if FFMPEG_OPT_TOP
int top_field_first;
#endif
Expand Down
15 changes: 14 additions & 1 deletion fftools/ffmpeg_demux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,10 @@ int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple,
(opts->crop_top | opts->crop_bottom | opts->crop_left | opts->crop_right))
opts->flags |= IFILTER_FLAG_CROP;
}
if (ist->force_cfr.num > 0 && ist->force_cfr.den > 0) {
opts->force_cfr = ist->force_cfr;
opts->flags |= IFILTER_FLAG_CFR;
}
} else if (ist->par->codec_type == AVMEDIA_TYPE_SUBTITLE) {
/* Compute the size of the canvas for the subtitles stream.
If the subtitles codecpar has set a size, use it. Otherwise use the
Expand Down Expand Up @@ -1241,7 +1245,7 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st, AVDictiona
AVCodecParameters *par = st->codecpar;
DemuxStream *ds;
InputStream *ist;
const char *framerate = NULL, *hwaccel_device = NULL;
const char *framerate = NULL, *hwaccel_device = NULL, *forcecfr = NULL;
const char *hwaccel = NULL;
const char *apply_cropping = NULL;
const char *hwaccel_output_format = NULL;
Expand Down Expand Up @@ -1437,6 +1441,15 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st, AVDictiona
}
}

opt_match_per_stream_str(ist, &o->force_cfr, ic, st, &forcecfr);
if (forcecfr) {
ret = av_parse_video_rate(&ist->force_cfr, forcecfr);
if (ret < 0) {
av_log(ist, AV_LOG_ERROR, "Error parsing framerate %s.\n", forcecfr);
return ret;
}
}

#if FFMPEG_OPT_TOP
ist->top_field_first = -1;
opt_match_per_stream_int(ist, &o->top_field_first, ic, st, &ist->top_field_first);
Expand Down
9 changes: 9 additions & 0 deletions fftools/ffmpeg_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,15 @@ static int configure_input_video_filter(FilterGraph *fg, AVFilterGraph *graph,
ifp->displaymatrix_applied = 1;
}

if (ifp->opts.force_cfr.num > 0 && ifp->opts.force_cfr.den > 0) {
char force_cfr_buf[64];
snprintf(force_cfr_buf, sizeof(force_cfr_buf), "%d/%d",
ifp->opts.force_cfr.num, ifp->opts.force_cfr.den);
ret = insert_filter(&last_filter, &pad_idx, "fps", force_cfr_buf);
if (ret < 0)
return ret;
}

snprintf(name, sizeof(name), "trim_in_%s", ifp->opts.name);
ret = insert_trim(ifp->opts.trim_start_us, ifp->opts.trim_end_us,
&last_filter, &pad_idx, name);
Expand Down
4 changes: 4 additions & 0 deletions fftools/ffmpeg_opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2033,5 +2033,9 @@ const OptionDef options[] = {
"set video sync method globally; deprecated, use -fps_mode", "" },
#endif

{ "force_cfr", OPT_TYPE_STRING, OPT_VIDEO | OPT_EXPERT | OPT_PERSTREAM | OPT_INPUT,
{ .off = OFFSET(force_cfr) },
"set frame rate (Hz value, fraction or abbreviation)", "force_cfr" },

{ NULL, },
};
2 changes: 1 addition & 1 deletion libavcodec/libsvtav1.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ static av_cold int eb_enc_init(AVCodecContext *avctx)

svt_enc->eos_flag = EOS_NOT_REACHED;

svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, svt_enc, &svt_enc->enc_params);
svt_ret = svt_av1_enc_init_handle(&svt_enc->svt_handle, &svt_enc->enc_params);
if (svt_ret != EB_ErrorNone) {
return svt_print_error(avctx, svt_ret, "Error initializing encoder handle");
}
Expand Down
10 changes: 9 additions & 1 deletion libavfilter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ OBJS-$(CONFIG_SCENE_SAD) += scene_sad.o
OBJS-$(CONFIG_DNN) += dnn_filter_common.o
include $(SRC_PATH)/libavfilter/dnn/Makefile


# audio filters
OBJS-$(CONFIG_AAP_FILTER) += af_aap.o
OBJS-$(CONFIG_ABENCH_FILTER) += f_bench.o
Expand Down Expand Up @@ -245,7 +246,8 @@ OBJS-$(CONFIG_COLORMATRIX_FILTER) += vf_colormatrix.o
OBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o colorspacedsp.o
OBJS-$(CONFIG_COLORSPACE_CUDA_FILTER) += vf_colorspace_cuda.o \
vf_colorspace_cuda.ptx.o \
cuda/load_helper.o
cuda/load_helper.o \
cuda/cuda_async_queue.o
OBJS-$(CONFIG_COLORTEMPERATURE_FILTER) += vf_colortemperature.o
OBJS-$(CONFIG_CONVOLUTION_FILTER) += vf_convolution.o
OBJS-$(CONFIG_CONVOLUTION_OPENCL_FILTER) += vf_convolution_opencl.o opencl.o \
Expand Down Expand Up @@ -375,6 +377,8 @@ OBJS-$(CONFIG_LUT1D_FILTER) += vf_lut3d.o
OBJS-$(CONFIG_LUT_FILTER) += vf_lut.o
OBJS-$(CONFIG_LUT2_FILTER) += vf_lut2.o framesync.o
OBJS-$(CONFIG_LUT3D_FILTER) += vf_lut3d.o framesync.o
OBJS-$(CONFIG_LUT3D_CUDA_FILTER) += vf_lut3d_cuda.o \
vf_lut3d_cuda.ptx.o cuda/load_helper.o
OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o
OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o
OBJS-$(CONFIG_MASKEDCLAMP_FILTER) += vf_maskedclamp.o framesync.o
Expand Down Expand Up @@ -486,6 +490,7 @@ OBJS-$(CONFIG_SHARPEN_NPP_FILTER) += vf_sharpen_npp.o
OBJS-$(CONFIG_SHARPNESS_VAAPI_FILTER) += vf_misc_vaapi.o vaapi_vpp.o
OBJS-$(CONFIG_SHEAR_FILTER) += vf_shear.o
OBJS-$(CONFIG_SHOWINFO_FILTER) += vf_showinfo.o
OBJS-$(CONFIG_SHOWINFO_CUDA_FILTER) += vf_showinfo_cuda.o
OBJS-$(CONFIG_SHOWPALETTE_FILTER) += vf_showpalette.o
OBJS-$(CONFIG_SHUFFLEFRAMES_FILTER) += vf_shuffleframes.o
OBJS-$(CONFIG_SHUFFLEPIXELS_FILTER) += vf_shufflepixels.o
Expand Down Expand Up @@ -524,6 +529,9 @@ OBJS-$(CONFIG_TMEDIAN_FILTER) += vf_xmedian.o framesync.o
OBJS-$(CONFIG_TMIDEQUALIZER_FILTER) += vf_tmidequalizer.o
OBJS-$(CONFIG_TMIX_FILTER) += vf_mix.o framesync.o
OBJS-$(CONFIG_TONEMAP_FILTER) += vf_tonemap.o
OBJS-$(CONFIG_TONEMAP_CUDA_FILTER) += vf_tonemap_cuda.o \
vf_tonemap_cuda.ptx.o cuda/load_helper.o \
cuda/cuda_async_queue.o
OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o opencl.o \
opencl/tonemap.o opencl/colorspace_common.o
OBJS-$(CONFIG_TONEMAP_VAAPI_FILTER) += vf_tonemap_vaapi.o vaapi_vpp.o
Expand Down
3 changes: 3 additions & 0 deletions libavfilter/allfilters.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ extern const AVFilter ff_vf_lut;
extern const AVFilter ff_vf_lut1d;
extern const AVFilter ff_vf_lut2;
extern const AVFilter ff_vf_lut3d;
extern const AVFilter ff_vf_lut3d_cuda;
extern const AVFilter ff_vf_lutrgb;
extern const AVFilter ff_vf_lutyuv;
extern const AVFilter ff_vf_maskedclamp;
Expand Down Expand Up @@ -458,6 +459,7 @@ extern const AVFilter ff_vf_sharpen_npp;
extern const AVFilter ff_vf_sharpness_vaapi;
extern const AVFilter ff_vf_shear;
extern const AVFilter ff_vf_showinfo;
extern const AVFilter ff_vf_showinfo_cuda;
extern const AVFilter ff_vf_showpalette;
extern const AVFilter ff_vf_shuffleframes;
extern const AVFilter ff_vf_shufflepixels;
Expand Down Expand Up @@ -494,6 +496,7 @@ extern const AVFilter ff_vf_tmedian;
extern const AVFilter ff_vf_tmidequalizer;
extern const AVFilter ff_vf_tmix;
extern const AVFilter ff_vf_tonemap;
extern const AVFilter ff_vf_tonemap_cuda;
extern const AVFilter ff_vf_tonemap_opencl;
extern const AVFilter ff_vf_tonemap_vaapi;
extern const AVFilter ff_vf_tpad;
Expand Down
Loading