fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.79k stars 873 forks source link

I want to change the video size #1043

Open zhishaofei3 opened 4 years ago

zhishaofei3 commented 4 years ago

Version information

Code to reproduce

var ffmpeg = require('fluent-ffmpeg')

ffmpeg({source: 'teacher.mp4'})
.size('1024x768').aspect(1.33333)
.output('oteacher.mp4')
.run()

(note: if the problem only happens with some inputs, include a link to such an input file)

Expected results

I have a source video 1280720(16:9), I want convert to 1024768(4:3), I want video scale stretch

I want get a output video with 1024768(otaecher.mp4) from 1280720(teacher.mp4). But the oteacher.mp4 Aspect ratio is 16:9, it's not 4:3

oteacher.mp4: sample_aspect_ratio: '4:3', display_aspect_ratio: '4:3', I want display_aspect_ratio is '4:3'

How to write the code ? thank you !

Observed results

oteacher.mp4: sample_aspect_ratio: '4:3', display_aspect_ratio: '16:9',

Checklist

schizobulia commented 4 years ago

I wonder if I can help you

example code

const FfmpegCommand = require('fluent-ffmpeg');
FfmpegCommand(`input.mp4`)
    .size('1024x768').autopad()
    .save('out.mp4')
    .on('start', () => {
    })
    .on('end', () => {
    })
    .on('stderr', function (stderrLine) {
        console.log(stderrLine);
    })
    .on('error', function (err) {
        console.log(err)
    });