Skip to content

Commit

Permalink
Merge pull request #55 from revolter/fix/video-notes
Browse files Browse the repository at this point in the history
  • Loading branch information
revolter authored Dec 20, 2021
2 parents b9606be + a232b6c commit 7bcc2c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
AUDIO_CODEC_NAMES = ['aac', 'mp3']

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


class OutputType:
Expand Down
9 changes: 7 additions & 2 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,16 @@ def convert(output_type: str, input_video_url: typing.Optional[str] = None, inpu
ffmpeg_input
.video
.crop(
constants.VIDEO_NOTE_CROP_HORIZONTAL_OFFSET_PARAMS,
constants.VIDEO_NOTE_CROP_VERTICAL_OFFSET_PARAMS,
constants.VIDEO_NOTE_CROP_OFFSET_PARAMS,
constants.VIDEO_NOTE_CROP_OFFSET_PARAMS,
constants.VIDEO_NOTE_CROP_SIZE_PARAMS,
constants.VIDEO_NOTE_CROP_SIZE_PARAMS
)
.filter(
'scale',
constants.VIDEO_NOTE_SCALE_SIZE_PARAMS,
constants.VIDEO_NOTE_SCALE_SIZE_PARAMS
)
)

ffmpeg_output: ffmpeg.nodes.OutputStream
Expand Down

0 comments on commit 7bcc2c7

Please sign in to comment.