Skip to content

External encoder #311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1c6711e
changes to support FFmpeg 4.1
MarcAntoine-Arnaud Oct 21, 2019
25431e8
return log file if deps build is in error
MarcAntoine-Arnaud Oct 22, 2019
29b30ba
add FFmpeg with versions 4
MarcAntoine-Arnaud Oct 22, 2019
d49bfd3
remove old FFmpeg versions
MarcAntoine-Arnaud Oct 22, 2019
945bbce
fix LAME url
MarcAntoine-Arnaud Oct 22, 2019
8844df2
use vorbis 1.3.6
MarcAntoine-Arnaud Oct 22, 2019
204c866
export PAK_CONFIG_PATH to locate vorbis package definition
MarcAntoine-Arnaud Oct 22, 2019
444fdb9
remove vorbis dependency of FFmpeg
MarcAntoine-Arnaud Oct 22, 2019
18e9b41
add API to use an external encoder
MarcAntoine-Arnaud Nov 20, 2019
77669c8
remove libav on travis
MarcAntoine-Arnaud Nov 20, 2019
8f41e27
use nose2
MarcAntoine-Arnaud Nov 20, 2019
a2015fe
switch to nose2 with python3
MarcAntoine-Arnaud Nov 20, 2019
fa60ecd
pass copy to private
MarcAntoine-Arnaud Nov 21, 2019
8ab6660
remove copy of contructors
MarcAntoine-Arnaud Nov 21, 2019
57da18e
StreamTranscoder: fix output AudioFrameDesc when an encoder is specified
valnoel Jan 3, 2020
7bb4af5
Use python3-nose2 to execute tests on Travis
valnoel Jan 6, 2020
2dec3a3
Add AvAudioPhaseMeter application
valnoel Jan 21, 2020
ee64295
Fix unit tests execution with python 3
valnoel Jan 22, 2020
ee14235
Update appveyor config to use ffmpeg-4.2.1 and python3
valnoel Jan 22, 2020
d09f1d0
Add Python3 module for nose tests coverage
valnoel Jan 22, 2020
19ac071
Do not install python 3 on Appveyor Windows images
valnoel Jan 22, 2020
11b5347
Add Travis nose tests verbose
valnoel Jan 22, 2020
9d190de
Fix Appveyor FFmpeg download
valnoel Jan 22, 2020
673a167
Travis: Don't build with unsupported FFmpeg 4.0
valnoel Jan 22, 2020
6967e3d
Appveyor: update python version for Swig binding
valnoel Jan 22, 2020
ac5a66c
AppVeyor: fix python call
valnoel Jan 22, 2020
6fd8d17
AppVeyor: fix pip call
valnoel Jan 22, 2020
02a6ce7
Travis: force python version
valnoel Jan 22, 2020
6d5f3c3
Appveyor: fix pip upgrade
valnoel Jan 22, 2020
f520222
Appveyor: fix unit tests python call
valnoel Jan 22, 2020
a3ddbe6
CI: try to fix python version on MacOS and Windows
valnoel Jan 22, 2020
18c445f
CI: try to force swig python versio, and clean dependency path for MacOS
valnoel Jan 22, 2020
a3d5833
Travis: allow OSX build failure
valnoel Jan 22, 2020
995a83e
Travis: enable coverage
valnoel Jan 23, 2020
c496a99
Add unit tests
valnoel Jan 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,28 @@ env:
- DEPENDENCY_LOG_FILE=${TRAVIS_BUILD_DIR}/build-dependencies-log.txt

- YASM_VERSION=1.3.0
- LAME_VERSION=3.99.5
- FAAC_VERSION=1.28
- LAME_VERSION=3.100
# - FAAC_VERSION=1.28
- XVID_VERSION=1.3.3
- FDKAAC_VERSION=0.1.3
# - FDKAAC_VERSION=0.1.3
- OGG_VERSION=1.3.2
- VORBIS_VERSION=1.3.4
- THEORA_VERSION=1.1.1
- VORBIS_VERSION=1.3.6
# - THEORA_VERSION=1.1.1
- VPX_VERSION=1.4.0
matrix:
- DEPENDENCY_NAME=libav DEPENDENCY_VERSION=11.3 ENABLE_COVERAGE=true
- DEPENDENCY_NAME=libav DEPENDENCY_VERSION=11.3 ENABLE_COVERAGE=false
- DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.4.2 ENABLE_COVERAGE=true
- DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.4.2 ENABLE_COVERAGE=false
- DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.5.7 ENABLE_COVERAGE=false
- DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.6.8 ENABLE_COVERAGE=false
- DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.7.6 ENABLE_COVERAGE=false
- DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.8.6 ENABLE_COVERAGE=false
# - DEPENDENCY_NAME=libav DEPENDENCY_VERSION=11.12 ENABLE_COVERAGE=true
# - DEPENDENCY_NAME=libav DEPENDENCY_VERSION=11.12 ENABLE_COVERAGE=false
# - DEPENDENCY_NAME=libav DEPENDENCY_VERSION=12.3 ENABLE_COVERAGE=true
# - DEPENDENCY_NAME=libav DEPENDENCY_VERSION=12.3 ENABLE_COVERAGE=false
# - DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.4.2 ENABLE_COVERAGE=true
# - DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.4.2 ENABLE_COVERAGE=false
# - DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.5.7 ENABLE_COVERAGE=false
# - DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.6.8 ENABLE_COVERAGE=false
# - DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.7.6 ENABLE_COVERAGE=false
# - DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.8.6 ENABLE_COVERAGE=false
# - DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=4.0 ENABLE_COVERAGE=false
- DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=4.1 ENABLE_COVERAGE=false
- DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=4.2 ENABLE_COVERAGE=true

