diff --git a/base/include/Mp4WriterSink.h b/base/include/Mp4WriterSink.h index 28320bafe..ea4012e84 100644 --- a/base/include/Mp4WriterSink.h +++ b/base/include/Mp4WriterSink.h @@ -9,21 +9,21 @@ class DetailH264; class Mp4WriterSinkProps : public ModuleProps { public: - Mp4WriterSinkProps(uint32_t _chunkTime, uint32_t _syncTime, uint16_t _fps, std::string _baseFolder) : ModuleProps() + Mp4WriterSinkProps(uint32_t _chunkTime, uint32_t _syncTimeInSecs, uint16_t _fps, std::string _baseFolder) : ModuleProps() { baseFolder = _baseFolder; fps = _fps; - if (_chunkTime >= 1 && _chunkTime <= 60) + if ((_chunkTime >= 1 && _chunkTime <= 60) || (_chunkTime == UINT32_MAX)) { chunkTime = _chunkTime; } else { - throw AIPException(AIP_FATAL, "ChuntTime should be within [1,60] minutes limit"); + throw AIPException(AIP_FATAL, "ChuntTime should be within [1,60] minutes limit or UINT32_MAX"); } - if (_syncTime >= 1 && _syncTime <= 60) + if (_syncTimeInSecs >= 1 && _syncTimeInSecs <= 60) { - syncTime = _syncTime; + syncTimeInSecs = _syncTimeInSecs; } else { @@ -35,7 +35,7 @@ class Mp4WriterSinkProps : public ModuleProps { baseFolder = "./data/mp4_videos/"; chunkTime = 1; //minutes - syncTime = 1; + syncTimeInSecs = 1; fps = 30; } @@ -44,13 +44,13 @@ class Mp4WriterSinkProps : public ModuleProps return ModuleProps::getSerializeSize() + sizeof(baseFolder) + sizeof(chunkTime) + - sizeof(syncTime) + + sizeof(syncTimeInSecs) + sizeof(fps); } std::string baseFolder; uint32_t chunkTime = 1; - uint32_t syncTime = 1; + uint32_t syncTimeInSecs = 1; uint16_t fps = 30; private: friend class boost::serialization::access; @@ -61,7 +61,7 @@ class Mp4WriterSinkProps : public ModuleProps ar &boost::serialization::base_object(*this); ar &baseFolder; ar &chunkTime; - ar &syncTime; + ar &syncTimeInSecs; ar &fps; } }; diff --git a/base/include/Mp4WriterSinkUtils.h b/base/include/Mp4WriterSinkUtils.h index f2a151b88..32507e85f 100644 --- a/base/include/Mp4WriterSinkUtils.h +++ b/base/include/Mp4WriterSinkUtils.h @@ -10,6 +10,7 @@ class Mp4WriterSinkUtils boost::filesystem::path &relPath, std::string &mp4FileName, bool &syncFlag, std::string baseFolder, std::string& nextFrameFileName); void parseTSH264(uint64_t& tm, uint32_t& chunkTimeInMinutes, uint32_t& syncTimeInSeconds,boost::filesystem::path& relPath, std::string& mp4FileName, bool& syncFlag,short frameType, short naluType, std::string baseFolder, std::string& nextFrameFileName); + bool customNamedFileDirCheck(std::string baseFolder, uint32_t chunkTimeInMinutes, boost::filesystem::path relPath, std::string& nextFrameFileName); std::string format_hrs(int &hr); std::string format_2(int &min); std::string filePath(boost::filesystem::path relPath, std::string mp4FileName, std::string baseFolder); diff --git a/base/src/Mp4WriterSink.cpp b/base/src/Mp4WriterSink.cpp index 81363e61c..0a3f11904 100644 --- a/base/src/Mp4WriterSink.cpp +++ b/base/src/Mp4WriterSink.cpp @@ -26,7 +26,7 @@ class DetailAbs void setProps(Mp4WriterSinkProps& _props) { - mProps.reset(new Mp4WriterSinkProps(_props.chunkTime, _props.syncTime, _props.fps, _props.baseFolder)); + mProps.reset(new Mp4WriterSinkProps(_props.chunkTime, _props.syncTimeInSecs, _props.fps, _props.baseFolder)); } ~DetailAbs() @@ -149,6 +149,17 @@ class DetailAbs return !mInputMetadata.get(); } + void addMetadataInVideoHeader(frame_sp inFrame) + { + if (!lastFrameTS) + { + /* \251sts -> ©sts */ + std::string key = "\251sts"; + std::string val = std::to_string(inFrame->timestamp); + mp4_mux_add_file_metadata(mux, key.c_str(), val.c_str()); + } + } + boost::shared_ptr mProps; bool mMetadataEnabled = false; bool isKeyFrame; @@ -230,7 +241,7 @@ bool DetailJpeg::write(frame_container& frames) short naluType = 0; std::string _nextFrameFileName; mWriterSinkUtils.getFilenameForNextFrame(_nextFrameFileName, inJpegImageFrame->timestamp, mProps->baseFolder, - mProps->chunkTime, mProps->syncTime, syncFlag ,mFrameType, naluType); + mProps->chunkTime, mProps->syncTimeInSecs, syncFlag ,mFrameType, naluType); if (_nextFrameFileName == "") { @@ -249,6 +260,9 @@ bool DetailJpeg::write(frame_container& frames) mp4_mux_sync(mux); syncFlag = false; } + + addMetadataInVideoHeader(inJpegImageFrame); + mux_sample.buffer = static_cast(inJpegImageFrame->data()); mux_sample.len = inJpegImageFrame->size(); mux_sample.sync = 0; @@ -310,7 +324,7 @@ bool DetailH264::write(frame_container& frames) std::string _nextFrameFileName; mWriterSinkUtils.getFilenameForNextFrame(_nextFrameFileName,inH264ImageFrame->timestamp, mProps->baseFolder, - mProps->chunkTime, mProps->syncTime, syncFlag,mFrameType, typeFound); + mProps->chunkTime, mProps->syncTimeInSecs, syncFlag,mFrameType, typeFound); if (_nextFrameFileName == "") { @@ -338,6 +352,9 @@ bool DetailH264::write(frame_container& frames) { isKeyFrame = false; } + + addMetadataInVideoHeader(inH264ImageFrame); + mux_sample.buffer = static_cast(inH264ImageFrame->data()); mux_sample.len = inH264ImageFrame->size(); mux_sample.sync = isKeyFrame ? 1 : 0; @@ -518,7 +535,7 @@ bool Mp4WriterSink::processEOS(string& pinId) Mp4WriterSinkProps Mp4WriterSink::getProps() { - auto tempProps = Mp4WriterSinkProps(mDetail->mProps->chunkTime, mDetail->mProps->syncTime, mDetail->mProps->fps, mDetail->mProps->baseFolder); + auto tempProps = Mp4WriterSinkProps(mDetail->mProps->chunkTime, mDetail->mProps->syncTimeInSecs, mDetail->mProps->fps, mDetail->mProps->baseFolder); fillProps(tempProps); return tempProps; } diff --git a/base/src/Mp4WriterSinkUtils.cpp b/base/src/Mp4WriterSinkUtils.cpp index 14631dfc4..be3fa5bb8 100644 --- a/base/src/Mp4WriterSinkUtils.cpp +++ b/base/src/Mp4WriterSinkUtils.cpp @@ -59,6 +59,44 @@ std::string Mp4WriterSinkUtils::filePath(boost::filesystem::path relPath, std::s } } +bool Mp4WriterSinkUtils::customNamedFileDirCheck(std::string baseFolder, uint32_t chunkTimeInMinutes, boost::filesystem::path relPath, std::string& nextFrameFileName) +{ + if (boost::filesystem::extension(baseFolder) == ".mp4") + { + if (chunkTimeInMinutes == UINT32_MAX) + { + auto folderPath = boost::filesystem::path(baseFolder) / relPath; + auto path = folderPath.remove_filename(); + if (boost::filesystem::is_directory(path)) + { + nextFrameFileName = baseFolder; + return true; + } + + if (boost::filesystem::create_directories(path)) + { + nextFrameFileName = baseFolder; + return true; + } + else + { + LOG_ERROR << "Failed to create the directory <" << folderPath << ">"; + LOG_ERROR << "Check the dir permissions."; + return true; + } + } + else + { + LOG_ERROR << "Custom video file name only supported while writing to a single file."; + throw AIPException(AIP_FATAL, "Custom video file name only supported while writing to a single file."); + } + } + else + { + return false; + } +} + void Mp4WriterSinkUtils::parseTSJpeg(uint64_t &ts, uint32_t &chunkTimeInMinutes, uint32_t &syncTimeInSeconds, boost::filesystem::path &relPath, std::string &mp4FileName, bool &syncFlag, std::string baseFolder, std::string& nextFrameFileName) { @@ -83,7 +121,7 @@ void Mp4WriterSinkUtils::parseTSJpeg(uint64_t &ts, uint32_t &chunkTimeInMinutes, // used cached values if the difference in ts is less than chunkTime uint32_t chunkTimeInSecs = 60 * chunkTimeInMinutes; - if ((t - lastVideoTS) < chunkTimeInSecs && currentFolder == baseFolder) + if ((t - lastVideoTS) < chunkTimeInSecs && currentFolder == baseFolder && chunkTimeInMinutes != UINT32_MAX) { relPath = lastVideoFolderPath; mp4FileName = lastVideoName; @@ -91,16 +129,19 @@ void Mp4WriterSinkUtils::parseTSJpeg(uint64_t &ts, uint32_t &chunkTimeInMinutes, return; } - // get new video path - std::string yyyymmdd = std::to_string(1900 + tm.tm_year) + format_2(tm.tm_mon) + format_2(tm.tm_mday); - relPath = boost::filesystem::path(yyyymmdd) / format_hrs(tm.tm_hour); - mp4FileName = std::to_string(ts) + ".mp4"; - // cache new values currentFolder = baseFolder; lastVideoTS = t; - lastVideoFolderPath = relPath; lastVideoMinute = tm.tm_min; + + if (customNamedFileDirCheck(baseFolder, chunkTimeInMinutes, relPath, nextFrameFileName)) + return; + + std::string yyyymmdd = std::to_string(1900 + tm.tm_year) + format_2(tm.tm_mon) + format_2(tm.tm_mday); + relPath = boost::filesystem::path(yyyymmdd) / format_hrs(tm.tm_hour); + mp4FileName = std::to_string(ts) + ".mp4"; + lastVideoFolderPath = relPath; + lastVideoName = mp4FileName; nextFrameFileName = filePath(relPath, mp4FileName, baseFolder); @@ -128,7 +169,7 @@ void Mp4WriterSinkUtils::parseTSH264(uint64_t& ts, uint32_t& chunkTimeInMinutes, } // used cached values if the difference in ts is less than chunkTime uint32_t chunkTimeInSecs = 60 * chunkTimeInMinutes; - if ((t - lastVideoTS) < chunkTimeInSecs && currentFolder == baseFolder) + if ((t - lastVideoTS) < chunkTimeInSecs && currentFolder == baseFolder && chunkTimeInMinutes != UINT32_MAX) { relPath = lastVideoFolderPath; mp4FileName = lastVideoName; @@ -136,7 +177,7 @@ void Mp4WriterSinkUtils::parseTSH264(uint64_t& ts, uint32_t& chunkTimeInMinutes, return; } // cannot be merged with if condition above. - if (naluType != H264Utils::H264_NAL_TYPE::H264_NAL_TYPE_IDR_SLICE) + if (naluType != H264Utils::H264_NAL_TYPE::H264_NAL_TYPE_IDR_SLICE && chunkTimeInMinutes != UINT32_MAX) { relPath = lastVideoFolderPath; mp4FileName = lastVideoName; @@ -144,16 +185,20 @@ void Mp4WriterSinkUtils::parseTSH264(uint64_t& ts, uint32_t& chunkTimeInMinutes, return; } // get new video path - std::string yyyymmdd = std::to_string(1900 + tm.tm_year) + format_2(tm.tm_mon) + format_2(tm.tm_mday); - relPath = boost::filesystem::path(yyyymmdd) / format_hrs(tm.tm_hour); - mp4FileName = std::to_string(ts) + ".mp4"; // cache new values currentFolder = baseFolder; lastVideoTS = t; - lastVideoFolderPath = relPath; lastVideoMinute = tm.tm_min; + + if (customNamedFileDirCheck(baseFolder, chunkTimeInMinutes, relPath, nextFrameFileName)) + return; + + std::string yyyymmdd = std::to_string(1900 + tm.tm_year) + format_2(tm.tm_mon) + format_2(tm.tm_mday); + relPath = boost::filesystem::path(yyyymmdd) / format_hrs(tm.tm_hour); + mp4FileName = std::to_string(ts) + ".mp4"; lastVideoName = mp4FileName; + lastVideoFolderPath = relPath; nextFrameFileName = filePath(relPath, mp4FileName, baseFolder); tempNextFrameFileName = nextFrameFileName; diff --git a/base/test/mp4writersink_tests.cpp b/base/test/mp4writersink_tests.cpp index 3ae001bf7..5582334a7 100644 --- a/base/test/mp4writersink_tests.cpp +++ b/base/test/mp4writersink_tests.cpp @@ -15,7 +15,54 @@ BOOST_AUTO_TEST_SUITE(mp4WriterSink_tests) -void write(std::string inFolderPath, std::string outFolderPath, int width, int height) +void writeH264(bool readLoop, int sleepSeconds, std::string outFolderPath, int chunkTime = 1) +{ + int width = 704; + int height = 576; + + std::string inFolderPath = "./data/h264_data/"; + + LoggerProps loggerProps; + loggerProps.logLevel = boost::log::trivial::severity_level::info; + Logger::setLogLevel(boost::log::trivial::severity_level::info); + Logger::initLogger(loggerProps); + + auto fileReaderProps = FileReaderModuleProps(inFolderPath, 0, -1); + fileReaderProps.fps = 100; + fileReaderProps.readLoop = readLoop; + + auto fileReader = boost::shared_ptr(new FileReaderModule(fileReaderProps)); + auto h264ImageMetadata = framemetadata_sp(new H264Metadata(width, height)); + fileReader->addOutputPin(h264ImageMetadata); + + auto mp4WriterSinkProps = Mp4WriterSinkProps(chunkTime, 10, 100, outFolderPath); + mp4WriterSinkProps.logHealth = true; + mp4WriterSinkProps.logHealthFrequency = 100; + auto mp4WriterSink = boost::shared_ptr(new Mp4WriterSink(mp4WriterSinkProps)); + fileReader->setNext(mp4WriterSink); + + // #Dec_27_Review - do manual init, step and use saveorcompare + + boost::shared_ptr p; + p = boost::shared_ptr(new PipeLine("test")); + p->appendModule(fileReader); + + if (!p->init()) + { + throw AIPException(AIP_FATAL, "Engine Pipeline init failed. Check IPEngine Logs for more details."); + } + + LOG_ERROR << "processing folder <" << inFolderPath << ">"; + p->run_all_threaded(); + + Test_Utils::sleep_for_seconds(sleepSeconds); + + p->stop(); + p->term(); + p->wait_for_all(); + p.reset(); +} +void write(std::string inFolderPath, std::string outFolderPath, int width, int height, int chunkTime = 1) { LoggerProps loggerProps; loggerProps.logLevel = boost::log::trivial::severity_level::info; @@ -30,7 +77,7 @@ void write(std::string inFolderPath, std::string outFolderPath, int width, int h auto encodedImageMetadata = framemetadata_sp(new EncodedImageMetadata(width, height)); fileReader->addOutputPin(encodedImageMetadata); - auto mp4WriterSinkProps = Mp4WriterSinkProps(1, 10, 24, outFolderPath); + auto mp4WriterSinkProps = Mp4WriterSinkProps(chunkTime, 10, 24, outFolderPath); mp4WriterSinkProps.logHealth = true; mp4WriterSinkProps.logHealthFrequency = 100; auto mp4WriterSink = boost::shared_ptr(new Mp4WriterSink(mp4WriterSinkProps)); @@ -50,7 +97,7 @@ void write(std::string inFolderPath, std::string outFolderPath, int width, int h LOG_ERROR << "processing folder <" << inFolderPath << ">"; p->run_all_threaded(); - Test_Utils::sleep_for_seconds(60); + Test_Utils::sleep_for_seconds(15); p->stop(); p->term(); @@ -116,10 +163,10 @@ void write_metadata(std::string inFolderPath, std::string outFolderPath, std::st BOOST_AUTO_TEST_CASE(jpg_rgb_24_to_mp4v) { - int width = 960; - int height = 480; + int width = 1280; + int height = 720; - std::string inFolderPath = "./data/streamer_frames"; + std::string inFolderPath = "./data/re3_filtered"; std::string outFolderPath = "./data/testOutput/mp4_videos/rgb_24bpp/"; write(inFolderPath, outFolderPath, width, height); @@ -136,19 +183,19 @@ BOOST_AUTO_TEST_CASE(jpg_mono_8_to_mp4v) write(inFolderPath, outFolderPath, width, height); } -BOOST_AUTO_TEST_CASE(jpg_mono_8_to_mp4v_metadata, *boost::unit_test::disabled()) +BOOST_AUTO_TEST_CASE(jpg_mono_8_to_mp4v_metadata) { int width = 1280; int height = 720; std::string inFolderPath = "./data/re3_filtered_mono"; std::string outFolderPath = "./data/testOutput/mp4_videos/mono_metadata_video/"; - std::string metadataPath = "./data/metadata/"; + std::string metadataPath = "./data/Metadata/"; write_metadata(inFolderPath, outFolderPath, metadataPath, width, height, 30); } -BOOST_AUTO_TEST_CASE(jpeg_metadata, *boost::unit_test::disabled()) +BOOST_AUTO_TEST_CASE(jpeg_metadata) { /* metadata, RGB, 24bpp, 960x480 */ int width = 1280; @@ -157,7 +204,7 @@ BOOST_AUTO_TEST_CASE(jpeg_metadata, *boost::unit_test::disabled()) std::string inFolderPath = "./data/re3_filtered"; std::string outFolderPath = "./data/testOutput/mp4_videos/rgb_metadata_video"; - std::string metadataPath = "./data/metadata/"; + std::string metadataPath = "./data/Metadata/"; write_metadata(inFolderPath, outFolderPath, metadataPath, width, height, fps); } @@ -184,7 +231,7 @@ BOOST_AUTO_TEST_CASE(setgetprops_jpeg) auto encodedImageMetadata = framemetadata_sp(new EncodedImageMetadata(width, height)); fileReader->addOutputPin(encodedImageMetadata); - auto mp4WriterSinkProps = Mp4WriterSinkProps(1, 1, 30, outFolderPath); + auto mp4WriterSinkProps = Mp4WriterSinkProps(1, 10, 30, outFolderPath); mp4WriterSinkProps.logHealth = true; mp4WriterSinkProps.logHealthFrequency = 100; auto mp4WriterSink = boost::shared_ptr(new Mp4WriterSink(mp4WriterSinkProps)); @@ -217,102 +264,16 @@ BOOST_AUTO_TEST_CASE(setgetprops_jpeg) p.reset(); } -BOOST_AUTO_TEST_CASE(h264_to_mp4v, *boost::unit_test::disabled()) +BOOST_AUTO_TEST_CASE(h264_to_mp4v) { - int width = 704; - int height = 576; - - std::string inFolderPath = "./data/h264_data/"; std::string outFolderPath = "./data/testOutput/mp4_videos/h264_videos/"; - - LoggerProps loggerProps; - loggerProps.logLevel = boost::log::trivial::severity_level::info; - Logger::setLogLevel(boost::log::trivial::severity_level::info); - Logger::initLogger(loggerProps); - - auto fileReaderProps = FileReaderModuleProps(inFolderPath, 0, -1); - fileReaderProps.fps = 100; - fileReaderProps.readLoop = false; - - auto fileReader = boost::shared_ptr(new FileReaderModule(fileReaderProps)); - auto h264ImageMetadata = framemetadata_sp(new H264Metadata(width, height)); - fileReader->addOutputPin(h264ImageMetadata); - - auto mp4WriterSinkProps = Mp4WriterSinkProps(41, 1, 100, outFolderPath); - mp4WriterSinkProps.logHealth = true; - mp4WriterSinkProps.logHealthFrequency = 100; - auto mp4WriterSink = boost::shared_ptr(new Mp4WriterSink(mp4WriterSinkProps)); - fileReader->setNext(mp4WriterSink); - - // #Dec_27_Review - do manual init, step and use saveorcompare - - boost::shared_ptr p; - p = boost::shared_ptr(new PipeLine("test")); - p->appendModule(fileReader); - - if (!p->init()) - { - throw AIPException(AIP_FATAL, "Engine Pipeline init failed. Check IPEngine Logs for more details."); - } - - LOG_ERROR << "processing folder <" << inFolderPath << ">"; - p->run_all_threaded(); - - Test_Utils::sleep_for_seconds(10); - - p->stop(); - p->term(); - p->wait_for_all(); - p.reset(); + writeH264(false, 10, outFolderPath); } BOOST_AUTO_TEST_CASE(h264_to_mp4v_chunking) { - int width = 704; - int height = 576; - - std::string inFolderPath = "./data/h264_data/"; std::string outFolderPath = "./data/testOutput/mp4_videos/h264_videos/"; - - LoggerProps loggerProps; - loggerProps.logLevel = boost::log::trivial::severity_level::info; - Logger::setLogLevel(boost::log::trivial::severity_level::info); - Logger::initLogger(loggerProps); - - auto fileReaderProps = FileReaderModuleProps(inFolderPath, 0, -1); - fileReaderProps.fps = 100; - fileReaderProps.readLoop = true; - - auto fileReader = boost::shared_ptr(new FileReaderModule(fileReaderProps)); - auto h264ImageMetadata = framemetadata_sp(new H264Metadata(width, height)); - fileReader->addOutputPin(h264ImageMetadata); - - auto mp4WriterSinkProps = Mp4WriterSinkProps(1, 1, 100, outFolderPath); - mp4WriterSinkProps.logHealth = true; - mp4WriterSinkProps.logHealthFrequency = 100; - auto mp4WriterSink = boost::shared_ptr(new Mp4WriterSink(mp4WriterSinkProps)); - fileReader->setNext(mp4WriterSink); - - // #Dec_27_Review - do manual init, step and use saveorcompare - - boost::shared_ptr p; - p = boost::shared_ptr(new PipeLine("test")); - p->appendModule(fileReader); - - if (!p->init()) - { - throw AIPException(AIP_FATAL, "Engine Pipeline init failed. Check IPEngine Logs for more details."); - } - - LOG_ERROR << "processing folder <" << inFolderPath << ">"; - p->run_all_threaded(); - - Test_Utils::sleep_for_seconds(130); - - p->stop(); - p->term(); - p->wait_for_all(); - p.reset(); + writeH264(true, 130, outFolderPath); } BOOST_AUTO_TEST_CASE(h264_metadata, *boost::unit_test::disabled()) @@ -322,7 +283,7 @@ BOOST_AUTO_TEST_CASE(h264_metadata, *boost::unit_test::disabled()) std::string inFolderPath = "./data/h264_data/"; std::string outFolderPath = "./data/testOutput/mp4_videos/h264_metadata/"; - std::string metadataPath = "./data/metadata/"; + std::string metadataPath = "./data/Metadata/"; LoggerProps loggerProps; loggerProps.logLevel = boost::log::trivial::severity_level::info; @@ -349,7 +310,7 @@ BOOST_AUTO_TEST_CASE(h264_metadata, *boost::unit_test::disabled()) fileReader->setNext(readerMuxer); metadataReader->setNext(readerMuxer); - auto mp4WriterSinkProps = Mp4WriterSinkProps(1, 1, fileReaderProps.fps, outFolderPath); + auto mp4WriterSinkProps = Mp4WriterSinkProps(1, 10, fileReaderProps.fps, outFolderPath); mp4WriterSinkProps.logHealth = true; mp4WriterSinkProps.logHealthFrequency = 100; auto mp4WriterSink = boost::shared_ptr(new Mp4WriterSink(mp4WriterSinkProps)); @@ -378,12 +339,12 @@ BOOST_AUTO_TEST_CASE(h264_metadata, *boost::unit_test::disabled()) p.reset(); } -BOOST_AUTO_TEST_CASE(parsenalu, *boost::unit_test::disabled()) +BOOST_AUTO_TEST_CASE(parsenalu) { int width = 640; int height = 360; - std::string inFolderPath = "./data/h264_frames/"; + std::string inFolderPath = "./data/h264_frames/Raw_YUV420_640x360_????.h264"; auto fileReaderProps = FileReaderModuleProps(inFolderPath, 0, -1); fileReaderProps.fps = 24; @@ -466,7 +427,7 @@ BOOST_AUTO_TEST_CASE(setgetprops_h264) auto h264ImageMetadata = framemetadata_sp(new H264Metadata(width, height)); fileReader->addOutputPin(h264ImageMetadata); - auto mp4WriterSinkProps = Mp4WriterSinkProps(1, 1, 30, outFolderPath); + auto mp4WriterSinkProps = Mp4WriterSinkProps(1, 10, 30, outFolderPath); mp4WriterSinkProps.logHealth = true; mp4WriterSinkProps.logHealthFrequency = 100; auto mp4WriterSink = boost::shared_ptr(new Mp4WriterSink(mp4WriterSinkProps)); @@ -499,4 +460,24 @@ BOOST_AUTO_TEST_CASE(setgetprops_h264) p.reset(); } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_CASE(single_file_given_name_jpeg) +{ + // custom name is only supported while writing to single video file (chunktime = UINT32_MAX). + int width = 1280; + int height = 720; + + std::string inFolderPath = "./data/re3_filtered_mono"; + std::string outFolderPath = "./data/testOutput/mp4_videos/apra.mp4"; + + write(inFolderPath, outFolderPath, width, height, UINT32_MAX); +} + +BOOST_AUTO_TEST_CASE(single_file_given_name_h264) +{ + // custom name is only supported while writing to single video file (chunktime = UINT32_MAX). + std::string outFolderPath = "./data/testOutput/mp4_videos/h264_videos/apraH264.mp4"; + + writeH264(true,80,outFolderPath, UINT32_MAX); +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/data/Metadata/metadata0.txt b/data/Metadata/metadata0.txt new file mode 100644 index 000000000..3d86551f2 --- /dev/null +++ b/data/Metadata/metadata0.txt @@ -0,0 +1 @@ +ApraPipes_0 diff --git a/data/Metadata/metadata1.txt b/data/Metadata/metadata1.txt new file mode 100644 index 000000000..52f12bdfd --- /dev/null +++ b/data/Metadata/metadata1.txt @@ -0,0 +1 @@ +ApraPipes_1 \ No newline at end of file diff --git a/data/Metadata/metadata2.txt b/data/Metadata/metadata2.txt new file mode 100644 index 000000000..08ca51ded --- /dev/null +++ b/data/Metadata/metadata2.txt @@ -0,0 +1 @@ +ApraPipes_2 \ No newline at end of file diff --git a/data/Metadata/metadata3.txt b/data/Metadata/metadata3.txt new file mode 100644 index 000000000..1da61c7e7 --- /dev/null +++ b/data/Metadata/metadata3.txt @@ -0,0 +1 @@ +ApraPipes_3 \ No newline at end of file diff --git a/data/Metadata/metadata4.txt b/data/Metadata/metadata4.txt new file mode 100644 index 000000000..0e6b41ae5 --- /dev/null +++ b/data/Metadata/metadata4.txt @@ -0,0 +1 @@ +ApraPipes_4 \ No newline at end of file