Move AV's add_destination
after convert_options
to permit second input (e.g. watermark).
#58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When you call
@cli.add_destination(dst.path)
, AV will add various output formats automatically, based on the destination filename. You can see that here:https://github.com/ruby-av/av/blob/f00e6295e8f175262c99f2a5c3f1d4ed75c2c436/lib/av/commands/base.rb#L134
These output params will naturally come before the
output_options
specified in this gem, which is probably fine most of the time but it prevents some advanced but common uses, like adding a watermark overlay to your videos.For example, creating a watermark overlay on a video would look like this:
However, this generates an FFMPEG command that looks like this:
That causes a problem because it tries to apply the
-acodec aac
to the-i my-watermark.png
, which is an image and you get an error message like this:By moving the
add_destination
after we add ourconvert_options
to the@cli
, it generates a FFMPEG command like this:This properly applies the "default" output options from the AV gem to the output file, and everybody is happy.