fluent-ffmpeg / node-fluent-ffmpeg

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

Output format dash is not available #1264

Closed wenlittleoil closed 5 months ago

wenlittleoil commented 5 months ago

Version information

Code to reproduce


const ffmpeg = require('fluent-ffmpeg');
const path = require('path');

// Make sure FFmpeg is available in your system's PATH
ffmpeg.setFfmpegPath('/usr/local/bin/ffmpeg');

// Input video file
const inputVideo = path.resolve(__dirname, 'input.mp4');

// DASH output directory and files
const outputDir = path.resolve(__dirname, 'dash_output');
const outputManifest = path.join(outputDir, 'manifest.mpd');

// Configure FFmpeg for DASH transcoding
ffmpeg(inputVideo)
  .outputOptions([
    // DASH options
    '-f dash',
    '-init_seg_name init_$RepresentationID$.m4s',
    '-media_seg_name chunk_$RepresentationID$_$Number%05d$.m4s',
    '-use_timeline 1',
    '-use_template 1',
    '-window_size 5',
    '-adaptation_sets "id=0,streams=v id=1,streams=a"',

    // Video options
    '-map 0:v:0',
    '-c:v:0 libx264',
    '-b:v:0 500k',
    '-s:v:0 640x360',

    // Audio options
    '-map 0:a:0',
    '-c:a:0 aac',
    '-b:a:0 128k',
  ])
  .output(outputManifest)
  .on('start', () => {
    console.log('Starting DASH transcoding...');
  })
  .on('progress', (progress) => {
    console.log(`Progress: ${progress.percent.toFixed(2)}%`);
  })
  .on('error', (err, stdout, stderr) => {
    console.error('Error:', err.message);
    console.error('FFmpeg stdout:', stdout);
    console.error('FFmpeg stderr:', stderr);
  })
  .on('end', () => {
    console.log('DASH transcoding completed.');
  })
  .run();

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

Expected results

The program runs normally and generates mpd files.

Observed results

Error: Output format dash is not available FFmpeg stdout: undefined FFmpeg stderr: undefined

Checklist

MarianoFacundoArch commented 5 months ago

Same here, something changed in ffmpeg 7 Error: Output format image2 is not available Error: Output format mjpeg is not available

wenlittleoil commented 5 months ago

I downgraded my ffmpeg version to 6.1.1 and solve the problem. Thanks for your helps.

MarianoFacundoArch commented 5 months ago

Fixed here https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/1266

You can also install package from: https://www.npmjs.com/package/fluent-ffmpeg-7 and just change the import to from 'fluent-ffmpeg-7'

I did a quick version there till official version gets fixed.