Trying to create export audio encoders with between 9 and 15 channels v2.14.34
authorCarl Hetherington <cth@carlh.net>
Mon, 27 Jul 2020 22:28:51 +0000 (22:28 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 27 Jul 2020 22:28:51 +0000 (22:28 +0000)
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.

src/lib/ffmpeg_encoder.cc

index afba7c18750a56b36b16a387295d4122d4bd9ed1..25ad4a54c1b22e577d96d206be83720a807d9599 100644 (file)
@@ -54,34 +54,6 @@ FFmpegEncoder::FFmpegEncoder (
        : Encoder (film, job)
        , _history (1000)
 {
        : Encoder (film, job)
        , _history (1000)
 {
-       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
-                               )
-                       );
-       }
-
        _player->set_always_burn_open_subtitles ();
        _player->set_play_referenced ();
 
        _player->set_always_burn_open_subtitles ();
        _player->set_play_referenced ();
 
@@ -111,14 +83,42 @@ FFmpegEncoder::FFmpegEncoder (
                        map.set (dcp::RS,     1, overall_gain);
                }
        } else {
                        map.set (dcp::RS,     1, overall_gain);
                }
        } else {
-               _output_audio_channels = ch;
-               map = AudioMapping (ch, ch);
+               _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));
                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
+                               )
+                       );
+       }
 }
 
 void
 }
 
 void