Git Product home page Git Product logo

Comments (7)

EleonoreMizo avatar EleonoreMizo commented on August 18, 2024

Unfortunately I haven’t an Apple machine for testing, and there are no automated tests. I’m even surprised it could compile without issue. I’ve got a nano ARM computer at home, I’ll see if I can install Vapoursynth and fmtconv on it, but I will be AFK within the next two weeks. In the meantime, it would be very helpful if you could nail down the culprit function and parameters.

from fmtconv.

Stefan-Olt avatar Stefan-Olt commented on August 18, 2024

Why is that surprising? There was issue (#30) fixed October last year to allow compilation on m1 macOS.
I will try to nail the problem down, in case that's relevant: For compilation clang 13.1.6 is used on the Mac I experienced this problem.

from fmtconv.

Stefan-Olt avatar Stefan-Olt commented on August 18, 2024

I traced it down: Only the resample function seems to be affected, no matter if changing bitdepth or size for different input formats. For YUV the colors are completly wrong (it's all green), for RGB everything is way to dark.

from fmtconv.

EleonoreMizo avatar EleonoreMizo commented on August 18, 2024

This is a surprise because without regular testing, code can break at any time and I’m excellent at breaking working code!
Thanks for the tests. This is probably a scale issue, I’ll check ARM code when I return.

from fmtconv.

ViRb3 avatar ViRb3 commented on August 18, 2024

Tested on MacBook Pro 2021 M1 Max, macOS 12.6, both Apple's compiler and LLVM from homebrew:

Apple clang version 14.0.0 (clang-1400.0.29.102)
Homebrew clang version 15.0.3

Using the sample code:

from vapoursynth import core
import vapoursynth as vs

core.std.LoadPlugin(path="libfmtconv.dylib")
core.std.LoadPlugin(path="/opt/homebrew/Cellar/ffms2/2.40_3/lib/libffms2.4.dylib")

clip = core.ffms2.Source(source="sample.mp4")
clip = clip.fmtc.resample(css="444")
clip = clip.fmtc.matrix(mat="709", col_fam=vs.RGB)
clip = clip.fmtc.bitdepth(bits=BITS)

clip = clip.fmtc.matrix(mat="709", col_fam=vs.YUV)
clip = clip.fmtc.resample(css="420")
clip = clip.fmtc.bitdepth(bits=8)
clip.set_output()

Input video ffprobe:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.27.100
  Duration: 00:01:12.22, start: 0.000000, bitrate: 1372 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 1241 kb/s, 12 fps, 12 tbr, 12288 tbn (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc. Created on: 05/16/2019.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc. Created on: 05/16/2019.
      vendor_id       : [0][0][0][0]

Then executing:

vspipe -c y4m main.py  - | mpv -

Results for BITS:

  • 32
    Screen Shot 2022-10-21 at 14 51 04
  • 16
    Screen Shot 2022-10-21 at 14 51 12
  • 8
    Screen Shot 2022-10-21 at 14 51 20

And another scenario:

from vapoursynth import core
import vapoursynth as vs

core.std.LoadPlugin(path="libfmtconv.dylib")
core.std.LoadPlugin(path="/opt/homebrew/Cellar/ffms2/2.40_3/lib/libffms2.4.dylib")

clip = core.ffms2.Source(source="sample.mp4")
clip = clip.fmtc.bitdepth(bits=BITS)
clip.set_output()

16 and 32 bits seem to work great. But with 8 bits:
Screen Shot 2022-10-21 at 14 54 28

Happy to run any further tests.

from fmtconv.

ViRb3 avatar ViRb3 commented on August 18, 2024

I found a workaround for colorspace conversion that is built-in and works on arm64:

# to RGB
clip = core.resize.Bicubic(clip, format=vs.RGBS, matrix_in_s="709")
# to YUV
clip = vs.core.resize.Bicubic(clip, format=vs.YUV420P8, matrix_s="709")

from fmtconv.

SaltyChiang avatar SaltyChiang commented on August 18, 2024

Part of the problems above might be fixed by #40. Conversion from int to float on Apple M1 returns the wrong result.

@ViRb3 @Stefan-Olt would you please check this?

from fmtconv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.