X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fffmpeg_encoder_test.cc;h=e6cff9b8fdfb57df583e57e3d7342a56ff8f9bb5;hb=efa79a3db4a041cda3d93dde444e5dca9b84b976;hp=3d4787d664e8a232d259bd598a46236a5dfd41b8;hpb=83c16caa3cdb54244542adf27de700187a00c52c;p=dcpomatic.git diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc index 3d4787d66..e6cff9b8f 100644 --- a/test/ffmpeg_encoder_test.cc +++ b/test/ffmpeg_encoder_test.cc @@ -26,6 +26,7 @@ #include "lib/ratio.h" #include "lib/transcode_job.h" #include "lib/dcp_content.h" +#include "lib/subtitle_content.h" #include "test.h" #include @@ -63,10 +64,78 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_basic_test_mp4) encoder.go (); } -BOOST_AUTO_TEST_CASE (ffmpeg_encoder_basic_test_subs) +/** Simplest possible export subtitle case: just the subtitles */ +BOOST_AUTO_TEST_CASE (ffmpeg_encoder_test_subs_h264_1) { - shared_ptr film = new_test_film ("ffmpeg_transcoder_basic_test_subs"); - film->set_name ("ffmpeg_transcoder_basic_test"); + shared_ptr film = new_test_film ("ffmpeg_encoder_test_subs_h264_1"); + film->set_name ("ffmpeg_encoder_test_subs_h264_1"); + film->set_container (Ratio::from_id ("185")); + film->set_audio_channels (6); + + shared_ptr s (new TextSubtitleContent (film, "test/data/subrip2.srt")); + film->examine_and_add_content (s); + BOOST_REQUIRE (!wait_for_jobs ()); + s->subtitle->set_colour (dcp::Colour (255, 255, 0)); + s->subtitle->set_shadow (true); + s->subtitle->set_effect_colour (dcp::Colour (0, 255, 255)); + film->write_metadata(); + + shared_ptr job (new TranscodeJob (film)); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_test_subs_h264_1.mp4", FFmpegEncoder::FORMAT_H264, false); + encoder.go (); +} + +/** Slightly more complicated example with longer subs and a video to overlay */ +BOOST_AUTO_TEST_CASE (ffmpeg_encoder_test_subs_h264_2) +{ + shared_ptr film = new_test_film ("ffmpeg_encoder_test_subs_h264_2"); + film->set_name ("ffmpeg_encoder_test_subs_h264_2"); + film->set_container (Ratio::from_id ("185")); + film->set_audio_channels (6); + + shared_ptr c (new FFmpegContent (film, "test/data/test.mp4")); + film->examine_and_add_content (c); + BOOST_REQUIRE (!wait_for_jobs ()); + + shared_ptr s (new TextSubtitleContent (film, "test/data/subrip.srt")); + film->examine_and_add_content (s); + BOOST_REQUIRE (!wait_for_jobs ()); + s->subtitle->set_colour (dcp::Colour (255, 255, 0)); + s->subtitle->set_shadow (true); + s->subtitle->set_effect_colour (dcp::Colour (0, 255, 255)); + film->write_metadata(); + + shared_ptr job (new TranscodeJob (film)); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_test_subs_h264_2.mp4", FFmpegEncoder::FORMAT_H264, false); + encoder.go (); +} + +/** Simplest possible export subtitle case: just the subtitles */ +BOOST_AUTO_TEST_CASE (ffmpeg_encoder_test_subs_prores_1) +{ + shared_ptr film = new_test_film ("ffmpeg_encoder_test_subs_prores_1"); + film->set_name ("ffmpeg_encoder_test_subs_prores_1"); + film->set_container (Ratio::from_id ("185")); + film->set_audio_channels (6); + + shared_ptr s (new TextSubtitleContent (film, "test/data/subrip2.srt")); + film->examine_and_add_content (s); + BOOST_REQUIRE (!wait_for_jobs ()); + s->subtitle->set_colour (dcp::Colour (255, 255, 0)); + s->subtitle->set_shadow (true); + s->subtitle->set_effect_colour (dcp::Colour (0, 255, 255)); + film->write_metadata(); + + shared_ptr job (new TranscodeJob (film)); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_test_subs_prores_1.mov", FFmpegEncoder::FORMAT_PRORES, false); + encoder.go (); +} + +/** Slightly more complicated example with longer subs and a video to overlay */ +BOOST_AUTO_TEST_CASE (ffmpeg_encoder_test_subs_prores_2) +{ + shared_ptr film = new_test_film ("ffmpeg_encoder_test_subs_prores_2"); + film->set_name ("ffmpeg_encoder_test_subs_prores_2"); film->set_container (Ratio::from_id ("185")); film->set_audio_channels (6); @@ -77,9 +146,12 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_basic_test_subs) shared_ptr s (new TextSubtitleContent (film, "test/data/subrip.srt")); film->examine_and_add_content (s); BOOST_REQUIRE (!wait_for_jobs ()); + s->subtitle->set_colour (dcp::Colour (255, 255, 0)); + s->subtitle->set_shadow (true); + s->subtitle->set_effect_colour (dcp::Colour (0, 255, 255)); shared_ptr job (new TranscodeJob (film)); - FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_basic_test_subs.mp4", FFmpegEncoder::FORMAT_H264, false); + FFmpegEncoder encoder (film, job, "build/test/ffmpeg_encoder_test_subs_prores_2.mov", FFmpegEncoder::FORMAT_PRORES, false); encoder.go (); }