imageReader reads all but two frames when attempting to read all frames of a video, regardless of the video length. I'm not yet sure which frames are not being read.
OS: NixOS 20.03
ffmpeg version: 3.4.7
Things I would like to try but haven't yet: other OSes, other ffmpeg versions, other video types, and making a short video with numbered frames so I can save the images and see which frames are dropped.
Steps to Reproduce
Make sure you have the following packages installed: ffmpeg-light, JuicyPixels, monad-loops.
- Make DroppedFrames.hs and add the following:
import Codec.FFmpeg
import Codec.Picture
import Control.Monad.Loops
import Data.Maybe
readAllFrames :: IO Int
readAllFrames = do
initFFmpeg
setLogLevel avLogTrace
(reader, cleanup) <- imageReader (File "pulse.mov") :: IO (IO (Maybe (Image PixelRGB8)), IO ())
frames <- unfoldM reader
return $ length frames
- Generate
pulse.mov, either by building the demo application and running with no arguments, or loading /demo/Main.hs in ghci and running testEncode.
- Run
ffmpeg -i pulse.mov -map 0:v:0 -c copy -f null -, and in the second to last line of output you'll see frame= 600, indicating that this video has 600 frames.
- Load DroppedFrames.hs in ghci and run
readAllFrames. The output is 598, indicating imageReader only got 598 frames out of this video.
Here's a gist with the output of ffmpeg and readAllFrames with log level set to trace: https://gist.github.com/burkaman/0bb1e18b6769eed13cdf521c240222c4
imageReaderreads all but two frames when attempting to read all frames of a video, regardless of the video length. I'm not yet sure which frames are not being read.OS: NixOS 20.03
ffmpeg version: 3.4.7
Things I would like to try but haven't yet: other OSes, other ffmpeg versions, other video types, and making a short video with numbered frames so I can save the images and see which frames are dropped.
Steps to Reproduce
Make sure you have the following packages installed:
ffmpeg-light,JuicyPixels,monad-loops.pulse.mov, either by building the demo application and running with no arguments, or loading /demo/Main.hs in ghci and runningtestEncode.ffmpeg -i pulse.mov -map 0:v:0 -c copy -f null -, and in the second to last line of output you'll seeframe= 600, indicating that this video has 600 frames.readAllFrames. The output is 598, indicatingimageReaderonly got 598 frames out of this video.Here's a gist with the output of
ffmpegandreadAllFrameswith log level set to trace: https://gist.github.com/burkaman/0bb1e18b6769eed13cdf521c240222c4