File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 3
3
4
4
#define AVTRANSCODER_VERSION_MAJOR 0
5
5
#define AVTRANSCODER_VERSION_MINOR 11
6
- #define AVTRANSCODER_VERSION_MICRO 1
6
+ #define AVTRANSCODER_VERSION_MICRO 2
7
7
8
8
#include < AvTranscoder/system.hpp>
9
9
Original file line number Diff line number Diff line change @@ -432,7 +432,12 @@ int VideoProperties::getLevel() const
432
432
433
433
float VideoProperties::getFps () const
434
434
{
435
- return av_q2d (_formatContext->streams [_streamIndex]->avg_frame_rate );
435
+ if (! _formatContext)
436
+ throw std::runtime_error (" unknown format context" );
437
+
438
+ if (_formatContext->streams [_streamIndex]->avg_frame_rate .den )
439
+ return av_q2d (_formatContext->streams [_streamIndex]->avg_frame_rate );
440
+ return av_q2d (av_inv_q (getTimeBase ()));
436
441
}
437
442
438
443
float VideoProperties::getDuration () const
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ class AvExport VideoProperties : public StreamProperties
64
64
65
65
/* *
66
66
* @brief Corresponds to the 'fps' returned by ffprobe.
67
+ * @note If the average framerate is not defined in the format, return the tbn.
67
68
* fps = the average framerate that has come from the AVStream
68
69
* tbn = the time base in AVStream that has come from the AVStream
69
70
* tbc = the time base in AVCodecContext for the codec used for a particular stream
You can’t perform that action at this time.
0 commit comments