/*
- Copyright (C) 2017-2019 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2017-2021 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
*/
+
+#include "lib/audio_content.h"
+#include "lib/compose.hpp"
+#include "lib/config.h"
+#include "lib/content_factory.h"
+#include "lib/dcp_content.h"
+#include "lib/dcpomatic_log.h"
+#include "lib/ffmpeg_content.h"
#include "lib/ffmpeg_encoder.h"
+#include "lib/ffmpeg_examiner.h"
#include "lib/film.h"
-#include "lib/ffmpeg_content.h"
#include "lib/image_content.h"
-#include "lib/video_content.h"
-#include "lib/audio_content.h"
-#include "lib/string_text_file_content.h"
#include "lib/ratio.h"
-#include "lib/transcode_job.h"
-#include "lib/dcp_content.h"
+#include "lib/string_text_file_content.h"
#include "lib/text_content.h"
-#include "lib/compose.hpp"
-#include "lib/content_factory.h"
+#include "lib/transcode_job.h"
+#include "lib/video_content.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
+
using std::string;
-using boost::shared_ptr;
-using boost::optional;
+using std::shared_ptr;
+using std::make_shared;
using namespace dcpomatic;
+
static void
ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat format)
{
+ Cleanup cl;
+
string name = "ffmpeg_encoder_";
string extension;
switch (format) {
- case EXPORT_FORMAT_H264_AAC:
+ case ExportFormat::H264_AAC:
name += "h264";
extension = "mp4";
break;
- case EXPORT_FORMAT_PRORES:
- name += "prores";
+ case ExportFormat::PRORES_4444:
+ name += "prores-444";
extension = "mov";
break;
- case EXPORT_FORMAT_H264_PCM:
- case EXPORT_FORMAT_SUBTITLES_DCP:
+ case ExportFormat::PRORES_HQ:
+ name += "prores-hq";
+ extension = "mov";
+ break;
+ case ExportFormat::SUBTITLES_DCP:
BOOST_REQUIRE (false);
}
name = String::compose("%1_test%2", name, number);
- shared_ptr<Film> film = new_test_film (name);
+ auto c = make_shared<FFmpegContent>(content);
+ auto film = new_test_film2 (name, {c}, &cl);
film->set_name (name);
- shared_ptr<FFmpegContent> c (new FFmpegContent(content));
- film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- film->examine_and_add_content (c);
- BOOST_REQUIRE (!wait_for_jobs ());
-
film->write_metadata ();
- shared_ptr<Job> job (new TranscodeJob (film));
- FFmpegEncoder encoder (film, job, String::compose("build/test/%1.%2", name, extension), format, false, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ auto file = boost::filesystem::path("build") / "test" / String::compose("%1.%2", name, extension);
+ cl.add (file);
+ FFmpegEncoder encoder (film, job, file, format, false, false, false, 23);
encoder.go ();
+
+ cl.run ();
}
+
/** Red / green / blue MP4 -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test1)
{
- ffmpeg_content_test (1, "test/data/test.mp4", EXPORT_FORMAT_PRORES);
+ ffmpeg_content_test (1, "test/data/test.mp4", ExportFormat::PRORES_HQ);
}
+
/** Dolby Aurora trailer VOB -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test2)
{
- ffmpeg_content_test (2, TestPaths::private_data / "dolby_aurora.vob", EXPORT_FORMAT_PRORES);
+ ffmpeg_content_test (2, TestPaths::private_data() / "dolby_aurora.vob", ExportFormat::PRORES_HQ);
}
+
/** Sintel trailer -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test3)
{
- ffmpeg_content_test (3, TestPaths::private_data / "Sintel_Trailer1.480p.DivX_Plus_HD.mkv", EXPORT_FORMAT_PRORES);
+ ffmpeg_content_test (3, TestPaths::private_data() / "Sintel_Trailer1.480p.DivX_Plus_HD.mkv", ExportFormat::PRORES_HQ);
}
+
/** Big Buck Bunny trailer -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test4)
{
- ffmpeg_content_test (4, TestPaths::private_data / "big_buck_bunny_trailer_480p.mov", EXPORT_FORMAT_PRORES);
+ ffmpeg_content_test (4, TestPaths::private_data() / "big_buck_bunny_trailer_480p.mov", ExportFormat::PRORES_HQ);
}
+
/** Still image -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test5)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_prores_test5");
+ auto film = new_test_film ("ffmpeg_encoder_prores_test5");
film->set_name ("ffmpeg_encoder_prores_test5");
- shared_ptr<ImageContent> c (new ImageContent(TestPaths::private_data / "bbc405.png"));
+ auto c = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
c->video->set_length (240);
film->write_metadata ();
- shared_ptr<Job> job (new TranscodeJob (film));
- FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test5.mov", EXPORT_FORMAT_PRORES, false, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test5.mov", ExportFormat::PRORES_HQ, false, false, false, 23);
encoder.go ();
}
+
/** Subs -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test6)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_prores_test6");
+ auto film = new_test_film ("ffmpeg_encoder_prores_test6");
film->set_name ("ffmpeg_encoder_prores_test6");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip2.srt"));
+ auto s = make_shared<StringTextFileContent>("test/data/subrip2.srt");
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
- s->only_text()->set_effect (dcp::SHADOW);
+ s->only_text()->set_effect (dcp::Effect::SHADOW);
s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255));
film->write_metadata();
- shared_ptr<Job> job (new TranscodeJob (film));
- FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test6.mov", EXPORT_FORMAT_PRORES, false, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob> (film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test6.mov", ExportFormat::PRORES_HQ, false, false, false, 23);
encoder.go ();
}
+
/** Video + subs -> Prores */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_test7)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_prores_test7");
+ auto film = new_test_film ("ffmpeg_encoder_prores_test7");
film->set_name ("ffmpeg_encoder_prores_test7");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
+ auto c = make_shared<FFmpegContent>("test/data/test.mp4");
film->examine_and_add_content (c);
BOOST_REQUIRE (!wait_for_jobs ());
- shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip.srt"));
+ auto s = make_shared<StringTextFileContent>("test/data/subrip.srt");
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
- s->only_text()->set_effect (dcp::SHADOW);
+ s->only_text()->set_effect (dcp::Effect::SHADOW);
s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255));
- shared_ptr<Job> job (new TranscodeJob (film));
- FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", EXPORT_FORMAT_PRORES, false, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test7.mov", ExportFormat::PRORES_HQ, false, false, false, 23);
encoder.go ();
}
+
/** Red / green / blue MP4 -> H264 */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test1)
{
- ffmpeg_content_test(1, "test/data/test.mp4", EXPORT_FORMAT_H264_AAC);
+ ffmpeg_content_test(1, "test/data/test.mp4", ExportFormat::H264_AAC);
}
+
/** Just subtitles -> H264 */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test2)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_h264_test2");
+ auto film = new_test_film ("ffmpeg_encoder_h264_test2");
film->set_name ("ffmpeg_encoder_h264_test2");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip2.srt"));
+ auto s = make_shared<StringTextFileContent>("test/data/subrip2.srt");
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
- s->only_text()->set_effect (dcp::SHADOW);
+ s->only_text()->set_effect (dcp::Effect::SHADOW);
s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255));
film->write_metadata();
- shared_ptr<Job> job (new TranscodeJob (film));
- FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test2.mp4", EXPORT_FORMAT_H264_AAC, false, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test2.mp4", ExportFormat::H264_AAC, false, false, false, 23);
encoder.go ();
}
+
/** Video + subs -> H264 */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test3)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_h264_test3");
+ auto film = new_test_film ("ffmpeg_encoder_h264_test3");
film->set_name ("ffmpeg_encoder_h264_test3");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> c (new FFmpegContent("test/data/test.mp4"));
+ auto c = make_shared<FFmpegContent>("test/data/test.mp4");
film->examine_and_add_content (c);
- BOOST_REQUIRE (!wait_for_jobs ());
+ BOOST_REQUIRE (!wait_for_jobs());
- shared_ptr<StringTextFileContent> s (new StringTextFileContent("test/data/subrip.srt"));
+ auto s = make_shared<StringTextFileContent>("test/data/subrip.srt");
film->examine_and_add_content (s);
BOOST_REQUIRE (!wait_for_jobs ());
s->only_text()->set_colour (dcp::Colour (255, 255, 0));
- s->only_text()->set_effect (dcp::SHADOW);
+ s->only_text()->set_effect (dcp::Effect::SHADOW);
s->only_text()->set_effect_colour (dcp::Colour (0, 255, 255));
film->write_metadata();
- shared_ptr<Job> job (new TranscodeJob (film));
- FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test3.mp4", EXPORT_FORMAT_H264_AAC, false, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob> (film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test3.mp4", ExportFormat::H264_AAC, false, false, false, 23);
encoder.go ();
}
+
/** Scope-in-flat DCP -> H264 */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test4)
{
- shared_ptr<Film> film = new_test_film2("ffmpeg_encoder_h264_test4");
- film->examine_and_add_content(shared_ptr<DCPContent>(new DCPContent("test/data/scope_dcp")));
+ auto film = new_test_film2("ffmpeg_encoder_h264_test4", {make_shared<DCPContent>("test/data/scope_dcp")});
BOOST_REQUIRE(!wait_for_jobs());
film->set_container(Ratio::from_id("185"));
- shared_ptr<Job> job(new TranscodeJob(film));
- FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test4.mp4", EXPORT_FORMAT_H264_AAC, false, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test4.mp4", ExportFormat::H264_AAC, false, false, false, 23);
encoder.go();
}
+
/** Test mixdown from 5.1 to stereo */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test5)
{
- shared_ptr<Film> film = new_test_film ("ffmpeg_transcoder_h264_test5");
+ auto film = new_test_film ("ffmpeg_transcoder_h264_test5");
film->set_name ("ffmpeg_transcoder_h264_test5");
film->set_container (Ratio::from_id ("185"));
film->set_audio_channels (6);
- shared_ptr<FFmpegContent> L (new FFmpegContent("test/data/L.wav"));
+ auto L = make_shared<FFmpegContent>("test/data/L.wav");
film->examine_and_add_content (L);
- shared_ptr<FFmpegContent> R (new FFmpegContent("test/data/R.wav"));
+ auto R = make_shared<FFmpegContent>("test/data/R.wav");
film->examine_and_add_content (R);
- shared_ptr<FFmpegContent> C (new FFmpegContent("test/data/C.wav"));
+ auto C = make_shared<FFmpegContent>("test/data/C.wav");
film->examine_and_add_content (C);
- shared_ptr<FFmpegContent> Ls (new FFmpegContent("test/data/Ls.wav"));
+ auto Ls = make_shared<FFmpegContent>("test/data/Ls.wav");
film->examine_and_add_content (Ls);
- shared_ptr<FFmpegContent> Rs (new FFmpegContent("test/data/Rs.wav"));
+ auto Rs = make_shared<FFmpegContent>("test/data/Rs.wav");
film->examine_and_add_content (Rs);
- shared_ptr<FFmpegContent> Lfe (new FFmpegContent("test/data/Lfe.wav"));
+ auto Lfe = make_shared<FFmpegContent>("test/data/Lfe.wav");
film->examine_and_add_content (Lfe);
BOOST_REQUIRE (!wait_for_jobs ());
map.set (0, 5, 1);
Rs->audio->set_mapping (map);
- shared_ptr<Job> job (new TranscodeJob (film));
- FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test5.mp4", EXPORT_FORMAT_H264_AAC, true, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_test5.mp4", ExportFormat::H264_AAC, true, false, false, 23);
encoder.go ();
check_ffmpeg ("build/test/ffmpeg_encoder_h264_test5.mp4", "test/data/ffmpeg_encoder_h264_test5.mp4", 1);
}
+
/** Test export of a VF */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test6)
{
- shared_ptr<Film> film = new_test_film2 ("ffmpeg_encoder_h264_test6_ov");
- film->examine_and_add_content (shared_ptr<ImageContent>(new ImageContent(TestPaths::private_data / "bbc405.png")));
- BOOST_REQUIRE (!wait_for_jobs());
- film->make_dcp ();
+ auto film = new_test_film2 ("ffmpeg_encoder_h264_test6_ov");
+ film->examine_and_add_content (make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png"));
BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
- shared_ptr<Film> film2 = new_test_film2 ("ffmpeg_encoder_h264_test6_vf");
- shared_ptr<DCPContent> ov (new DCPContent("build/test/ffmpeg_encoder_h264_test6_ov/" + film->dcp_name(false)));
+ auto film2 = new_test_film2 ("ffmpeg_encoder_h264_test6_vf");
+ auto ov = make_shared<DCPContent>("build/test/ffmpeg_encoder_h264_test6_ov/" + film->dcp_name(false));
film2->examine_and_add_content (ov);
BOOST_REQUIRE (!wait_for_jobs());
ov->set_reference_video (true);
- shared_ptr<Content> subs = content_factory("test/data/subrip.srt").front();
+ auto subs = content_factory("test/data/subrip.srt")[0];
film2->examine_and_add_content (subs);
BOOST_REQUIRE (!wait_for_jobs());
- BOOST_FOREACH (shared_ptr<TextContent> i, subs->text) {
+ for (auto i: subs->text) {
i->set_use (true);
}
- shared_ptr<Job> job (new TranscodeJob (film2));
- FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test6_vf.mp4", EXPORT_FORMAT_H264_AAC, true, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob>(film2, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test6_vf.mp4", ExportFormat::H264_AAC, true, false, false, 23);
encoder.go ();
}
+
+/** Test export of a 3D DCP in a 2D project */
+BOOST_AUTO_TEST_CASE (ffmpeg_encoder_3d_dcp_to_h264)
+{
+ auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "xm");
+ auto film2 = new_test_film2 ("ffmpeg_encoder_3d_dcp_to_h264_export", {dcp});
+
+ auto job = make_shared<TranscodeJob>(film2, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_3d_dcp_to_h264.mp4", ExportFormat::H264_AAC, true, false, false, 23);
+ encoder.go ();
+}
+
+
/** Test export of a 3D DCP in a 2D project */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7)
{
- shared_ptr<Film> film = new_test_film2 ("ffmpeg_encoder_h264_test7_data");
- shared_ptr<Content> L (shared_ptr<ImageContent>(new ImageContent(TestPaths::private_data / "bbc405.png")));
- film->examine_and_add_content (L);
- shared_ptr<Content> R (shared_ptr<ImageContent>(new ImageContent(TestPaths::private_data / "bbc405.png")));
- film->examine_and_add_content (R);
- BOOST_REQUIRE (!wait_for_jobs());
- L->video->set_frame_type (VIDEO_FRAME_TYPE_3D_LEFT);
+ auto L = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png");
+ auto R = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png");
+ auto film = new_test_film2 ("ffmpeg_encoder_h264_test7_data", {L, R});
+ L->video->set_frame_type (VideoFrameType::THREE_D_LEFT);
L->set_position (film, DCPTime());
- R->video->set_frame_type (VIDEO_FRAME_TYPE_3D_RIGHT);
+ R->video->set_frame_type (VideoFrameType::THREE_D_RIGHT);
R->set_position (film, DCPTime());
film->set_three_d (true);
- film->make_dcp ();
- BOOST_REQUIRE (!wait_for_jobs());
+ make_and_verify_dcp (film);
- shared_ptr<Film> film2 = new_test_film2 ("ffmpeg_encoder_h264_test7_export");
- shared_ptr<Content> dcp (new DCPContent(film->dir(film->dcp_name())));
- film2->examine_and_add_content (dcp);
- BOOST_REQUIRE (!wait_for_jobs());
+ auto dcp = make_shared<DCPContent>(film->dir(film->dcp_name()));
+ auto film2 = new_test_film2 ("ffmpeg_encoder_h264_test7_export", {dcp});
- shared_ptr<Job> job (new TranscodeJob (film2));
- FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test7.mp4", EXPORT_FORMAT_H264_AAC, true, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob> (film2, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_h264_test7.mp4", ExportFormat::H264_AAC, true, false, false, 23);
encoder.go ();
}
/** Stereo project with mixdown-to-stereo set */
BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test8)
{
- shared_ptr<Film> film = new_test_film2("ffmpeg_encoder_h264_test4");
- film->examine_and_add_content(shared_ptr<DCPContent>(new DCPContent("test/data/scope_dcp")));
+ auto film = new_test_film2("ffmpeg_encoder_h264_test4");
+ film->examine_and_add_content(make_shared<DCPContent>("test/data/scope_dcp"));
BOOST_REQUIRE(!wait_for_jobs());
film->set_audio_channels (2);
- shared_ptr<Job> job(new TranscodeJob(film));
- FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test8.mp4", EXPORT_FORMAT_H264_AAC, true, false, 23
-#ifdef DCPOMATIC_VARIANT_SWAROOP
- , optional<dcp::Key>(), optional<string>()
-#endif
- );
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test8.mp4", ExportFormat::H264_AAC, true, false, false, 23);
encoder.go();
}
+
+
+/** 7.1/HI/VI (i.e. 12-channel) project */
+BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test9)
+{
+ shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_prores_test9");
+ film->set_name ("ffmpeg_encoder_prores_test9");
+ auto c = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png");
+ film->set_container (Ratio::from_id ("185"));
+ film->set_audio_channels (12);
+
+ film->examine_and_add_content (c);
+ BOOST_REQUIRE (!wait_for_jobs ());
+
+ c->video->set_length (240);
+
+ film->write_metadata ();
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_test9.mov", ExportFormat::H264_AAC, false, false, false, 23);
+ encoder.go ();
+}
+
+
+/** DCP -> Prores with crop */
+BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_from_dcp_with_crop)
+{
+ auto dcp = make_shared<DCPContent>("test/data/import_dcp_test2");
+ auto film = new_test_film2 ("ffmpeg_encoder_prores_from_dcp_with_crop", { dcp });
+ dcp->video->set_left_crop (32);
+ dcp->video->set_right_crop (32);
+ film->write_metadata ();
+
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_from_dcp_with_crop.mov", ExportFormat::PRORES_HQ, false, false, false, 23);
+ encoder.go ();
+}
+
+
+/** DCP -> H264 with crop */
+BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_from_dcp_with_crop)
+{
+ auto dcp = make_shared<DCPContent>("test/data/import_dcp_test2");
+ auto film = new_test_film2 ("ffmpeg_encoder_h264_from_dcp_with_crop", { dcp });
+ dcp->video->set_left_crop (32);
+ dcp->video->set_right_crop (32);
+ film->write_metadata ();
+
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_from_dcp_with_crop.mov", ExportFormat::H264_AAC, false, false, false, 23);
+ encoder.go ();
+}
+
+
+/** Export to H264 with reels */
+BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_with_reels)
+{
+ auto content1 = content_factory("test/data/flat_red.png")[0];
+ auto content2 = content_factory("test/data/flat_red.png")[0];
+ auto film = new_test_film2 ("ffmpeg_encoder_h264_with_reels", { content1, content2 });
+ film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
+ content1->video->set_length (240);
+ content2->video->set_length (240);
+
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_h264_with_reels.mov", ExportFormat::H264_AAC, false, true, false, 23);
+ encoder.go ();
+
+ auto check = [](boost::filesystem::path path) {
+ auto reel = std::dynamic_pointer_cast<FFmpegContent>(content_factory(path)[0]);
+ BOOST_REQUIRE (reel);
+ FFmpegExaminer examiner(reel);
+ BOOST_CHECK_EQUAL (examiner.video_length(), 240U);
+ };
+
+ check ("build/test/ffmpeg_encoder_h264_with_reels_reel1.mov");
+ check ("build/test/ffmpeg_encoder_h264_with_reels_reel2.mov");
+}
+
+
+/** Regression test for "Error during decoding: Butler finished" (#2097) */
+BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_regression_1)
+{
+ auto content = content_factory(TestPaths::private_data() / "arrietty_JP-EN.mkv")[0];
+ auto film = new_test_film2 ("ffmpeg_encoder_prores_regression_1", { content });
+
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_regression_1.mov", ExportFormat::PRORES_HQ, false, true, false, 23);
+ encoder.go ();
+}
+
+
+/** Regression test for Butler video buffers reached 480 frames (audio is 0) (#2101) */
+BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_regression_2)
+{
+ auto logs = dcpomatic_log->types();
+ dcpomatic_log->set_types(logs | LogEntry::TYPE_DEBUG_PLAYER);
+
+ auto content = content_factory(TestPaths::private_data() / "tge_clip.mkv")[0];
+ auto film = new_test_film2 ("ffmpeg_encoder_prores_regression_2", { content });
+
+ auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+ FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_prores_regression_2.mov", ExportFormat::PRORES_HQ, false, true, false, 23);
+ encoder.go ();
+
+ dcpomatic_log->set_types(logs);
+}
+