Skip to content

MIK fork: up to v0.5.6 #139

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

Merged
merged 62 commits into from
Apr 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
434b31c
StreamTranscoder: add private functions to check the current processi…
Apr 21, 2015
8da8549
StreamTranscoder: fix preProcessCodecLatency on rewrap cases
Apr 21, 2015
df5231e
StreamTranscoder: clean call of processTranscode
Apr 21, 2015
382f9be
StreamTranscoder: set _generator when instanciate a generator process…
Apr 21, 2015
9e0c942
OutputStream: fix getStreamDuration (use av_stream_get_end_pts)
Apr 21, 2015
05a6237
mediaProperty: get timeBase and duration from base class
Apr 21, 2015
108b7df
Move InputFile::seek to FormatContext::seek
Apr 21, 2015
f041f8c
FileProperties: keep a FormatContext pointer as attribute
Apr 21, 2015
bbbd56e
FileProperties: add extractStreamProperties
Apr 22, 2015
5a64fbc
FilePorperties: clearStreamProperties is private
Apr 22, 2015
44595a0
FileProperties: only access to const list of properties
Apr 22, 2015
cdb849f
FileProperties: add array of properties per stream (of all types)
Apr 22, 2015
4866e54
InputStream: getDuration from the stream
Apr 21, 2015
24a375a
mediaProperty: getMetadatas is a const function
Apr 22, 2015
f92f917
Transcoder: clean addTranscodeStream when get profile from InputFile
Apr 22, 2015
1976816
Transcoder: can use offset on rewrap
Apr 20, 2015
194b8b6
AudioGenerator: fix decodeNextFrame with a subStreamIndex
Apr 22, 2015
36a1fa9
Transcode: add log
Apr 20, 2015
32d99fd
Merge pull request #166 from cchampet/fix_inputDuration
valnoel Apr 22, 2015
9cfa8f8
Merge branch 'develop' of https://github.com/mikrosimage/avTranscoder…
Apr 22, 2015
1443a1a
FormatContext: add flag parameter to the seek function
Apr 22, 2015
3ed4962
Merge pull request #167 from cchampet/dev_ManageOffsetOnRewrap
valnoel Apr 22, 2015
ad248ae
pythumbnail app: seek at time can be a float value
Apr 22, 2015
421ff0a
Transcoder: a negative offset implies to seek in the InputFile
Apr 22, 2015
65a9b6c
Transcoder: show progress bar before stopping the process if outputDu…
Apr 22, 2015
0bc0100
Transcoder: process frame after checking duration
Apr 22, 2015
77b7857
Transcoder: fix when stopping the process if outputDuration has exceeded
Apr 22, 2015
da7b5f2
StreamTranscoder: clean processFrame
Apr 22, 2015
9e5810a
OutputFile: add log
Apr 22, 2015
3198fd1
pyTest: add tests to check offset
Apr 20, 2015
6c2337d
pyTest: add tests to check eProcessMethods
Apr 20, 2015
89cd3db
pyTest: rename testTranscoderOffset to testOffset
Apr 22, 2015
7ffd72a
pyTest: rename testTranscoderNbFrames/Samples to testNbFrames/Samples
Apr 22, 2015
e5135c6
mediaProperty: fix metadata were loaded twice for video/audio properties
Apr 23, 2015
466d556
Merge pull request #173 from cchampet/fix_mediaPropertyMetadataInDouble
valnoel Apr 23, 2015
5be6776
Merge pull request #168 from cchampet/dev_cleanSeek
valnoel Apr 23, 2015
6ddfb4a
Merge pull request #169 from cchampet/dev_ManageNegativeOffset
valnoel Apr 23, 2015
ea42b10
Profiles: add dnxhd175x
Apr 23, 2015
456cbf4
Profiles: add dnxhd36
Apr 23, 2015
ec74aa3
Travis: update privileges of tool scripts
Apr 23, 2015
7282c97
Travis: rename install directory
Apr 23, 2015
b4d17c7
OutputFile: symmetry between beginWrap & endWrap
Apr 24, 2015
2fd9834
FormatContext: add AVDictionary parameter in constructor
Apr 24, 2015
6f7f62d
FormatContext: load options specific to the format when demuxing
Apr 24, 2015
141139f
FormatContext: load options specific to the format when muxing
Apr 24, 2015
dd967cc
CMake: add coverage flag with CMake option AVTRANSCODER_COVERAGE
Apr 23, 2015
8811fce
Travis: install & use lcov with coveralls
Apr 23, 2015
104556f
INSTALL.md: add command to install avtranscoder devel version
Apr 23, 2015
bc38387
README.md: add coverage status badge
Apr 23, 2015
170a9d6
README.md: remove drone.io badge
Apr 23, 2015
a7828d7
README.md: move other badges to the top of the file
Apr 23, 2015
959644b
Travis: fix capture coverage with nosetests option
Apr 24, 2015
1e5025e
Travis: fix launch pyTest if depend on ffmpeg
Apr 24, 2015
e930a74
Travis: build by using several cores
Apr 24, 2015
a700ea3
Travis: install & generate coverage only with gcc compiler
Apr 27, 2015
73bb106
Merge pull request #175 from cchampet/dev_coveralls
valnoel Apr 27, 2015
5c6a6de
Merge pull request #174 from cchampet/add_presetdnxhd
valnoel Apr 27, 2015
1cc630c
Merge pull request #176 from cchampet/fix_FormatContextOptions
valnoel Apr 27, 2015
48d71ec
Up to v0.5.6
Apr 27, 2015
a786476
hotfix: load private FormatContext options only when it's possible
Apr 27, 2015
2a17606
hotfix Travis: fix launch of pyTest
Apr 28, 2015
6323892
hotfix: FileProperties::_streams is filled after the specific streams…
valnoel Apr 30, 2015
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
32 changes: 22 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
env:
global:
- AVTRANSCODER_BUILD=${TRAVIS_BUILD_DIR}/build
- AVTRANSCODER_INSTALL=${TRAVIS_BUILD_DIR}/install
- J='-j3'
matrix:
- DEPENDENCY_MODE=libav
- DEPENDENCY_MODE=ffmpeg
Expand All @@ -18,19 +22,27 @@ before_script:
- date -u
- uname -a

