VideoIO.jl can’t seem to open a .mkv video

Hareruya
Thu, 07 Jul 2022 05:33:01 +0000
General Usage

Greetings.

I do image signal processing as a hobby, especially playing around with images taken from video. I used to take screenshots using MPV, but I started to wonder if it would not be better to take shots from within Julia using VideoIO.jl. I have no real experience using video processing tools, and I seem to have hit a wall.
I have tried importing into Julia a .mkv video(here called “test.mkv”). It opens the file with no issue, but can’t open the video. This is the code I use:

using GLMakie, VideoIO, Images
io = VideoIO.open(“test.mkv”)
v = VideoIO.openvideo(io)

And this is the value of io:

io = AVInput(/Users/julianogarcia/Desktop/test.mkv, …), with
1 video stream(s)
1 audio stream(s)
5 data stream(s)
20 attachment stream(s)
)

However, when I try to actually open the video in v, I get an Unknown pixel format error with the following stacktrace:

Unknown pixel format

1. error(::String)@error.jl:33

2. var"#VideoReader#18"(::Bool, ::Nothing, ::Int64, ::Nothing, ::Bool, ::NamedTuple{(), Tuple{}}, ::NamedTuple{(), Tuple{}}, ::Int64, ::Type{VideoIO.VideoReader}, ::VideoIO.AVInput{String}, ::Int64)@avio.jl:296

3. VideoIO.VideoReader(::VideoIO.AVInput{String}, ::Int64)@avio.jl:275

4. #openvideo#20@avio.jl:636 [inlined]

5. openvideo(::VideoIO.AVInput{String})@avio.jl:636

6. top-level scope@Local: 1 [inlined]

Is there anything I am doing wrong here? Looking at the VideoIO.jl page I was able to find that I can specify the pixel format using ‘target_format = VideoIO.AV_PIX_FMT_*’. However, when I try to check the available formats in VideoIO, there are only 4 available in the following dictionary(apologies for the screenshot, I am using Pluto):

Which is a far cry from the total of available formats in ffmpeg.
And none of the available 4 seem to work, returning the following stacktrace:

Unknown pixel format

1. error(::String)@error.jl:33

2. var"#VideoReader#18"(::Bool, ::Int32, ::Int64, ::Nothing, ::Bool, ::NamedTuple{(), Tuple{}}, ::NamedTuple{(), Tuple{}}, ::Int64, ::Type{VideoIO.VideoReader}, ::VideoIO.AVInput{String}, ::Int64)@avio.jl:296

3. #openvideo#20@avio.jl:636 [inlined]

4. top-level scope@Local: 1 [inlined]

My platform is MACOS, on a 2019 MacBookPro. My Julia version is as follows:

Julia Version 1.7.3
Commit 742b9abb4d (2022-05-06 12:58 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin21.4.0)
CPU: Intel(R) Core™ i7-9750H CPU @ 2.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
JULIA_REVISE_WORKER_ONLY = 1

I apologize if I overlooked something elementary in the process.

14 posts - 3 participants