Skip to content

Commit 7bcc2c7

Browse files
authored
Merge pull request #55 from revolter/fix/video-notes
2 parents b9606be + a232b6c commit 7bcc2c7

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
AUDIO_CODEC_NAMES = ['aac', 'mp3']
1919

2020
VIDEO_CODEC_NAMES = ['h264', 'hevc', 'mpeg4', 'vp6', 'vp8']
21-
VIDEO_NOTE_CROP_HORIZONTAL_OFFSET_PARAMS = 'abs(in_w - min(min(in_w, in_h), {})) / 2'.format(MAX_VIDEO_NOTE_SIZE)
22-
VIDEO_NOTE_CROP_VERTICAL_OFFSET_PARAMS = 'abs(in_h - min(min(in_w, in_h), {})) / 2'.format(MAX_VIDEO_NOTE_SIZE)
23-
VIDEO_NOTE_CROP_SIZE_PARAMS = 'min(min(in_w, in_h), {})'.format(MAX_VIDEO_NOTE_SIZE)
21+
VIDEO_NOTE_CROP_OFFSET_PARAMS = 'abs(in_w - in_h) / 2'
22+
VIDEO_NOTE_CROP_SIZE_PARAMS = 'min(in_w, in_h)'
23+
VIDEO_NOTE_SCALE_SIZE_PARAMS = 'min(min(in_w, in_h), {})'.format(MAX_VIDEO_NOTE_SIZE)
2424

2525

2626
class OutputType:

src/utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,16 @@ def convert(output_type: str, input_video_url: typing.Optional[str] = None, inpu
171171
ffmpeg_input
172172
.video
173173
.crop(
174-
constants.VIDEO_NOTE_CROP_HORIZONTAL_OFFSET_PARAMS,
175-
constants.VIDEO_NOTE_CROP_VERTICAL_OFFSET_PARAMS,
174+
constants.VIDEO_NOTE_CROP_OFFSET_PARAMS,
175+
constants.VIDEO_NOTE_CROP_OFFSET_PARAMS,
176176
constants.VIDEO_NOTE_CROP_SIZE_PARAMS,
177177
constants.VIDEO_NOTE_CROP_SIZE_PARAMS
178178
)
179+
.filter(
180+
'scale',
181+
constants.VIDEO_NOTE_SCALE_SIZE_PARAMS,
182+
constants.VIDEO_NOTE_SCALE_SIZE_PARAMS
183+
)
179184
)
180185

181186
ffmpeg_output: ffmpeg.nodes.OutputStream

0 commit comments

Comments
 (0)