- chmod +x tools/travis.linux.install.deps.sh
- chmod +x tools/travis.osx.install.deps.sh

- cd ${TRAVIS_BUILD_DIR}

# install coverage tools
- ./tools/travis.gcc.install.coverage.sh

# install avtranscoder dependencies
- if [ "${TRAVIS_OS_NAME}" = "linux" ]; then ./tools/travis.linux.install.deps.sh; fi
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then ./tools/travis.osx.install.deps.sh; fi

script:
# Build
- mkdir build
- cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=`pwd`/dist
- make install
- mkdir -p ${AVTRANSCODER_BUILD}
- cd ${AVTRANSCODER_BUILD}
- cmake .. -DCMAKE_INSTALL_PREFIX=${AVTRANSCODER_INSTALL} -DCMAKE_BUILD_TYPE=Release -DAVTRANSCODER_PYTHON_VERSION_OF_BINDING=2.7 -DAVTRANSCODER_COVERAGE=True
- make $J install

# Launch tests
- cd ..
- chmod +x tools/travis.python.nosetests.sh
- if [ "${TRAVIS_OS_NAME}" = "linux" && "${DEPENDENCY_MODE}" = "ffmpeg" ]; then ./tools/travis.python.nosetests.sh; fi
- if [ "${DEPENDENCY_MODE}" = "ffmpeg" ]; then ./../tools/travis.python.nosetests.sh; fi

after_success:
- cd ${TRAVIS_BUILD_DIR}

# generate coverage for coveralls
- if [ "${CC}" = "gcc" ]; then ./tools/travis.gcc.generate.coverage.sh; fi
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ project(AvTranscoder)
# Set AvTranscoder versions
set(AVTRANSCODER_VERSION_MAJOR "0")
set(AVTRANSCODER_VERSION_MINOR "5")
set(AVTRANSCODER_VERSION_MICRO "5")
set(AVTRANSCODER_VERSION_MICRO "6")
set(AVTRANSCODER_VERSION ${AVTRANSCODER_VERSION_MAJOR}.${AVTRANSCODER_VERSION_MINOR}.${AVTRANSCODER_VERSION_MICRO})

# Define AvTranscoder versions
Expand All @@ -28,6 +28,10 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC -O3")
endif()

