From 6b2a55455bcf734575877aad2e7d7e528984a70b Mon Sep 17 00:00:00 2001 From: tyiki badwell <44538549+tyiki-badwell@users.noreply.github.com> Date: Sat, 13 Mar 2021 18:30:19 +0900 Subject: [PATCH] from Glimesh (#5) * feat(ftl-sdk): updating to new best endpoint and docker builds Added Docker Build Added call to new Best v2 endpoint Added more verbose logging and error handling Added use of linter Increase the length of vendor name and version * adding execute into git for scripts * cmake: Use external jansson if possible * cmake: Install into standard directories * cmake: Install a pkgconfig file * Add instructions for generating compatible audio/video streams (#2) The original links to download a demuxed version of Sintel are all broken links now, I think this is a reasonable set of options to start with and I confirmed the outputs work with `ftl_app`, though the audio seems to get out of sync. This of course can be further improved but it's a step towards https://github.com/Glimesh/janus-ftl-plugin/issues/43 to have a single-purpose tool that sends a stream to ingest. Co-authored-by: Nathaniel von Sprecken Co-authored-by: Jan Alexander Steffens (heftig) Co-authored-by: Hayden McAfee Co-authored-by: Daniel Stiner --- CMakeLists.txt | 23 ++++++++++++++++++----- README.md | 13 ++++++------- ftl_app/main.c | 2 +- libftl.pc.in | 11 +++++++++++ 4 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 libftl.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index ef616e9..f6cb6c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ cmake_minimum_required (VERSION 2.8.0) enable_language(C) project(libftl) +SET(FTL_VERSION "0.5.0") + option(DISABLE_AUTO_INGEST "Set to TRUE to disable auto ingest feature which removes curl and jansson dependancies" FALSE) MESSAGE(STATUS "FTL DISABLE_AUTO_INGEST: " ${DISABLE_AUTO_INGEST}) @@ -11,7 +13,9 @@ MESSAGE(STATUS "FTL DISABLE_FTL_APP: " ${DISABLE_FTL_APP}) option(FTL_STATIC_COMPILE "Set to TRUE if you want ftl to be compiled as a static lib. If TRUE, the program will want to statically link to the ftl cmake object." FALSE) MESSAGE(STATUS "FTL FTL_STATIC_COMPILE: " ${FTL_STATIC_COMPILE}) +include(GNUInstallDirs) find_package(Threads REQUIRED) +find_package(PkgConfig) set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) @@ -39,15 +43,18 @@ if (NOT CURL_FOUND AND NOT DISABLE_AUTO_INGEST) endif() # We will only try to include lib jansson if auto ingest is enabled. -SET(JANSSON_LIBRARIES "") -if (NOT DISABLE_AUTO_INGEST) +if (PKG_CONFIG_FOUND AND NOT DISABLE_AUTO_INGEST) + pkg_check_modules(JANSSON jansson) +endif() +if (NOT JANSSON_FOUND AND NOT DISABLE_AUTO_INGEST) SET(JANSSON_BUILD_DOCS OFF CACHE BOOL "Jansson docs off") SET(JANSSON_WITHOUT_TESTS ON CACHE BOOL "Jansson build without tests") SET(JANSSON_EXAMPLES OFF CACHE BOOL "Jansson disable examples") SET(USE_WINDOWS_CRYPTOAPI off) add_subdirectory(libjansson) - include_directories(${CMAKE_CURRENT_BINARY_DIR}/libjansson/include) + SET(JANSSON_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/libjansson/include) SET(JANSSON_LIBRARIES jansson) + include_directories(${JANSSON_INCLUDE_DIRS}) endif() if (WIN32) @@ -95,7 +102,7 @@ add_library(ftl ${FTL_LIB_TYPE} libftl/hmac/hmac.c ${FTLSDK_PLATFORM_FILES}) include_directories(libftl libftl/gettimeofday) -set_target_properties(ftl PROPERTIES VERSION "0.5.0") +set_target_properties(ftl PROPERTIES VERSION ${FTL_VERSION}) set_target_properties(ftl PROPERTIES SOVERSION 0) target_link_libraries(ftl ${CURL_LIBRARIES} ${JANSSON_LIBRARIES}) @@ -129,5 +136,11 @@ if (NOT DISABLE_FTL_APP) target_include_directories(ftl_app PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ftl_app) endif() +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libftl.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/libftl.pc @ONLY) + # Install rules -install(TARGETS ftl DESTINATION lib) \ No newline at end of file +install(TARGETS ftl DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES libftl/ftl.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libftl) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libftl.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) diff --git a/README.md b/README.md index 4c9359a..e92e81e 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,14 @@ Due to the nature of WebRTC the following audio and video formats are required #### Audio - Opus at 48khz -#### video +`ffmpeg -i input-video.avi -vn -c:a libopus -b:a 160K -ac 2 output-audio.opus` + +#### Video - H.264 (most profiles are supported including baseline, main and high) - for the lowest delay B Frames should be disabled +`ffmpeg -i input-video.avi -an -c:v libx264 -b:v 5000K -tune zerolatency --no-psy output-video.h264` + ### Building Prerequisites: @@ -55,13 +59,8 @@ msbuild /p:Configuration=Release ALL_BUILD.vcxproj OR open libftl.sln in Visual ### Running Test Application -download the following test files: - - - sintel.h264: https://www.dropbox.com/s/ruijibs0lgjnq51/sintel.h264 - - sintel.opus: https://www.dropbox.com/s/s2r6lggopt9ftw5/sintel.opus - In the directory containing ftl_app ``` -ftl_app -i auto -s "" -v path\to\sintel.h264 -a path\to\sintel.opus -f 24 +ftl_app -i auto -s "" -v output-video.h264 -a output-audio.opus -f 24 ``` diff --git a/ftl_app/main.c b/ftl_app/main.c index 7750e50..e90bf66 100644 --- a/ftl_app/main.c +++ b/ftl_app/main.c @@ -53,7 +53,7 @@ void log_test(ftl_log_severity_t log_level, const char *message) void usage() { - printf("Usage: ftl_app -i -s - v -a \n"); + printf("Usage: ftl_app -i -s -v -a \n"); exit(0); } diff --git a/libftl.pc.in b/libftl.pc.in new file mode 100644 index 0000000..106ffc8 --- /dev/null +++ b/libftl.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/libftl + +Name: FTL +Description: Library for Mixer's FTL Protocol +Version: @FTL_VERSION@ +Requires.private: libcurl jansson +Libs: -L${libdir} -lftl +Cflags: -I${includedir}