Skip to content

Commit

Permalink
from Glimesh (#5)
Browse files Browse the repository at this point in the history
* 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 Glimesh/janus-ftl-plugin#43 to have a single-purpose tool that sends a stream to ingest.

Co-authored-by: Nathaniel von Sprecken <[email protected]>
Co-authored-by: Jan Alexander Steffens (heftig) <[email protected]>
Co-authored-by: Hayden McAfee <[email protected]>
Co-authored-by: Daniel Stiner <[email protected]>
  • Loading branch information
5 people authored Mar 13, 2021
1 parent 8dfff5f commit 6b2a554
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
23 changes: 18 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand All @@ -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})
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -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)
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)
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 "<mixer stream key>" -v path\to\sintel.h264 -a path\to\sintel.opus -f 24
ftl_app -i auto -s "<mixer stream key>" -v output-video.h264 -a output-audio.opus -f 24
```
2 changes: 1 addition & 1 deletion ftl_app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void log_test(ftl_log_severity_t log_level, const char *message)

void usage()
{
printf("Usage: ftl_app -i <ingest uri> -s <stream_key> - v <h264_annex_b_file> -a <opus in ogg container>\n");
printf("Usage: ftl_app -i <ingest uri> -s <stream_key> -v <h264_annex_b_file> -a <opus in ogg container>\n");
exit(0);
}

Expand Down
11 changes: 11 additions & 0 deletions libftl.pc.in
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 6b2a554

Please sign in to comment.