# CPP flag to create code coverage report
if(AVTRANSCODER_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
endif()

add_subdirectory(src)

Expand Down
11 changes: 11 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,29 @@ cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install
```
cmake .. -DCMAKE_BUILD_TYPE=Release/Debug
```
###### To build python binding with a specific python version
```
cmake .. -DAVTRANSCODER_PYTHON_VERSION_OF_BINDING=2.7
```

#### Mac OSX using homebrew

###### Install homebrew
http://brew.sh/

###### Install avTranscoder
Last stable version:
```
brew tap cbenhagen/video
brew install avtranscoder
```

From develop branch:
```
brew tap cbenhagen/video
brew install avtranscoder --devel
```

###### Use homebrew to install only dependencies
```
brew deps avtranscoder
Expand Down
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ C++ API for Libav / FFmpeg

Based on Libav/FFmpeg libraries to support various video and audio formats, avTranscoder provides the high level API to re-wrap or transcode media easily.

[![Build Status](https://travis-ci.org/avTranscoder/avTranscoder.svg?branch=master)](https://travis-ci.org/avTranscoder/avTranscoder)
[![Coverage Status](https://coveralls.io/repos/avTranscoder/avTranscoder/badge.svg)](https://coveralls.io/r/avTranscoder/avTranscoder)
<a href="https://scan.coverity.com/projects/2626"><img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/2626/badge.svg"/></a>

#### What you need to know
* C++ library
* Java and Python bindings generated with SWIG
Expand Down Expand Up @@ -47,20 +51,6 @@ avProfileType=avProfileTypeAudio
codec=codecName
```

#### Continuous Integration

###### Drone.io
[![Build Status](https://drone.io/github.com/avTranscoder/avTranscoder/status.png)](https://drone.io/github.com/avTranscoder/avTranscoder/latest)

###### Travis
[![Build Status](https://travis-ci.org/avTranscoder/avTranscoder.svg?branch=master)](https://travis-ci.org/avTranscoder/avTranscoder)

###### Coverity Scan
<a href="https://scan.coverity.com/projects/2626">
<img alt="Coverity Scan Build Status"
src="https://scan.coverity.com/projects/2626/badge.svg"/>
</a>

#### Tests

###### nosetests
Expand Down
2 changes: 1 addition & 1 deletion app/pyThumbnail/pythumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
parser.add_argument('inputFileName', help='It could be any media file with at least one video stream (video, image...). Support file without extension.')
# options
parser.add_argument("-o", "--outputFile", dest="outputFileName", default="thumbnail.jpg", help="Set the output filename (thumbnail.jpg by default). Must be with jpg extension!")
parser.add_argument("-t", "--time", dest="time", type=int, default=0, help="Set time (in seconds) of where to seek in the video stream to generate the thumbnail (0 by default).")
parser.add_argument("-t", "--time", dest="time", type=float, default=0, help="Set time (in seconds) of where to seek in the video stream to generate the thumbnail (0 by default).")
parser.add_argument("-f", "--frame", dest="frame", type=int, default=0, help="Set time (in frames) of where to seek in the video stream to generate the thumbnail (0 by default). Warning: priority to frame if user indicates both frame and time!")
parser.add_argument("-w", "--width", dest="width", type=int, default=0, help="Override the width of the thumbnail (same as input by default).")
parser.add_argument("-he", "--height", dest="height", type=int, default=0, help="Override the height of the thumbnail (same as input by default).")
Expand Down
10 changes: 10 additions & 0 deletions ressource/v_dnxhd175x.prf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
avProfileName=dnxhd175x
avProfileLongName=DNxHD 175Mbps 10bits 1920x1080 25fps
avProfileType=avProfileTypeVideo
codec=dnxhd
width=1920
height=1080
pix_fmt=yuv422p10le
b=175M
g=1
r=25
10 changes: 10 additions & 0 deletions ressource/v_dnxhd36.prf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
avProfileName=dnxhd36
avProfileLongName=DNxHD 36Mbps 8bits 1920x1080 25fps
avProfileType=avProfileTypeVideo
codec=dnxhd
width=1920
height=1080
pix_fmt=yuv422p
b=36M
g=1
r=25
2 changes: 1 addition & 1 deletion src/AvTranscoder/decoder/AudioGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool AudioGenerator::decodeNextFrame( Frame& frameBuffer )

bool AudioGenerator::decodeNextFrame( Frame& frameBuffer, const size_t subStreamIndex )
{
return false;
return decodeNextFrame( frameBuffer );
}

}
24 changes: 22 additions & 2 deletions src/AvTranscoder/file/FormatContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
namespace avtranscoder
{

FormatContext::FormatContext( const std::string& filename, int req_flags )
FormatContext::FormatContext( const std::string& filename, int req_flags, AVDictionary** options )
: _avFormatContext( NULL )
, _flags( req_flags )
, _options()
, _isOpen( false )
{
int ret = avformat_open_input( &_avFormatContext, filename.c_str(), NULL, NULL );
int ret = avformat_open_input( &_avFormatContext, filename.c_str(), NULL, options );
if( ret < 0 )
{
std::string msg = "unable to open file ";
Expand All @@ -21,11 +22,16 @@ FormatContext::FormatContext( const std::string& filename, int req_flags )
throw std::ios_base::failure( msg );
}
_isOpen = true;

loadOptions( _options, _avFormatContext, req_flags );
// when demuxing, priv_data of AVFormatContext is set by avformat_open_input()
if( _avFormatContext->iformat->priv_class )
loadOptions( _options, _avFormatContext->priv_data, req_flags );
}

FormatContext::FormatContext( int req_flags )
: _avFormatContext( NULL )
, _flags( req_flags )
, _options()
, _isOpen( false )
{
Expand Down Expand Up @@ -85,6 +91,9 @@ void FormatContext::writeHeader( AVDictionary** options )
{
throw std::runtime_error( "could not write header: " + getDescriptionFromErrorCode( ret ) );
}
// when muxing, priv_data of AVFormatContext is set by avformat_write_header()
if( _avFormatContext->oformat->priv_class )
loadOptions( _options, _avFormatContext->priv_data, _flags );
}

void FormatContext::writeFrame( AVPacket& packet, bool interleaved )
Expand Down Expand Up @@ -133,6 +142,17 @@ AVStream& FormatContext::addAVStream( const AVCodec& avCodec )
return *stream;
}

void FormatContext::seek( uint64_t position, const int flag )
{
if( (int)getStartTime() != AV_NOPTS_VALUE )
position += getStartTime();

if( av_seek_frame( _avFormatContext, -1, position, flag ) < 0 )
{
LOG_ERROR( "Error when seek at " << position << " (in AV_TIME_BASE units) in file" )
}
}

std::vector<Option> FormatContext::getOptions()
{
std::vector<Option> optionsArray;
Expand Down
27 changes: 24 additions & 3 deletions src/AvTranscoder/file/FormatContext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ class AvExport FormatContext
FormatContext& operator=( const FormatContext& formatContext );

public:
FormatContext( const std::string& filename, int req_flags = 0 ); ///< Allocate an AVFormatContext by opening an input file
FormatContext( int req_flags = 0 ); ///< Allocate an AVFormatContext with default values
/**
* @brief Allocate an AVFormatContext by opening an input file
*/
FormatContext( const std::string& filename, int req_flags = 0, AVDictionary** options = NULL );

/**
* @brief Allocate an AVFormatContext with default values
*/
FormatContext( int req_flags = 0 );

~FormatContext();

/**
Expand All @@ -43,7 +51,11 @@ class AvExport FormatContext
*/
void closeRessource();

void writeHeader( AVDictionary** options = NULL ); ///< Write the stream header to an output media file
/**
* @brief Write the stream header to an output media file
* @note Also load options specific to the output format
*/
void writeHeader( AVDictionary** options = NULL );

/**
* @brief Write a packet to an output media file
Expand All @@ -61,6 +73,14 @@ class AvExport FormatContext
void addMetaData( const std::string& key, const std::string& value );
AVStream& addAVStream( const AVCodec& avCodec );

/**
* @brief Seek at a specific position
* @param position: can be in AV_TIME_BASE units, in frames... depending on the flag value
* @param flag: seeking mode (AVSEEK_FLAG_xxx)
* @note before seek, add offset of start time
*/
void seek( uint64_t position, const int flag );

size_t getNbStreams() const { return _avFormatContext->nb_streams; }
/// Get duration of the program, in seconds
size_t getDuration() const { return _avFormatContext->duration; }
Expand Down Expand Up @@ -90,6 +110,7 @@ class AvExport FormatContext

private:
AVFormatContext* _avFormatContext; ///< Has ownership
const int _flags; ///< Flags with which the options are loaded (see AV_OPT_FLAG_xxx)
OptionMap _options;
bool _isOpen; ///< Is the AVFormatContext open (in constructor with a filename)
};
Expand Down
80 changes: 3 additions & 77 deletions src/AvTranscoder/file/InputFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <AvTranscoder/mediaProperty/SubtitleProperties.hpp>
#include <AvTranscoder/mediaProperty/AttachementProperties.hpp>
#include <AvTranscoder/mediaProperty/UnknownProperties.hpp>
#include <AvTranscoder/progress/NoDisplayProgress.hpp>

extern "C" {
#include <libavcodec/avcodec.h>
Expand All @@ -29,10 +28,6 @@ InputFile::InputFile( const std::string& filename )
{
_formatContext.findStreamInfo();

// Analyse header
NoDisplayProgress p;
analyse( p, eAnalyseLevelHeader );

// Create streams
for( size_t streamIndex = 0; streamIndex < _formatContext.getNbStreams(); ++streamIndex )
{
Expand All @@ -50,60 +45,7 @@ InputFile::~InputFile()

void InputFile::analyse( IProgress& progress, const EAnalyseLevel level )
{
_properties.clearStreamProperties();

if( level > eAnalyseLevelHeader )
seekAtFrame( 0 );

for( size_t streamIndex = 0; streamIndex < _formatContext.getNbStreams(); streamIndex++ )
{
switch( _formatContext.getAVStream( streamIndex ).codec->codec_type )
{
case AVMEDIA_TYPE_VIDEO:
{
VideoProperties properties( _formatContext, streamIndex, progress, level );
_properties.getVideoProperties().push_back( properties );
break;
}
case AVMEDIA_TYPE_AUDIO:
{
AudioProperties properties( _formatContext, streamIndex );
_properties.getAudioProperties().push_back( properties );
break;
}
case AVMEDIA_TYPE_DATA:
{
DataProperties properties( _formatContext, streamIndex );
_properties.getDataProperties().push_back( properties );
break;
}
case AVMEDIA_TYPE_SUBTITLE:
{
SubtitleProperties properties( _formatContext, streamIndex );
_properties.getSubtitleProperties().push_back( properties );
break;
}
case AVMEDIA_TYPE_ATTACHMENT:
{
AttachementProperties properties( _formatContext, streamIndex );
_properties.getAttachementProperties().push_back( properties );
break;
}
case AVMEDIA_TYPE_UNKNOWN:
{
UnknownProperties properties( _formatContext, streamIndex );
_properties.getUnknownPropertiesProperties().push_back( properties );
break;
}
case AVMEDIA_TYPE_NB:
{
break;
}
}
}

if( level > eAnalyseLevelHeader )
seekAtFrame( 0 );
_properties.extractStreamProperties( progress, level );
}

FileProperties InputFile::analyseFile( const std::string& filename, IProgress& progress, const EAnalyseLevel level )
Expand Down Expand Up @@ -144,29 +86,13 @@ bool InputFile::readNextPacket( CodedData& data, const size_t streamIndex )
void InputFile::seekAtFrame( const size_t frame )
{
uint64_t position = frame / getFps() * AV_TIME_BASE;
seek( position );
_formatContext.seek( position, AVSEEK_FLAG_BACKWARD );
}

void InputFile::seekAtTime( const double time )
{
uint64_t position = time * AV_TIME_BASE;
seek( position );
}

void InputFile::seek( uint64_t position )
{
if( (int)_formatContext.getStartTime() != AV_NOPTS_VALUE )
position += _formatContext.getStartTime();

if( av_seek_frame( &_formatContext.getAVFormatContext(), -1, position, AVSEEK_FLAG_BACKWARD ) < 0 )
{
LOG_ERROR( "Error when seek at " << position << " (in AV_TIME_BASE units) in file" )
}

for( std::vector<InputStream*>::iterator it = _inputStreams.begin(); it != _inputStreams.end(); ++it )
{
(*it)->clearBuffering();
}
_formatContext.seek( position, AVSEEK_FLAG_BACKWARD );
}

void InputFile::activateStream( const size_t streamIndex, bool activate )
Expand Down
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