diff --git a/src/AvTranscoder/properties/VideoProperties.cpp b/src/AvTranscoder/properties/VideoProperties.cpp index 9d8e2378..97b8f4e1 100644 --- a/src/AvTranscoder/properties/VideoProperties.cpp +++ b/src/AvTranscoder/properties/VideoProperties.cpp @@ -432,7 +432,12 @@ int VideoProperties::getLevel() const float VideoProperties::getFps() const { - return av_q2d(_formatContext->streams[_streamIndex]->avg_frame_rate); + if(! _formatContext) + throw std::runtime_error("unknown format context"); + + if(_formatContext->streams[_streamIndex]->avg_frame_rate.den) + return av_q2d(_formatContext->streams[_streamIndex]->avg_frame_rate); + return av_q2d(av_inv_q(getTimeBase())); } float VideoProperties::getDuration() const diff --git a/src/AvTranscoder/properties/VideoProperties.hpp b/src/AvTranscoder/properties/VideoProperties.hpp index a5a2c9a6..27b6d0c5 100644 --- a/src/AvTranscoder/properties/VideoProperties.hpp +++ b/src/AvTranscoder/properties/VideoProperties.hpp @@ -64,6 +64,7 @@ class AvExport VideoProperties : public StreamProperties /** * @brief Corresponds to the 'fps' returned by ffprobe. + * @note If the average framerate is not defined in the format, return the tbn. * fps = the average framerate that has come from the AVStream * tbn = the time base in AVStream that has come from the AVStream * tbc = the time base in AVCodecContext for the codec used for a particular stream 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