JuliaIO / VideoIO.jl

Reading and writing of video files in Julia via ffmpeg
https://juliaio.github.io/VideoIO.jl/stable
Other
126 stars 53 forks source link

Add iterator interface to VideoReader objects #261

Closed galenlynch closed 4 years ago

galenlynch commented 4 years ago

I have added an iterator interface to the VideoReader type, making collecting all frames of a video as simple as:

f = openvideo(fname)
imgs = collect(f)

The iterator returns a new array for each frame, as I think mutating the same array on subsequent calls to iterate would be surprising and lead to strange behavior when calling functions such as collect. Note that the VideoReader iterator is mutable, like Channel or Stateful iterators in Julia, and will resume iteration where it was last stopped, instead of at the beginning. I have added some text in the documentation explaining this behavior, and also added some tests.

galenlynch commented 4 years ago

I'm confused by these testing errors.

codecov[bot] commented 4 years ago

Codecov Report

Merging #261 into master will decrease coverage by 3.19%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #261      +/-   ##
==========================================
- Coverage   77.13%   73.94%   -3.20%     
==========================================
  Files          14       14              
  Lines         608      614       +6     
==========================================
- Hits          469      454      -15     
- Misses        139      160      +21     
Impacted Files Coverage Δ
src/VideoIO.jl 52.27% <ø> (ø)
src/avio.jl 73.80% <100.00%> (-5.36%) :arrow_down:
src/util.jl 59.25% <0.00%> (-11.12%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0f211c2...0bea443. Read the comment docs.

IanButterworth commented 4 years ago

Looks good now. Shall we merge?

galenlynch commented 4 years ago

Fine by me!