From: Carl Hetherington Date: Mon, 27 Jul 2020 21:52:08 +0000 (+0200) Subject: Trying to create export audio encoders with between 9 and 15 channels X-Git-Tag: v2.15.91~5 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=2f796cd531de522a3b7ed03a9942f3c55f3a0b5b Trying to create export audio encoders with between 9 and 15 channels inclusive fails, at least for AAC. There's probably a way around this with some FFmpeg-cleverness but for now let's just export any project with more than 8 channels as 16. You could argue that we should offer choices to, for example export 7.1/HI/VN as 7.1 but that sounds fiddly. Fixes #1786. --- diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index 15e27e633..a3d2ff86f 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -61,38 +61,6 @@ FFmpegEncoder::FFmpegEncoder ( : Encoder (film, job) , _history (200) { - int const files = split_reels ? film->reels().size() : 1; - for (int i = 0; i < files; ++i) { - - boost::filesystem::path filename = output; - string extension = boost::filesystem::extension (filename); - filename = boost::filesystem::change_extension (filename, ""); - - if (files > 1) { - /// TRANSLATORS: _reel%1 here is to be added to an export filename to indicate - /// which reel it is. Preserve the %1; it will be replaced with the reel number. - filename = filename.string() + String::compose(_("_reel%1"), i + 1); - } - - _file_encoders.push_back ( - FileEncoderSet ( - _film->frame_size(), - _film->video_frame_rate(), - _film->audio_frame_rate(), - mixdown_to_stereo ? 2 : film->audio_channels(), - format, - x264_crf, - _film->three_d(), - filename, - extension -#ifdef DCPOMATIC_VARIANT_SWAROOP - , key - , id -#endif - ) - ); - } - _player->set_always_burn_open_subtitles (); _player->set_play_referenced (); @@ -123,16 +91,52 @@ FFmpegEncoder::FFmpegEncoder ( } /* XXX: maybe we should do something better for >6 channel DCPs */ } else { - _output_audio_channels = ch; - map = AudioMapping (ch, ch); + /* Our encoders don't really want to encode any channel count between 9 and 15 inclusive, + * so let's just use 16 channel exports for any project with more than 8 channels. + */ + _output_audio_channels = ch > 8 ? 16 : ch; + map = AudioMapping (ch, _output_audio_channels); for (int i = 0; i < ch; ++i) { map.set (i, i, 1); } } _butler.reset (new Butler(_player, map, _output_audio_channels, bind(&PlayerVideo::force, _1, FFmpegFileEncoder::pixel_format(format)), true, false)); + + int const files = split_reels ? film->reels().size() : 1; + for (int i = 0; i < files; ++i) { + + boost::filesystem::path filename = output; + string extension = boost::filesystem::extension (filename); + filename = boost::filesystem::change_extension (filename, ""); + + if (files > 1) { + /// TRANSLATORS: _reel%1 here is to be added to an export filename to indicate + /// which reel it is. Preserve the %1; it will be replaced with the reel number. + filename = filename.string() + String::compose(_("_reel%1"), i + 1); + } + + _file_encoders.push_back ( + FileEncoderSet ( + _film->frame_size(), + _film->video_frame_rate(), + _film->audio_frame_rate(), + _output_audio_channels, + format, + x264_crf, + _film->three_d(), + filename, + extension +#ifdef DCPOMATIC_VARIANT_SWAROOP + , key + , id +#endif + ) + ); + } } + void FFmpegEncoder::go () {