artclarke / humble-video

Humble Video: Demuxing, Decoding, Filtering, Encoding and Muxing of 100's of video and audio formats and Codecs from the JVM
GNU Affero General Public License v3.0
551 stars 113 forks source link

Trying to record a video from webcam. Unexpected exception from a given example #147

Open Virgula0 opened 3 years ago

Virgula0 commented 3 years ago

I'm trying to compile this example:

https://github.com/sarxos/webcam-capture/blob/master/webcam-capture-examples/webcam-capture-video-recording-humble/src/main/java/RecordAndEncodeVideo.java

I added both maven dependencies:

        <dependency>
            <groupId>com.github.sarxos</groupId>
            <artifactId>webcam-capture</artifactId>
            <version>0.3.12</version>
        </dependency>
        <dependency>
            <groupId>io.humble</groupId>
            <artifactId>humble-video-all</artifactId>
            <version>0.3.0</version>
        </dependency>

But the example throws an exception and I don't know how to solve it:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Record frame BufferedImage@59ec2012: type = 5 ColorModel: #pixelBits = 24 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@3c0f93f1 transparency = 1 has alpha = false isAlphaPre = false ByteInterleavedRaster: width = 640 height = 360 #numDataElements 3 dataOff[0] = 2
Exception in thread "main" java.lang.IllegalArgumentException: output frame height does not match expected value
    at io.humble.video.VideoJNI.MediaPictureResampler_resample(Native Method)
    at io.humble.video.MediaPictureResampler.resample(MediaPictureResampler.java:202)
    at io.humble.video.awt.AMediaPictureConverter.resample(AMediaPictureConverter.java:204)
    at io.humble.video.awt.BgrConverter.toPicture(BgrConverter.java:152)
    at main.java.RecordVideoFromWebcam.recordScreen(RecordVideoFromWebcam.java:138)
    at main.java.RecordVideoFromWebcam.main(RecordVideoFromWebcam.java:180)

Platform: Windows Java SDK: 12