matrix:
exclude:
Expand All @@ -57,6 +62,7 @@ matrix:
env: DEPENDENCY_NAME=ffmpeg DEPENDENCY_VERSION=2.4.2 ENABLE_COVERAGE=true
allow_failures:
# build with libav
- os: osx
- env: DEPENDENCY_NAME=libav DEPENDENCY_VERSION=11.3 ENABLE_COVERAGE=true
- env: DEPENDENCY_NAME=libav DEPENDENCY_VERSION=11.3 ENABLE_COVERAGE=false
# build with ffmpeg-2.8.6
Expand All @@ -75,8 +81,10 @@ addons:
packages:
- cmake
- swig
- python-dev
- python-nose
- python3-dev
- python3
- python3-nose
- python3-coverage
- freeglut3-dev

cache:
Expand Down
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ cmake_minimum_required(VERSION 2.8.11)

project(AvTranscoder)

# All libraries will be put in INSTALL_PREFIX/lib
# RPATH of host points INSTALL_PREFIX/lib
# see: http://www.cmake.org/Wiki/CMake_RPATH_handling
set(CMAKE_MACOSX_RPATH 1)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)


# Define AvTranscoder default path to profiles
add_definitions(-DAVTRANSCODER_DEFAULT_AVPROFILES="${CMAKE_INSTALL_PREFIX}/share/avprofiles")

Expand Down
2 changes: 2 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# C++ apps
add_subdirectory(avAudioPhaseMeter)
add_subdirectory(avInfo)
add_subdirectory(avMeta)
add_subdirectory(avPlayer)
add_subdirectory(avProcessor)
add_subdirectory(customEncoder)

# Python apps
add_subdirectory(pyProcessor)
Expand Down
24 changes: 24 additions & 0 deletions app/avAudioPhaseMeter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### cpp/avProcessor

# Load custom cmake utilities
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(AvTranscoderMacros)

# Build app
add_executable(avaudiophasemeter avAudioPhaseMeter.cpp)
set_target_properties(avaudiophasemeter PROPERTIES VERSION ${AVTRANSCODER_VERSION})
target_link_libraries(avaudiophasemeter avtranscoder-shared)

# Install app
if(WIN32)
set(BINARY_FILES "${CMAKE_CURRENT_BINARY_DIR}/avaudiophasemeter.exe")
else()
set(BINARY_FILES "${CMAKE_CURRENT_BINARY_DIR}/avaudiophasemeter" "${CMAKE_CURRENT_BINARY_DIR}/avaudiophasemeter-${AVTRANSCODER_VERSION}")
endif()

install(
FILES ${BINARY_FILES}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
DESTINATION "bin/"
OPTIONAL
)
141 changes: 141 additions & 0 deletions app/avAudioPhaseMeter/avAudioPhaseMeter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#include <AvTranscoder/transcoder/Transcoder.hpp>
#include <AvTranscoder/file/OutputFile.hpp>
#include <AvTranscoder/progress/ConsoleProgress.hpp>

#include <iostream>
#include <iomanip>
#include <vector>
#include <fstream>
#include <sstream>
#include <cstdlib>

std::vector<avtranscoder::InputStreamDesc> parseConfigFile(const std::string& configFilename)
{
std::vector<avtranscoder::InputStreamDesc> result;

std::ifstream configFile(configFilename.c_str(), std::ifstream::in);

std::string line;
size_t countLines = 0;
while(std::getline(configFile, line))
{
if(++countLines > 2)
throw std::runtime_error("Audio phase analysis can only be done on a stereo pair, i.e. two channels (see usage).");

std::istringstream is_line(line);
std::string filename;
if(std::getline(is_line, filename, '='))
{
std::string stream;
std::getline(is_line, stream);

std::stringstream ss(stream);
size_t streamIndex = 0;
char separator;
int channelIndex = -1;
ss >> streamIndex;
ss >> separator;
if(separator == '.')
ss >> channelIndex;

bool newInputDescAdded = false;
// if we already have an input description with the same filename/streamIndex, add only the new channelIndex
for(std::vector<avtranscoder::InputStreamDesc>::iterator it = result.begin(); it != result.end(); ++it)
{
if(it->_filename == filename && it->_streamIndex == streamIndex)
{
it->_channelIndexArray.push_back(channelIndex);
newInputDescAdded = true;
break;
}
}
if(! newInputDescAdded)
result.push_back(avtranscoder::InputStreamDesc(filename, streamIndex, channelIndex));
}
}

configFile.close();

return result;
}

