summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-10 13:53:44 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-10 13:53:44 +0100
commitb7ded219e1c21ca19eb9396b7590ae861d8bfb88 (patch)
treec899683d075ede198a0c9a3f29e6ddc2bdb979a0 /src/lib
parentfc4956d144ed0869fe2fa1737adc21104bb47836 (diff)
Fix options for libx264.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ffmpeg_encoder.cc11
-rw-r--r--src/lib/ffmpeg_encoder.h1
2 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc
index 734c9810d..7d1597e36 100644
--- a/src/lib/ffmpeg_encoder.cc
+++ b/src/lib/ffmpeg_encoder.cc
@@ -45,6 +45,7 @@ force_pixel_format (AVPixelFormat, AVPixelFormat out)
FFmpegEncoder::FFmpegEncoder (shared_ptr<const Film> film, weak_ptr<Job> job, boost::filesystem::path output, Format format)
: Encoder (film, job)
+ , _options (0)
, _history (1000)
, _output (output)
{
@@ -52,6 +53,8 @@ FFmpegEncoder::FFmpegEncoder (shared_ptr<const Film> film, weak_ptr<Job> job, bo
case FORMAT_PRORES:
_pixel_format = AV_PIX_FMT_YUV422P10;
_codec_name = "prores_ks";
+ av_dict_set (&_options, "profile", "3", 0);
+ av_dict_set (&_options, "threads", "auto", 0);
break;
case FORMAT_H264:
_pixel_format = AV_PIX_FMT_YUV420P;
@@ -97,11 +100,7 @@ FFmpegEncoder::go ()
_video_stream->id = 0;
_video_stream->codec = _codec_context;
- AVDictionary* options = 0;
- av_dict_set (&options, "profile", "3", 0);
- av_dict_set (&options, "threads", "auto", 0);
-
- if (avcodec_open2 (_codec_context, codec, &options) < 0) {
+ if (avcodec_open2 (_codec_context, codec, &_options) < 0) {
throw runtime_error ("could not open FFmpeg codec");
}
@@ -109,7 +108,7 @@ FFmpegEncoder::go ()
throw runtime_error ("could not open FFmpeg output file");
}
- if (avformat_write_header (_format_context, &options) < 0) {
+ if (avformat_write_header (_format_context, &_options) < 0) {
throw runtime_error ("could not write header to FFmpeg output file");
}
diff --git a/src/lib/ffmpeg_encoder.h b/src/lib/ffmpeg_encoder.h
index bd5be4545..b5715e514 100644
--- a/src/lib/ffmpeg_encoder.h
+++ b/src/lib/ffmpeg_encoder.h
@@ -56,6 +56,7 @@ private:
AVFormatContext* _format_context;
AVStream* _video_stream;
AVPixelFormat _pixel_format;
+ AVDictionary* _options;
std::string _codec_name;
mutable boost::mutex _mutex;