File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
src/AvTranscoder/properties Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -473,8 +473,12 @@ float VideoProperties::getDuration() const
473
473
LOG_WARN (" The duration of the stream '" << _streamIndex << " ' of file '" << _formatContext->filename << " ' is unknown." )
474
474
if (_fileProperties->isRawFormat ())
475
475
{
476
- LOG_INFO (" Get the file size to compute the duration." )
477
- return _fileProperties->getFileSize () / getBitRate () * 8 ;
476
+ const size_t bitRate = getBitRate ();
477
+ if (bitRate)
478
+ {
479
+ LOG_INFO (" Get the file size to compute the duration." )
480
+ return _fileProperties->getFileSize () / bitRate * 8 ;
481
+ }
478
482
}
479
483
return 0 ;
480
484
}
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class AvExport VideoProperties : public StreamProperties
40
40
Rational getSar () const ; // sample/pixel aspect ratio
41
41
Rational getDar () const ; // display aspect ratio
42
42
43
- size_t getBitRate () const ; // /< in bits/s
43
+ size_t getBitRate () const ; // /< in bits/s, 0 if unknown
44
44
size_t getMaxBitRate () const ;
45
45
size_t getMinBitRate () const ;
46
46
size_t getNbFrames () const ; // /< 0 if unknown
You can’t perform that action at this time.
0 commit comments