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

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.

That argument controls the decoded pixel format, that is the pixel format in the arrays returned from the call. I suspect the problem here is the input pixel format stored in the video file, which should be handled automatically but isn’t for some reason. Can you share the video file?

I think we can find the format from the output from ffmpeg, since VideoIO is also using it:

ffmpeg -i test.mkv
ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
[libdav1d @ 0x7f79fa304800] libdav1d 1.0.0
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf58.76.100
  Duration: 00:23:40.06, start: -0.007000, bitrate: 2006 kb/s
  Chapters:
    Chapter #0:0: start 0.061000, end 40.835433
    Chapter #0:1: start 40.835433, end 140.801967
    Chapter #0:2: start 140.801967, end 616.644000
    Chapter #0:3: start 616.644000, end 1329.489467
    Chapter #0:4: start 1329.489467, end 1419.479367
  Stream #0:0(eng): Video: av1 (Main), yuv420p10le(tv), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:23:40.064000000
  Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
    Metadata:
      ENCODER         : Lavc58.91.100 libopus
      DURATION        : 00:23:40.061000000

The pixel format seems to be AV_PIX_FMT_YUV420P10LE, which is a supported format for ffmpeg given in the pixfmt.h list, but does not show up in the available formats for VideoIO, since it does not correspond to entries 77, 171, 2 or 8. It’s entry 64.

I believe that is the list of supported output pixel formats, this should build an ffmpeg pipeline to transcode the pixel format to one of those (selected here).

Looking at the stack trace, this line stands out:

avio.jl:275

    bad_px_type = transcode && target_format !== nothing && !is_pixel_type_supported(target_format)

The default value for transcode is true and target_format is nothing, so leaving those unchanged should never trigger the test for is_pixel_type_supported, which is the function throwing the error. Just to be sure you are using the most recent versions, what is the output (in a new julia session) of

# press ] to enter package mode and create a temporary environment
(@v1.7) pkg> activate --temp
  Activating new project at `/tmp/jl_z2sW4n`

# with only VideoIO and it's dependencies.
(jl_z2sW4n) pkg> add VideoIO

# press <Backspace> to return to REPL mode.
julia> using VideoIO

julia> ENV["JULIA_DEBUG"] = VideoIO

julia> io = VideoIO.open(“test.mkv”)

julia> v = VideoIO.openvideo(io)

Thank you very much for your help so far.
I did try running it now and this is the output in the session:

ERROR: Unknown pixel format
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] VideoIO.VideoReader(avin::VideoIO.AVInput{String}, video_stream::Int64; transcode::Bool, target_format::Nothing, pix_fmt_loss_flags::Int64, target_colorspace_details::Nothing, allow_vio_gray_transform::Bool, swscale_options::NamedTuple{(), Tuple{}}, sws_color_options::NamedTuple{(), Tuple{}}, thread_count::Int64)
   @ VideoIO ~/.julia/packages/VideoIO/V24Bg/src/avio.jl:296
 [3] VideoIO.VideoReader(avin::VideoIO.AVInput{String}, video_stream::Int64) (repeats 2 times)
   @ VideoIO ~/.julia/packages/VideoIO/V24Bg/src/avio.jl:275
 [4] #openvideo#20
   @ ~/.julia/packages/VideoIO/V24Bg/src/avio.jl:636 [inlined]
 [5] openvideo(::VideoIO.AVInput{String})
   @ VideoIO ~/.julia/packages/VideoIO/V24Bg/src/avio.jl:636
 [6] top-level scope
   @ REPL[6]:1

Huh, I expected more debug output. I’m not sure what to try next, I think that error is coming from FFMPEG. Hopefully someone more knowledgeable will chime in!

As a workaround, you could try specifying a different pixel format during recording.

Thank you for trying to help.
Looking at avframe_transfer.jl, they define 4 different functions to read frames based on the 4 specified formats, so I think this might be the issue here.

Here is a good one! My installed ffmpeg and the one used by VideoIO seem to have very different opinions about some files I created to test this. What does this command report for you:

julia> import Pkg; Pkg.add("FFMPEG_jll")

julia> using FFMPEG_jll

julia> run(`$(FFMPEG_jll.ffprobe()) test.mkv`);

You may have to use the full path to test.mkv

Thank you for still trying to help.
This is the output:

