mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Fix a few cases where ffmpeg produces no output (#3161)
* Treat no output from ffmpeg as an error condition * Distinguish file vs. video duration, and use later where appropriate * Check for empty file in generateFile Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
@@ -43,8 +43,8 @@ func (g *generatorInfo) calculateFrameRate(videoStream *ffmpeg.FFProbeStream) er
|
||||
|
||||
numberOfFrames, _ := strconv.Atoi(videoStream.NbFrames)
|
||||
|
||||
if numberOfFrames == 0 && isValidFloat64(framerate) && g.VideoFile.Duration > 0 { // TODO: test
|
||||
numberOfFrames = int(framerate * g.VideoFile.Duration)
|
||||
if numberOfFrames == 0 && isValidFloat64(framerate) && g.VideoFile.VideoStreamDuration > 0 { // TODO: test
|
||||
numberOfFrames = int(framerate * g.VideoFile.VideoStreamDuration)
|
||||
}
|
||||
|
||||
// If we are missing the frame count or frame rate then seek through the file and extract the info with regex
|
||||
@@ -68,7 +68,7 @@ func (g *generatorInfo) calculateFrameRate(videoStream *ffmpeg.FFProbeStream) er
|
||||
"number of frames or framerate is 0. nb_frames <%s> framerate <%f> duration <%f>",
|
||||
videoStream.NbFrames,
|
||||
framerate,
|
||||
g.VideoFile.Duration,
|
||||
g.VideoFile.VideoStreamDuration,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user