Add Prores 4444 support (#2263).
authorCarl Hetherington <cth@carlh.net>
Sun, 12 Jun 2022 20:32:30 +0000 (22:32 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 12 Jun 2022 20:32:34 +0000 (22:32 +0200)
src/lib/export_config.cc
src/lib/ffmpeg_file_encoder.cc
src/lib/ffmpeg_file_encoder.h
src/wx/export_video_file_dialog.cc
test/ffmpeg_encoder_test.cc

index 66c5e3d664075c067ee44fa42db277290fc5688e..e030b98e26ceeed3c8d6c2fc6fd7c02e57048cb7 100644 (file)
@@ -63,6 +63,8 @@ ExportConfig::read(cxml::ConstNodePtr node)
                _format = ExportFormat::SUBTITLES_DCP;
        } else if (format == "h264-aac") {
                _format = ExportFormat::H264_AAC;
+       } else if (format == "prores-4444") {
+               _format = ExportFormat::PRORES_4444;
        } else {
                _format = ExportFormat::PRORES_HQ;
        }
@@ -80,8 +82,12 @@ ExportConfig::write(xmlpp::Element* node) const
        string name;
 
        switch (_format) {
+               case ExportFormat::PRORES_4444:
+                       name = "prores-4444";
+                       break;
                case ExportFormat::PRORES_HQ:
-                       name = "prores";
+                       /* Write this but we also accept 'prores' for backwards compatibility */
+                       name = "prores-hq";
                        break;
                case ExportFormat::H264_AAC:
                        name = "h264-aac";
index 17f6f55cb01413ddebdda3b52df944ce95f8c092..307a30aca340227cc9ec2ed5246aec8c162f73d1 100644 (file)
@@ -228,6 +228,13 @@ FFmpegFileEncoder::FFmpegFileEncoder (
        _pixel_format = pixel_format (format);
 
        switch (format) {
+       case ExportFormat::PRORES_4444:
+               _sample_format = AV_SAMPLE_FMT_S16;
+               _video_codec_name = "prores_ks";
+               _audio_codec_name = "pcm_s16le";
+               av_dict_set(&_video_options, "profile", "4", 0);
+               av_dict_set(&_video_options, "threads", "auto", 0);
+               break;
        case ExportFormat::PRORES_HQ:
                _sample_format = AV_SAMPLE_FMT_S16;
                _video_codec_name = "prores_ks";
@@ -281,6 +288,8 @@ AVPixelFormat
 FFmpegFileEncoder::pixel_format (ExportFormat format)
 {
        switch (format) {
+       case ExportFormat::PRORES_4444:
+               return AV_PIX_FMT_YUV444P10;
        case ExportFormat::PRORES_HQ:
                return AV_PIX_FMT_YUV422P10;
        case ExportFormat::H264_AAC:
index fd716d47c4a3f980b7cc7d057b41e29c65bdafd8..5bf501370ab6d9ad917b6808a0ffc1041b176378 100644 (file)
@@ -43,6 +43,7 @@ class ExportAudioStream;
 
 enum class ExportFormat
 {
+       PRORES_4444,
        PRORES_HQ,
        H264_AAC,
        SUBTITLES_DCP
index 5e5e9c4ff441aaf3dfd3b2943c1f787dd5897b4d..3cc4b133fdf672a0f1f4a4793440de647288478f 100644 (file)
@@ -35,25 +35,29 @@ using std::string;
 using boost::bind;
 
 
-#define FORMATS 2
+int constexpr FORMATS = 3;
 
 
 wxString format_names[] = {
-       _("MOV / ProRes"),
+       _("MOV / ProRes 4444"),
+       _("MOV / ProRes HQ"),
        _("MP4 / H.264"),
 };
 
 wxString format_filters[] = {
+       _("MOV files (*.mov)|*.mov"),
        _("MOV files (*.mov)|*.mov"),
        _("MP4 files (*.mp4)|*.mp4"),
 };
 
 wxString format_extensions[] = {
+       "mov",
        "mov",
        "mp4",
 };
 
 ExportFormat formats[] = {
+       ExportFormat::PRORES_4444,
        ExportFormat::PRORES_HQ,
        ExportFormat::H264_AAC,
 };
@@ -165,9 +169,9 @@ ExportVideoFileDialog::format_changed ()
        DCPOMATIC_ASSERT (selection >= 0 && selection < FORMATS);
        _file->SetWildcard (format_filters[selection]);
        _file->SetPath (_initial_name);
-       _x264_crf->Enable (selection == 1);
+       _x264_crf->Enable (formats[selection] == ExportFormat::H264_AAC);
        for (int i = 0; i < 2; ++i) {
-               _x264_crf_label[i]->Enable (selection == 1);
+               _x264_crf_label[i]->Enable(formats[selection] == ExportFormat::H264_AAC);
        }
        _mixdown->Enable (selection != 2);
 
index ff730ad53354a904a8aabf9894a8bf48e16500a1..c85eb6bd45ba863138294a447b16bb32f71ffc13 100644 (file)
@@ -57,8 +57,12 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f
                name += "h264";
                extension = "mp4";
                break;
+       case ExportFormat::PRORES_4444:
+               name += "prores-444";
+               extension = "mov";
+               break;
        case ExportFormat::PRORES_HQ:
-               name += "prores";
+               name += "prores-hq";
                extension = "mov";
                break;
        case ExportFormat::SUBTITLES_DCP: