0

The following code outputs differing files. Why?

I used both the diff command and cmp which says they start to differ at byte 15. I also tried changing the argument to toFormat() from 'ogg' to 'mp3'. Same results.

ffmpeg( './original/test.mp3' )
    .toFormat( 'ogg' )
    .on( 'error', function(error, stdout, stderr)
    {
        console.log( 'Cannot process file: \n' + error );
    })
    .output( './tmp_a/' + filename )
    .output( './tmp_b/' + filename )
    .run();

I can't tell if I'm doing something wrong or if this is expected behavior.

Gyan
  • 85,394
  • 9
  • 169
  • 201
Kacy
  • 3,330
  • 4
  • 29
  • 57

1 Answers1

3

The OGG format muxer writes a unique serial number or ID tag. Add -flags +bitexact to set it to zero.

Gyan
  • 85,394
  • 9
  • 169
  • 201
  • Oh okay so ffmpeg just reruns the algorithm for each output() call. I tried adding `inputOptions( '-flags +bitexact' )` just before `toFormat()`, but the files still differed. Your explanation still makes sense though. – Kacy Feb 25 '17 at 10:25
  • I don't know node.js syntax, but it's an output option, not input. – Gyan Feb 25 '17 at 10:28
  • 1
    If you want to encode it once and save in multiple files, you have to use the tee muxer. – Gyan Feb 25 '17 at 10:30