From 2b09658f882be41b9da4e023ded1d853b1493edb Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 14 Nov 2017 08:41:45 -0500 Subject: [PATCH] fixes, set tune to lowlatency --- src/zm_ffmpeg.cpp | 2 +- src/zm_videostore.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 51f8ad866..ccc876802 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -271,7 +271,6 @@ void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) AVStream *st = ic->streams[i]; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); - avcodec_string(buf, sizeof(buf), st->codec, is_output); Debug(1, " Stream #%d:%d", index, i); /* the pid is an important information, so we display it */ @@ -281,6 +280,7 @@ void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) if (lang) Debug(1, "(%s)", lang->value); Debug(1, ", frames:%d, timebase: %d/%d", st->codec_info_nb_frames, st->time_base.num, st->time_base.den); + avcodec_string(buf, sizeof(buf), st->codec, is_output); Debug(1, ": %s", buf); if (st->sample_aspect_ratio.num && // default diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index 03fc0f24c..04b9202a2 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -128,7 +128,6 @@ Debug(2,"About to copy aparames"); Error("Could not allocate in frame"); return; } - video_out_ctx = avcodec_alloc_context3( video_out_codec ); // Don't have an input stream, so need to tell it what we are sending it, or are transcoding video_out_ctx->width = monitor->Width(); video_out_ctx->height = monitor->Height(); @@ -184,6 +183,10 @@ Debug(2,"About to copy aparames"); Debug(2,"Setting preset to ultrafast"); av_dict_set( &opts, "preset", "ultrafast", 0 ); } + if ( ! av_dict_get( opts, "tune", NULL, 0 ) ) { + Debug(2,"Setting tune to lowlatency"); + av_dict_set( &opts, "tune", "lowlatency", 0 ); + } if ( (ret = avcodec_open2(video_out_ctx, video_out_codec, &opts)) < 0 ) { Warning("Can't open video codec (%s)! %s, trying h264",