summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-19 18:50:10 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-19 19:23:38 +0200
commit9d30a96aa14477afc06c8d2a29ba292c7187624e (patch)
treee114decb368e8a57d89cffba78a5853f2f662245 /ffmpeg.c
parent21d8a80e30e9e2050dbc2335670028331d6dff95 (diff)
ffmpeg: inject a aresample filter for -async
Based on similar code from anton Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index cb0ac1a512..860dad7ea4 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -867,6 +867,29 @@ static int configure_audio_filters(FilterGraph *fg, AVFilterContext **in_filter,
*out_filter = format;
}
+ if (audio_sync_method > 0) {
+ AVFilterContext *aswr;
+ char args[256] = {0};
+
+ av_strlcatf(args, sizeof(args), "min_comp=0.001:min_hard_comp=%f", audio_drift_threshold);
+
+ if (audio_sync_method > 1)
+ av_strlcatf(args, sizeof(args), ":max_soft_comp=%f", audio_sync_method/(double)icodec->sample_rate);
+
+ av_log(NULL, AV_LOG_INFO, "-async %d is forwarded to lavfi similarly to -af aresample=%s\n", audio_sync_method, args);
+
+ ret = avfilter_graph_create_filter(&aswr, avfilter_get_by_name("aresample"),
+ "aresample", args, NULL, fg->graph);
+ if (ret < 0)
+ return ret;
+
+ ret = avfilter_link(*in_filter, 0, aswr, 0);
+ if (ret < 0)
+ return ret;
+
+ *in_filter = aswr;
+ }
+
#define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \
AVFilterContext *filt_ctx; \
\