Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop v0.6 support #124

Merged
merged 13 commits into from
Aug 28, 2018
22 changes: 14 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@ addons:
- libavutil-extra-52
- libswscale2
- libgtk-3-dev
- zlib1g-dev
os:
- linux
# - osx
julia:
- 0.6
- 1.0
- nightly
matrix:
allow_failures:
- julia: nightly
# matrix:
# allow_failures:
# - julia: nightly
notifications:
email: false
# uncomment the following lines to override the default test script
script:
- julia -e 'Pkg.clone(pwd())'
- julia -e 'Pkg.build("VideoIO")'
- if [ -f test/runtests.jl ]; then julia -e 'Pkg.test("VideoIO", coverage=true)'; fi
# script:
# - julia -e 'Pkg.clone(pwd())'
# - julia -e 'Pkg.build("VideoIO")'
# - if [ -f test/runtests.jl ]; then julia -e 'Pkg.test("VideoIO", coverage=true)'; fi
after_success:
# push coverage results to Coveralls
- julia -e 'cd(Pkg.dir("VideoIO")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
# push coverage results to Codecov
- julia -e 'cd(Pkg.dir("VideoIO")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
32 changes: 14 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
VideoIO.jl
==========

Julia bindings for libav/ffmpeg.
Julia bindings for libav/ffmpeg.

Currently, only video reading is supported, for the following
Currently, only video reading is supported, for the following
library versions:

* libav 0.8, 9, 10
Expand All @@ -14,9 +14,9 @@ library versions:
Video images may be read as raw arrays, or optionally, `Image`
objects (if `Images.jl` is installed and loaded first).

Feel free to request support for additional libav/ffmpeg
Feel free to request support for additional libav/ffmpeg
versions, although earlier versions may be too challenging to
support.
support.

If you encounter any problems, please add the output
of `VideoIO.versioninfo()` to your report.
Expand All @@ -41,13 +41,10 @@ A trivial video player interface exists (no audio):
# Aternatively, you can just open the camera
#VideoIO.viewcam()

Note that `ImageView` must be imported before `VideoIO` for the `playvideo`
function to be available.

High Level Interface
--------------------

VideoIO contains a simple high-level interface which allows reading of
VideoIO contains a simple high-level interface which allows reading of
video frames from a supported video file, or from a camera device:

using Images
Expand All @@ -71,19 +68,18 @@ video frames from a supported video file, or from a camera device:
seek(f,2.5) ## The second parameter is the time in seconds and must be Float64
img = read(f)
canvas, _ = ImageView.view(img)

while !eof(f)
read!(f, img)
ImageView.imshow(canvas, img)
#sleep(1/30)
end

This code is essentially the code in `playvideo`, and will read and
This code is essentially the code in `playvideo`, and will read and
(without the `sleep`) play a movie file as fast as possible.

As with the `playvideo` function, the `Images` and `ImageView` packages
must be loaded before `VideoIO` for the appropriate functions to be
available.
must be loaded for the appropriate functions to be available.


Low Level Interface
Expand Down Expand Up @@ -112,17 +108,17 @@ After importing VideoIO, you can import and use any of the subpackages directly
Note that much of the functionality of these subpackages is not enabled
by default, to avoid long compilation times as they load. To control
what is loaded, each library version has a file which imports that's
modules files. For example, ffmpeg's libswscale-v2 files are loaded by
modules files. For example, ffmpeg's libswscale-v2 files are loaded by
$(VideoIO_PKG_DIR)/src/ffmpeg/SWScale/v2/LIBSWSCALE.jl.

Check these files to enable any needed functionality that isn't already
enabled. Note that you'll probably need to do this for each version
enabled. Note that you'll probably need to do this for each version
of the package for both ffmpeg and libav, and that the interfaces do
change some from version to version.

Note that, in general, the low-level functions are not very fun to use,
so it is good to focus initially on enabling a nice, higher-level
function for these interfaces.
so it is good to focus initially on enabling a nice, higher-level
function for these interfaces.

Test Videos
-----------
Expand All @@ -132,7 +128,7 @@ These are short videos in a variety of formats with non-restrictive
(public domain or Creative Commons) licenses.

* `VideoIO.TestVideos.available()` prints a list of all available test videos.
* `VideoIO.testvideo("annie_oakley")` returns an AVInput object for the
* `VideoIO.testvideo("annie_oakley")` returns an AVInput object for the
`"annie_oakley"` video. The video will be downloaded if it isn't available.
* `VideoIO.TestVideos.download_all()` downloads all test videos
* `VideoIO.TestVideos.remove_all()` removes all test videos
Expand All @@ -144,5 +140,5 @@ At this point, a simple video interface is available, for multiple
versions of libav and ffmpeg. See TODO.md for some possible directions
forward.

Issues, requests, and/or pull requests for problems or additional
Issues, requests, and/or pull requests for problems or additional
functionality are very welcome.
3 changes: 2 additions & 1 deletion REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.6
julia 0.7
BinDeps 0.3.4
FixedPointNumbers 0.3.0
ColorTypes
Expand All @@ -7,3 +7,4 @@ ImageCore
ImageView 0.3.0
@osx Homebrew
@linux Glob
Requires
21 changes: 10 additions & 11 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ using BinDeps

group = library_group("libav")