void displayUsage(const std::string& program)
{
std::cout << "Usage: " << program << " CONFIG OUTPUT [OPTIONS]" << std::endl << std::endl;
std::cout << "\tCONFIG: input configuration file" << std::endl;
std::cout << "\t\tEach line represents one audio stream analysed." << std::endl;
std::cout << "\t\tPattern of each line is:" << std::endl;
std::cout << "\t\t[inputFile]=STREAM_INDEX.CHANNEL_INDEX" << std::endl;
std::cout << "\t\tWARNING: audio phase analyser only support stereo layout, i.e. two lines in this configuration." << std::endl << std::endl;
std::cout << "\tOUTPUT: metadata output file" << std::endl;
std::cout << "\t\tPattern for each frame is:" << std::endl;
std::cout << "\t\t `frame:[FRAME_ID] pts:[PTS] pts_time:[PTS_TIME]" << std::endl;
std::cout << "\t\t lavfi.aphasemeter.phase=[PHASE_VALUE]`" << std::endl << std::endl;
std::cout << "\tOPTIONS:" << std::endl;
std::cout << "\t\t--info set log level to AV_LOG_INFO" << std::endl;
std::cout << "\t\t--debug set log level to AV_LOG_DEBUG" << std::endl;
std::cout << "\t\t--help display this help" << std::endl << std::endl;
}

int main(int argc, char** argv)
{
// Preload FFmpeg context
avtranscoder::preloadCodecsAndFormats();
avtranscoder::Logger::setLogLevel(AV_LOG_QUIET);

if(argc < 3) {
displayUsage(argv[0]);
}

// List command line arguments
std::vector<std::string> arguments;
for(int argument = 1; argument < argc; ++argument)
{
arguments.push_back(argv[argument]);
}
for(size_t argument = 0; argument < arguments.size(); ++argument)
{
if(arguments.at(argument) == "--help")
{
displayUsage(argv[0]);
return 0;
}
else if(arguments.at(argument) == "--debug")
{
avtranscoder::Logger::setLogLevel(AV_LOG_DEBUG);
}
else if(arguments.at(argument) == "--info")
{
avtranscoder::Logger::setLogLevel(AV_LOG_INFO);
}
}

try
{
std::string configFilePath(arguments.at(0));
std::string outputFilePath(arguments.at(1));
std::vector<avtranscoder::InputStreamDesc> inputStreamsToAnalyse = parseConfigFile(configFilePath);

avtranscoder::OutputFile outputFile(outputFilePath, "null"); // the output file will be overwritten by the extracted metadata

avtranscoder::Transcoder transcoder(outputFile);
transcoder.setProcessMethod(avtranscoder::eProcessMethodBasedOnStream, 0);
transcoder.addStream(inputStreamsToAnalyse);

avtranscoder::StreamTranscoder& streamTranscoder = transcoder.getStreamTranscoder(0);
avtranscoder::FilterGraph* filterGraph = streamTranscoder.getFilterGraph();
filterGraph->addFilter("aphasemeter", "video=0");
filterGraph->addFilter("ametadata", "mode=print:file=" + outputFilePath);

avtranscoder::ConsoleProgress progress;
transcoder.process(progress);
}
catch(std::exception& e)
{
std::cerr << "ERROR: during process, an error occured: " << e.what() << std::endl;
}
catch(...)
{
std::cerr << "ERROR: during process, an unknown error occured" << std::endl;
}
}
24 changes: 24 additions & 0 deletions app/customEncoder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### cpp/customEncoder

# Load custom cmake utilities
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(AvTranscoderMacros)

# Build app
add_executable(custom-encoder customEncoder.cpp)
set_target_properties(custom-encoder PROPERTIES VERSION ${AVTRANSCODER_VERSION})
target_link_libraries(custom-encoder avtranscoder-shared)

# Install app
if(WIN32)
set(BINARY_FILES "${CMAKE_CURRENT_BINARY_DIR}/custom-encoder.exe")
else()
set(BINARY_FILES "${CMAKE_CURRENT_BINARY_DIR}/custom-encoder" "${CMAKE_CURRENT_BINARY_DIR}/custom-encoder-${AVTRANSCODER_VERSION}")
endif()

install(
FILES ${BINARY_FILES}
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE
DESTINATION "bin/"
OPTIONAL
)
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy