Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions test/ffmpeg/ffmpeg_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,42 @@ void main() {
),
);
});

test("converts a group of images to a video", () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice that other tests in this file test technical details of the package. This test is really more of an example use-case. If we put all use cases in this file then it would be very difficult to find anything. Please put this test in a new file called test/use_cases/use_cases_test.dart.

final command = FfmpegCommand.simple(
inputs: [
// file%d.png represents images named like file0.png, file1.png, file2.png, etc.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of calling things file - how about we use names that reflect what a real file name for this purpose might look like. For example, I assume these files are screenshots?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah, they were. Will update the names.

FfmpegInput.asset("assets/images/file%d.png"),

FfmpegInput.asset("assets/audio/audio.mp3"),
],
args: [
const CliArg(name: 'y'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments for why you need/want each of these arguments.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

const CliArg(name: 'c:a', value: 'aac'),
const CliArg(name: 'qscale:v', value: '1'),
],
outputFilepath: 'assets/output/file.mp4',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you really name your output file.mp4?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update it to something more appropriate.

);

expect(
command.toCli(),
const CliCommand(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you run this command to ensure that it does what you expect?

Copy link
Author

@rutvik110 rutvik110 Feb 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah, works nicely.

executable: 'ffmpeg',
args: [
"-i",
"assets/images/file%d.png",
"-i",
"assets/audio/audio.mp3",
"-y",
"-c:a",
"aac",
"-qscale:v",
"1",
"assets/output/file.mp4"
],
),
);
});
});
});
}