|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | from unittest import mock |
3 | 3 |
|
| 4 | +import reusables |
| 5 | + |
4 | 6 | from fastflix.encoders.ffmpeg_hevc_nvenc.command_builder import build |
5 | 7 | from fastflix.models.encode import FFmpegNVENCSettings |
6 | 8 | from fastflix.models.video import VideoSettings |
@@ -94,13 +96,19 @@ def test_ffmpeg_hevc_nvenc_bitrate(): |
94 | 96 | result = build(fastflix) |
95 | 97 |
|
96 | 98 | # The expected command should be a list of two Command objects for two-pass encoding |
97 | | - expected_commands = [ |
98 | | - 'ffmpeg -y -i input.mkv -tune:v hq --color_details -spatial_aq:v 0 -tier:v main -rc-lookahead:v 0 -gpu -1 -b_ref_mode disabled -profile:v main -pass 1 -passlogfile "work_path\\pass_log_file_abcdef1234" -b:v 6000k -preset:v slow -2pass 1 -an -sn -dn -r 24 -f mp4', |
99 | | - 'ffmpeg -y -i input.mkv -tune:v hq --color_details -spatial_aq:v 0 -tier:v main -rc-lookahead:v 0 -gpu -1 -b_ref_mode disabled -profile:v main -pass 2 -passlogfile "work_path\\pass_log_file_abcdef1234" -2pass 1 -b:v 6000k -preset:v slow output.mkv', |
100 | | - ] |
| 99 | + if reusables.win_based: |
| 100 | + expected_commands = [ |
| 101 | + 'ffmpeg -y -i input.mkv -tune:v hq --color_details -spatial_aq:v 0 -tier:v main -rc-lookahead:v 0 -gpu -1 -b_ref_mode disabled -profile:v main -pass 1 -passlogfile "work_path\\pass_log_file_abcdef1234" -b:v 6000k -preset:v slow -2pass 1 -an -sn -dn -r 24 -f mp4 NUL', |
| 102 | + 'ffmpeg -y -i input.mkv -tune:v hq --color_details -spatial_aq:v 0 -tier:v main -rc-lookahead:v 0 -gpu -1 -b_ref_mode disabled -profile:v main -pass 2 -passlogfile "work_path\\pass_log_file_abcdef1234" -2pass 1 -b:v 6000k -preset:v slow output.mkv', |
| 103 | + ] |
| 104 | + else: |
| 105 | + expected_commands = [ |
| 106 | + 'ffmpeg -y -i input.mkv -tune:v hq --color_details -spatial_aq:v 0 -tier:v main -rc-lookahead:v 0 -gpu -1 -b_ref_mode disabled -profile:v main -pass 1 -passlogfile "work_path/pass_log_file_abcdef1234" -b:v 6000k -preset:v slow -2pass 1 -an -sn -dn -r 24 -f mp4 /dev/null', |
| 107 | + 'ffmpeg -y -i input.mkv -tune:v hq --color_details -spatial_aq:v 0 -tier:v main -rc-lookahead:v 0 -gpu -1 -b_ref_mode disabled -profile:v main -pass 2 -passlogfile "work_path/pass_log_file_abcdef1234" -2pass 1 -b:v 6000k -preset:v slow output.mkv', |
| 108 | + ] |
101 | 109 | assert isinstance(result, list), f"Expected a list of Command objects, got {type(result)}" |
102 | 110 | assert len(result) == 2, f"Expected 2 Command objects, got {len(result)}" |
103 | | - assert result[0].command.startswith(expected_commands[0]), ( |
| 111 | + assert result[0].command == expected_commands[0], ( |
104 | 112 | f"Expected: {expected_commands[0]}\nGot: {result[0].command}" |
105 | 113 | ) |
106 | 114 | assert result[1].command == expected_commands[1], ( |
|
0 commit comments