File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed
src/AvTranscoder/properties Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -373,24 +373,28 @@ size_t VideoProperties::getNbFrames() const
373
373
{
374
374
if (!_formatContext)
375
375
throw std::runtime_error (" unknown format context" );
376
+
376
377
size_t nbFrames = _formatContext->streams [_streamIndex]->nb_frames ;
377
- if (nbFrames == 0 )
378
- {
379
- if (_levelAnalysis == eAnalyseLevelFull && _nbFrames)
380
- return _nbFrames;
378
+ if (nbFrames)
379
+ return nbFrames;
380
+ LOG_WARN ( " The number of frames of the stream ' " << _streamIndex << " ' of file ' " << _formatContext-> filename
381
+ << " ' is unknown. " )
381
382
382
- LOG_WARN (" The number of frames in the stream '" << _streamIndex << " ' of file '" << _formatContext->filename
383
- << " ' is unknown." )
384
- const float duration = getDuration ();
385
- if (duration != 0 )
383
+ if (_levelAnalysis == eAnalyseLevelHeader)
384
+ {
385
+ LOG_INFO (" Need a deeper analysis: see eAnalyseLevelFirstGop." )
386
+ return 0 ;
387
+ }
388
+ else
389
+ {
390
+ if (! _nbFrames)
386
391
{
387
- LOG_INFO (" Try to compute the number of frames from the fps and the duration." )
388
- nbFrames = getFps () * duration ;
392
+ LOG_INFO (" Estimate the number of frames from the fps and the duration." )
393
+ return getFps () * getDuration () ;
389
394
}
390
- else
391
- return 0 ;
395
+ LOG_INFO ( " Get the exact number of frames. " )
396
+ return _nbFrames ;
392
397
}
393
- return nbFrames;
394
398
}
395
399
396
400
size_t VideoProperties::getTicksPerFrame () const
You can’t perform that action at this time.
0 commit comments