Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options Being Appended Before Instead of After Input File #63

Open
mzagaja opened this issue Mar 18, 2024 · 0 comments
Open

Options Being Appended Before Instead of After Input File #63

mzagaja opened this issue Mar 18, 2024 · 0 comments

Comments

@mzagaja
Copy link

mzagaja commented Mar 18, 2024

I am attempting to add cover art to podcast encodes. The relevant encoder segment is as follows:

  /**
   * Generates the audio encode command:
   *   ffmpeg -y -i /path/to/input/clean.mov -c:a "libmp3lame" -ac "2" -b:a "160k"
   *     -ar "44100" -joint_options: "0" -f "mp3" -map "a:0" /path/to/output.mp3
   * @returns {FFmpegCommand} - the object representing the screener ffmpeg command
   */
  generateEncodingCommand () {
    const opts = {
      encoderType: this.options.encoderType,
      mediaType: 'audio',
      profile: this.options.profile,
      probe: this.probe,
      passes: this.passes,
      jobOptions: this.options.jobOptions
    };
    this.profileSettings = EncoderSettings.create(opts);
    const commandSettings = this.profileSettings.getProfileSettings();

    const input = new FFmpegInput(this.options.inputPath);
    const output = new FFmpegOutput(
      this.options.outputPath,
      commandSettings.outputOptions
    );
    // See http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=9af71b326fda1c6f32a26d465f7740110113e759
    // For adding cover art to an audio file.
    const coverArtInput = new FFmpegInput("/encoding_service/assets/images/ted-talks-album-art.png", {
      'disposition:v:1': 'attached_pic'
    })

    const cmd = new FFmpegCommand(commandSettings.globalOptions);
    cmd.addInput(input);
    cmd.addInput(coverArtInput);
    cmd.addOutput(output);

    return cmd;
  }
}

When I run this, the ouptut command I get is:

"ffmpeg -y -i \"/tmp/aac_podcast_audio_96k-0b8f7a55f69260412d09fd36/2023T_changhua_wu_-_S01_-Mix.wav\" -disposition:v:1 \"attached_pic\" -i /encoding_service/assets/images/ted-talks-album-art.png -c:a \"libfdk_aac\" -b:a \"96k\" -ar \"44100\" -ac \"1\" -vn -f \"mp4\" -movflags \"+faststart\" -metadata \"album=TEDTalks\" /tmp/aac_podcast_audio_96k-0b8f7a55f69260412d09fd36/2023t-changhua-wu-003-c91642d3-b0b8-4bf9-9825-2fd096f09fba-96k.m4a"

I would expect:

"ffmpeg -y -i \"/tmp/aac_podcast_audio_96k-0b8f7a55f69260412d09fd36/2023T_changhua_wu_-_S01_-Mix.wav\" -i /encoding_service/assets/images/ted-talks-album-art.png -disposition:v:1 \"attached_pic\" -c:a \"libfdk_aac\" -b:a \"96k\" -ar \"44100\" -ac \"1\" -vn -f \"mp4\" -movflags \"+faststart\" -metadata \"album=TEDTalks\" /tmp/aac_podcast_audio_96k-0b8f7a55f69260412d09fd36/2023t-changhua-wu-003-c91642d3-b0b8-4bf9-9825-2fd096f09fba-96k.m4a"

Is there a reason that the options are being appended to the previous input stream, or am I misunderstanding the significance of this ordering?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant