diff --git a/lib/video/ffargs.js b/lib/video/ffargs.js index a08333a..10f73f4 100644 --- a/lib/video/ffargs.js +++ b/lib/video/ffargs.js @@ -25,10 +25,12 @@ exports.prepare = function (source, target, options) { // output framerate if (options.framerate !== 0) { args.push('-r', options.framerate || DEFAULT_VIDEO_FPS) + } else { + args.push('-fps_mode', 'vfr') } // misc options - args.push('-vsync', '2', '-movflags', '+faststart') + args.push('-movflags', '+faststart') // remove metadata if required if (options.keepMetadata) { diff --git a/test/unit/ffargs.test.js b/test/unit/ffargs.test.js index c8b31ea..b1e949c 100755 --- a/test/unit/ffargs.test.js +++ b/test/unit/ffargs.test.js @@ -57,18 +57,25 @@ describe('ffargs', () => { const args = ffargs.prepare('source.mts', 'target.mp4', {}) const str = args.join(' ') should(str).match(/-r 25/) + // these are not compatible with -r anymore with ffmpeg v6 + // we simply default to -fps_mode=auto + should(str).not.match(/-vsync/) + should(str).not.match(/-fps_mode/) }) - it('can specify a value', () => { + it('can specify a framerate value', () => { const args = ffargs.prepare('source.mts', 'target.mp4', { framerate: 60 }) const str = args.join(' ') should(str).match(/-r 60/) + should(str).not.match(/-vsync/) + should(str).not.match(/-fps_mode/) }) it('keeps the source framerate if set to 0', () => { const args = ffargs.prepare('source.mts', 'target.mp4', { framerate: 0 }) const str = args.join(' ') should(str).not.match(/-r/) + should(str).match(/-fps_mode vfr/) }) }) })