deps = [
libavcodec = library_dependency("libavcodec", aliases=[["libavcodec-ffmpeg.so.","libavcodec.","libavcodec.so.","libavcodec.ffmpeg.so.","avcodec-"].*["53" "54" "55" "56"]...], group = group)
libavformat = library_dependency("libavformat", aliases=[["libavformat-ffmpeg.so.","libavformat.","libavformat.so.","libavformat.ffmpeg.so.","avformat-"].*["53" "54" "55" "56"]...], group = group)
libavutil = library_dependency("libavutil", aliases=[["libavutil-ffmpeg.so.", "libavutil.","libavutil.so.", "libavutil.ffmpeg.so.", "avutil-"].*["51" "52" "54"]...], group = group)
libswscale = library_dependency("libswscale", aliases=[["libswscale-ffmpeg.so.","libswscale.","libswscale.so.","libswscale.ffmpeg.so.","swscale-"].*["2" "3"]...], group = group)
libavfilter = library_dependency("libavfilter", aliases=[["libavfilter-ffmpeg.so.","libavfilter.","libavfilter.so.","libavfilter.ffmpeg.so.","avfilter-"].*["2" "3" "4" "5"]...], group = group)
libavdevice = library_dependency("libavdevice", aliases=[["libavdevice-ffmpeg.so.","libavdevice.","libavdevice.so.","libavdevice.ffmpeg.so.","avdevice-"].*["53" "54" "55" "56"]...], group = group)
]

libavcodec = library_dependency("libavcodec", aliases=[["libavcodec-ffmpeg.so.","libavcodec.","libavcodec.so.","libavcodec.ffmpeg.so.","avcodec-"].*["53" "54" "55" "56"]...], group = group)
libavformat = library_dependency("libavformat", aliases=[["libavformat-ffmpeg.so.","libavformat.","libavformat.so.","libavformat.ffmpeg.so.","avformat-"].*["53" "54" "55" "56"]...], group = group)
libavutil = library_dependency("libavutil", aliases=[["libavutil-ffmpeg.so.", "libavutil.","libavutil.so.", "libavutil.ffmpeg.so.", "avutil-"].*["51" "52" "54"]...], group = group)
libswscale = library_dependency("libswscale", aliases=[["libswscale-ffmpeg.so.","libswscale.","libswscale.so.","libswscale.ffmpeg.so.","swscale-"].*["2" "3"]...], group = group)
libavfilter = library_dependency("libavfilter", aliases=[["libavfilter-ffmpeg.so.","libavfilter.","libavfilter.so.","libavfilter.ffmpeg.so.","avfilter-"].*["2" "3" "4" "5"]...], group = group)
libavdevice = library_dependency("libavdevice", aliases=[["libavdevice-ffmpeg.so.","libavdevice.","libavdevice.so.","libavdevice.ffmpeg.so.","avdevice-"].*["53" "54" "55" "56"]...], group = group)

deps = [libavcodec, libavformat, libavutil, libswscale, libavfilter, libavdevice]
libav_libs = [libavutil, libavcodec, libavformat, libavfilter, libswscale, libavdevice]

# if (have_avresample = dlopen_e("libavresample") != C_NULL)
Expand All @@ -26,14 +25,14 @@ libav_libs = [libavutil, libavcodec, libavformat, libavfilter, libswscale, libav
# push!(libav_libs, libswresample)
# end

if is_windows()
if Sys.iswindows()
provides(Binaries, URI("http://ffmpeg.zeranoe.com/builds/win$WORD_SIZE/shared/ffmpeg-2.2.3-win$WORD_SIZE-shared.7z"),
libav_libs,
os = :Windows,
unpacked_dir="ffmpeg-2.2.3-win$WORD_SIZE-shared/bin")
end

if is_apple()
if Sys.isapple()
using Homebrew
provides( Homebrew.HB, "ffmpeg", libav_libs, os = :Darwin )
end
Expand Down
48 changes: 43 additions & 5 deletions src/VideoIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,56 @@ __precompile__(false)

module VideoIO

using FixedPointNumbers, ColorTypes, ImageCore
using FixedPointNumbers, ColorTypes, ImageCore, Requires

include("init.jl")
include(joinpath(av_load_path, "AVUtil", "src", "AVUtil.jl"))
include(joinpath(av_load_path, "AVCodecs", "src", "AVCodecs.jl"))
include(joinpath(av_load_path, "AVFormat", "src", "AVFormat.jl"))
include(joinpath(av_load_path, "AVDevice", "src", "AVDevice.jl"))
include(joinpath(av_load_path, "SWScale", "src", "SWScale.jl"))

using AVUtil
using AVCodecs
using AVFormat
using SWScale
using .AVUtil
using .AVCodecs
using .AVFormat
using .SWScale

include("util.jl")
include("avio.jl")
include("testvideos.jl")
using .TestVideos

function __init__()
@require ImageView = "86fae568-95e7-573e-a6b2-d8a6b900c9ef" begin
# Define read and retrieve for Images
function play(f, flip=false)
buf = read(f)
canvas, _ = ImageView.imshow(buf, flipx=flip, interactive=false)

while !eof(f)
read!(f, buf)
ImageView.imshow(canvas, buf, flipx=flip, interactive=false)
sleep(1 / f.framerate)
end
end

function playvideo(video)
f = VideoIO.openvideo(video)
play(f)
end

if have_avdevice()
function viewcam(device=DEFAULT_CAMERA_DEVICE, format=DEFAULT_CAMERA_FORMAT)
camera = opencamera(device, format)
play(camera, true)
end
else
function viewcam()
error("libavdevice not present")
end
end
end
end


end # VideoIO
Loading