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

Error when loading an x265 video encoded with monochrome12 profile #379

Open
BioTurboNick opened this issue Dec 5, 2022 · 1 comment
Open

Comments

@BioTurboNick
Copy link
Contributor

I'm trying to load a video that was saved with this command:

imgstack = copy(reinterpret(UInt16, imgstack))
VideoIO.save("x265_lossless.mp4", eachslice(imgstack, dims = 3), framerate = 5, codec_name = "libx265", encoder_options = (var"x265-params" = "profile=monochrome12:lossless=1", preset = "medium"))

But I get this error:

ERROR: MethodError: no method matching out_frame_size(::VideoIO.VideoReader{true, VideoIO.GrayTransform, String})
Closest candidates are:
  out_frame_size(::VideoIO.VideoReader{<:Any, VideoIO.NestedCStruct{VideoIO.libffmpeg.AVFrame}}) at C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:712
  out_frame_size(::VideoIO.VideoReader{true, VideoIO.SwsTransform}) at C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:714
  out_frame_size(::VideoIO.SwsTransform) at C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:713
Stacktrace:
  [1] retrieve(r::VideoIO.VideoReader{true, VideoIO.GrayTransform, String})
    @ VideoIO C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:548
  [2] read(::VideoIO.VideoReader{true, VideoIO.GrayTransform, String})
    @ VideoIO C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:653
  [3] iterate
    @ C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:103 [inlined]
  [4] iterate
    @ C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:102 [inlined]
  [5] grow_to!
    @ .\array.jl:860 [inlined]
  [6] _collect
    @ .\array.jl:764 [inlined]
  [7] collect
    @ .\array.jl:712 [inlined]
  [8] (::VideoIO.var"#13#14")(io::VideoIO.VideoReader{true, VideoIO.GrayTransform, String})        
    @ VideoIO C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:95
  [9] openvideo(f::VideoIO.var"#13#14", args::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ VideoIO C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:641
 [10] openvideo
    @ C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:638 [inlined]
 [11] #load#12
    @ C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:94 [inlined]
 [12] load(::String)
    @ VideoIO C:\Users\nicho\.julia\packages\VideoIO\V24Bg\src\avio.jl:93
 [13] top-level scope
    @ REPL[11]:1
@BioTurboNick
Copy link
Contributor Author

BioTurboNick commented Dec 5, 2022

The workaround/solution is to define these methods:

out_frame_size(t::GrayTransform) = (t.dstframe.width, t.dstframe.height)
out_frame_size(r::VideoReader{TRANSCODE,GrayTransform}) = out_frame_size(r.frame_graph)

But perhaps GrayTransform and SwsTransform need a shared abstract type and methods should dispatch on the abstract type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant