Skip to content
Merged
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
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3581,6 +3581,7 @@ interlace_filter_deps="gpl"
kerndeint_filter_deps="gpl"
ladspa_filter_deps="ladspa libdl"
lensfun_filter_deps="liblensfun version3"
livepeer_dnn_filter_select="dnn"
lv2_filter_deps="lv2"
mcdeint_filter_deps="avcodec gpl"
movie_filter_deps="avcodec avformat"
Expand Down
67 changes: 67 additions & 0 deletions doc/filters.texi
Original file line number Diff line number Diff line change
Expand Up @@ -14362,6 +14362,73 @@ lut2='if(lt(x,y),0,if(gt(x,y),pow(2,bdx)-1,pow(2,bdx-1))):if(lt(x,y),0,if(gt(x,y
@end example
@end itemize

@section livepeer_dnn


Apply convolutional neural network based methods on the input video to classify
the overall scene, for example classifying input frames as Soccer or Adult content.
Supported models: TensorFlow model files(.pb)

The filter accepts the following options:

@table @option
@item dnn_backend
Specify which DNN backend to use for model loading and execution. This option accepts
the following values:

@table @samp
@item native
Native implementation of DNN loading and execution. Native implementation is under testing, so tensorflow backend is recommended.

@item tensorflow
TensorFlow backend. To enable this backend you
need to install the TensorFlow for C library (see
@url{https://www.tensorflow.org/install/install_c}) and configure FFmpeg with
@code{--enable-libtensorflow}
@end table

Default value is @samp{tensorflow}.

@item backend_configs
Set the configuration passed to the DNN backend. Useful to specify GPU ID for tensorflow backend.

@item model
Set path to model file specifying network architecture and its parameters.
Note that different backends use different file formats. TensorFlow can load files for only its format.

@item input
Set the input name of the dnn network.

@item output
Set the output name of the dnn network.

@item logfile
Set the output log file path for save inference results.

@end table

@itemize
@item
Software transcoding for every 10th frame:
@example
ffmpeg -i input.mp4 -vf select='not(mod(n\,10))',livepeer_dnn=model=tasmodel.pb:input=input_1:output=reshape_3/Reshape:logfile=outlog.txt out.mp4
@end example

@item
Hardware transcoding for every 10th frame:
@example
ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -vf select='not(mod(n\,10))',hwdownload,format=pix_fmts=nv12,livepeer_dnn=model=tasmodel.pb:input=input_1:output=reshape_3/Reshape:logfile=outlog.txt -c:v h264_nvenc out.mp4
@end example

@item
ffprobe example:
@example
ffprobe -show_entries frame_tags=lavfi.lvpdnn.text -f lavfi -i "movie=input.mp4,livepeer_dnn=model=tasmodel.pb:input=input_1:output=reshape_3/Reshape"
@end example

@end itemize


@section maskedclamp

Clamp the first input stream with the second input and third input stream.
Expand Down
1 change: 1 addition & 0 deletions libavfilter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ OBJS-$(CONFIG_LENSCORRECTION_FILTER) += vf_lenscorrection.o
OBJS-$(CONFIG_LENSFUN_FILTER) += vf_lensfun.o
OBJS-$(CONFIG_LIBVMAF_FILTER) += vf_libvmaf.o framesync.o
OBJS-$(CONFIG_LIMITER_FILTER) += vf_limiter.o
OBJS-$(CONFIG_LIVEPEER_DNN_FILTER) += vf_livepeer_dnn.o
OBJS-$(CONFIG_LOOP_FILTER) += f_loop.o
OBJS-$(CONFIG_LUMAKEY_FILTER) += vf_lumakey.o
OBJS-$(CONFIG_LUT1D_FILTER) += vf_lut3d.o
Expand Down
1 change: 1 addition & 0 deletions libavfilter/allfilters.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ extern AVFilter ff_vf_lenscorrection;
extern AVFilter ff_vf_lensfun;
extern AVFilter ff_vf_libvmaf;
extern AVFilter ff_vf_limiter;
extern AVFilter ff_vf_livepeer_dnn;
extern AVFilter ff_vf_loop;
extern AVFilter ff_vf_lumakey;
extern AVFilter ff_vf_lut;
Expand Down
2 changes: 1 addition & 1 deletion libavfilter/dnn/dnn_backend_tf.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static DNNReturnType get_input_tf(void *model, DNNData *input, const char *input
TF_DeleteStatus(status);

// currently only NHWC is supported
av_assert0(dims[0] == 1);
av_assert0(dims[0] == 1 || dims[0] == -1);
Comment thread
jailuthra marked this conversation as resolved.
input->height = dims[1];
input->width = dims[2];
input->channels = dims[3];
Expand Down
Loading