Apparently this option was intended (the context contains a currently-unused frame_rate field), but was never added. This results in the output timebase being unset after config_output(), so the input audio timebase ends up being used for video output, which is clearly wrong. Add an option for setting output video framerate. Also set output frame durations.
Showing the changes to libavfilter (2 of 3 files). Show all
Unified · Split
| @@ -62,6 +62,8 @@ static const AVOption showspatial_options[] = { · 61 unmodified lines | ||
| 62 | 62 | { "win_size", "set window size", OFFSET(win_size), AV_OPT_TYPE_INT, {.i64 = 4096}, 1024, 65536, FLAGS }, |
| 63 | 63 | WIN_FUNC_OPTION("win_func", OFFSET(win_func), FLAGS, WFUNC_HANNING), |
| 64 | 64 | { "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS }, |
| 65 | + { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS }, | |
| 66 | + { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS }, | |
| 65 | 67 | { NULL } |
| 66 | 68 | }; |
| 67 | 69 | |
| @@ -187,6 +189,7 @@ static int config_output(AVFilterLink *outlink) · 119 unmodified lines | ||
| 187 | 189 | } |
| 188 | 190 | } |
| 189 | 191 | |
| 192 | + outlink->frame_rate = s->frame_rate; | |
| 190 | 193 | outlink->time_base = av_inv_q(outlink->frame_rate); |
| 191 | 194 | |
| 192 | 195 | av_audio_fifo_free(s->fifo); |
| @@ -253,6 +256,7 @@ static int draw_spatial(AVFilterLink *inlink, AVFrame *insamples) · 60 unmodified lines | ||
| 253 | 256 | } |
| 254 | 257 | |
| 255 | 258 | outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base); |
| 259 | + outpicref->duration = 1; | |
| 256 | 260 | |
| 257 | 261 | return ff_filter_frame(outlink, outpicref); |
| 258 | 262 | } |
| @@ -32,7 +32,7 @@ · 31 unmodified lines | ||
| 32 | 32 | #include "version_major.h" |
| 33 | 33 | |
| 34 | 34 | #define LIBAVFILTER_VERSION_MINOR 49 |
| 35 | −#define LIBAVFILTER_VERSION_MICRO 100 | |
| 35 | +#define LIBAVFILTER_VERSION_MICRO 101 | |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |