Coder Social home page Coder Social logo

Comments (7)

bnerd avatar bnerd commented on August 17, 2024

This happens if the input video dimensions are larger then the calculated pad area. ffmpeg throws an error like:

[Parsed_pad_1 @ 0x36df440] Input area 80:0:720:360 not within the padded area 0:0:640:360 or zero-sized
[Parsed_scale_0 @ 0x372fdc0] Failed to configure input pad on Parsed_pad_1
Error opening filters!

I think we should first scale down the video and then apply the pad area in one step, like

-vf scale=640:360,pad=480:360:80:0:0x000000

I did a quick test and combined the scaling and padding in one method

    // add size and pad area in one step
    // video must be scaled down before we apply the pad area!
    if (this.options.video.size && this.options.video.pad && !this.options.video.skip) {
      args.push('-vf');
      args.push('scale=' + this.options.video.size
        + ',pad=' + this.options.video.pad.w +
            ':' + this.options.video.pad.h +
            ':' + this.options.video.pad.x +
            ':' + this.options.video.pad.y +
            ':' + this.options.video.padcolor);
      }

Seems to work so far.

from node-fluent-ffmpeg.

schaermu avatar schaermu commented on August 17, 2024

please test the branch commited above, if everything works we can merge it to the master

from node-fluent-ffmpeg.

btmdave avatar btmdave commented on August 17, 2024

Will this be merged and and updated into npm?

from node-fluent-ffmpeg.

bencevans avatar bencevans commented on August 17, 2024

Would be good to get a test written before this is merged

from node-fluent-ffmpeg.

njoyard avatar njoyard commented on August 17, 2024

On a side note, I'm considering rewriting those size/aspect/padding helpers to only use ffmpeg filters. I'm sick of this dimension calculation code, it is too error prone and ffmpeg filters can do that automagically :)

from node-fluent-ffmpeg.

bencevans avatar bencevans commented on August 17, 2024

I completely agree, the more we can push functionality down into ffmpeg the better.

from node-fluent-ffmpeg.

njoyard avatar njoyard commented on August 17, 2024

I'm closing this because it should have been addressed by #236. Feel free to reopen if you have problems.

from node-fluent-ffmpeg.

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.