ffprobe version 4.4 Copyright (c) 2007-2021 the FFmpeg developers
  built with clang version 11.0.1 (/home/ec2-user/.julia/dev/BinaryBuilderBase/deps/downloads/llvm-project.git 43ff75f2c3feef64f9d73328230d34dac8832a91)
  configuration: --enable-cross-compile --cross-prefix=/opt/x86_64-apple-darwin14/bin/x86_64-apple-darwin14- --arch=x86_64 --target-os=darwin --cc=cc --cxx=c++ --dep-cc=cc --ar=ar --nm=nm --sysinclude=/workspace/destdir/include --pkg-config=/usr/bin/pkg-config --pkg-config-flags=--static --prefix=/workspace/destdir --sysroot=/opt/x86_64-apple-darwin14/x86_64-apple-darwin14/sys-root --extra-libs=-lpthread --enable-gpl --enable-version3 --enable-nonfree --disable-static --enable-shared --enable-pic --disable-debug --disable-doc --enable-avresample --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libvpx --enable-encoders --enable-decoders --enable-muxers --enable-demuxers --enable-parsers --enable-openssl --disable-schannel --extra-cflags=-I/workspace/destdir/include --extra-ldflags=-L/workspace/destdir/lib --objcc='cc -x objective-c'
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[av1 @ 0x7f95f4814c00] Your platform doesn't suppport hardware accelerated AV1 decoding.
[av1 @ 0x7f95f4814c00] Failed to get pixel format.
[av1 @ 0x7f95f4814c00] Missing Sequence Header.
    Last message repeated 54 times
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[av1 @ 0x7f95f4814c00] Failed to get reference frame.
[av1 @ 0x7f95f4814c00] video_get_buffer: image parameters invalid
[av1 @ 0x7f95f4814c00] get_buffer() failed
[av1 @ 0x7f95f4814c00] thread_get_buffer() failed
[av1 @ 0x7f95f4814c00] Failed to allocate space for current frame.
[av1 @ 0x7f95f4814c00] Get current frame error
[matroska,webm @ 0x7f95f4808200] decoding for stream 0 failed
[matroska,webm @ 0x7f95f4808200] Could not find codec parameters for stream 0 (Video: av1 (Main), none(tv), 1920x1080 [SAR 1:1 DAR 16:9]): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

EDIT: I noticed that the version of ffmpeg used in FFMPEG_jll and FFMPEG.jl are older versions than the one I am using. They also don’t identify the pixel format. Notice the “none(tv)”.
The ffmpeg version I can call from the command line(Homebrew version) is more recent(5.0.1), and it identifies the pixel format no problem:

ffprobe version 5.0.1 Copyright (c) 2007-2022 the FFmpeg developers
  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
[libdav1d @ 0x7fc11f805b40] libdav1d 1.0.0
Input #0, matroska,webm, from 'test.mkv':
  Metadata:
    ENCODER         : Lavf58.76.100
  Duration: 00:23:40.06, start: -0.007000, bitrate: 2006 kb/s
  Chapters:
    Chapter #0:0: start 0.061000, end 40.835433
    Chapter #0:1: start 40.835433, end 140.801967
    Chapter #0:2: start 140.801967, end 616.644000
    Chapter #0:3: start 616.644000, end 1329.489467
    Chapter #0:4: start 1329.489467, end 1419.479367
  Stream #0:0(eng): Video: av1 (Main), yuv420p10le(tv), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn (default)

Notice the “yuv420p10le(tv)”.

Hurray, that is the same behavior I see! I think the problem is that FFMPEG_jll is built without --enable-libaom. The version I get in Ubuntu and the version you are using from Homebrew both the include that library for av1 decoding. I’m not sure why it was left out, but at least that is something concrete to investigate.

1 Like

It would be good to open this as an issue on VideoIO. I think it’s clear that there’s a gap in support

1 Like

Issue opened: VideoIO can't open some AV1 encoded mkv files · Issue #373 · JuliaIO/VideoIO.jl · GitHub

2 Likes

A new version of FFMPEG_jll (4.4.2) has been released with AV1 support. Updating your packages should get the new version, the commands here now succeed on my test video.

3 Likes

On mine, the problem persisted even after updating. Then I uninstalled FFMPEG_jll and Video IO, then reinstalled them and now it does indeed work! I thought that might be relevant to say if anyone else has a similar issue.
I’ll consider this solved, then!
EDIT: I also get this warning, but it can actually read the video fine:

WARNING: using libffmpeg.##meta#62 in module VideoIO conflicts with an existing identifier.