Code Monkey home page Code Monkey logo

Comments (6)

scriptorian avatar scriptorian commented on September 23, 2024 1

Great.
FFmpeg has deprecated yuvj422p format apparently - you will probably be seeing a warning about this. In my example I have used the yuv422p format and used a colorspace filter to set the jpeg output range.

from beamcoder.

sparkpunkd avatar sparkpunkd commented on September 23, 2024 1

SigSev issue is too deep inside FFmpeg to defend against. Ideally the MJPEG encoder could be at little nicer.

Closing as main issue is resolved.

from beamcoder.

sparkpunkd avatar sparkpunkd commented on September 23, 2024

I think the issue is that the mjpeg encoder only accepts the following planar pixel formats:

[ 'yuvj420p', 'yuvj422p', 'yuvj444p' ]

You can see this with the following:

beamcoder.encoders()['mjpeg'].pix_fmts

You would need to convert the interleaved data from macadam into the planar form (data[0] for Y, data[1] for U and data[2] for V) before encoding.

However, I wish you had not got a segfault ... I'll see if I can turn this into a more friendly error before closing this issue.

from beamcoder.

scriptorian avatar scriptorian commented on September 23, 2024

I have added an example app that has a filtering implementation that with small modifications should help you avoid this problem. Take a look at examples/jpeg_filter_app.js.

from beamcoder.

scriptorian avatar scriptorian commented on September 23, 2024

Something like the following just before calling encode:

  let filt = await beamcoder.filterer({
    filterType: 'video',
    inputParams: [{
      width: f.video.width,
      height: f.video.height,
      pixelFormat: 'uyvy422',
      timeBase: [ 1, 25 ],
      pixelAspect: [ 1, 1 ] }],
    outputParams: [{ pixelFormat: 'yuv422p' }],
    filterSpec: 'scale=640:360, colorspace=range=jpeg:all=bt709' })

  let filtResult = await filt.filter([{ frames: [ f ] }]);
  let filtFrame = filtResult[0].frames[0]
    
  let jpg = await enc.encode(filtFrame)
  ...

I haven't tested this as I don't have any BMD hardware at the moment - but I hope it helps!

from beamcoder.

mint-dewit avatar mint-dewit commented on September 23, 2024

Yup, that's pretty much what I did:

filterer = await beamcoder.filterer({
    filterType: 'video',
    inputParams: [
        {
            width: 1280,
            height: 720,
            pixelFormat: 'uyvy422',
            pixelAspect: [1, 1],
            timeBase: [1, 1]
        }
    ],
    outputParams: [
        {
            pixelFormat: 'yuvj422p'
        }
    ],
    filterSpec: 'format=pix_fmts=yuvj422p'
})

let filtFrames = await filterer.filter([{ frames: { frames: [ frame ] } }])
let jpg = await enc.encode(filtFrames[0].frames[0])

from beamcoder.

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.