diff options
author | 2024-07-28 19:10:41 +0000 | |
---|---|---|
committer | 2024-07-28 21:10:41 +0200 | |
commit | 368c97f0f85f243796a0407960dc5a2ccad24bab (patch) | |
tree | 04f3c9de78f2c814249cec7316b49fd073f69944 /internal/media/processingmedia.go | |
parent | [bugfix] moves file rename to earlier in media pipeline so ffmpeg calls ALWAY... (diff) | |
download | gotosocial-368c97f0f85f243796a0407960dc5a2ccad24bab.tar.xz |
[bugfix] take into account rotation when generating thumbnail (#3147)
* take into account rotation when generating thumbnail, simplify ffprobe output to show only fields we need
* only show rotation side data
* remove unnecessary comment
* fix code comments
* remove debug logging
Diffstat (limited to 'internal/media/processingmedia.go')
-rw-r--r-- | internal/media/processingmedia.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/media/processingmedia.go b/internal/media/processingmedia.go index 32c0531bc..b68d8d680 100644 --- a/internal/media/processingmedia.go +++ b/internal/media/processingmedia.go @@ -176,10 +176,11 @@ func (p *ProcessingMedia) store(ctx context.Context) error { // This will always be used regardless of type, // as even audio files may contain embedded album art. width, height, framerate := result.ImageMeta() + aspect := util.Div(float32(width), float32(height)) p.media.FileMeta.Original.Width = width p.media.FileMeta.Original.Height = height p.media.FileMeta.Original.Size = (width * height) - p.media.FileMeta.Original.Aspect = util.Div(float32(width), float32(height)) + p.media.FileMeta.Original.Aspect = aspect p.media.FileMeta.Original.Framerate = util.PtrIf(framerate) p.media.FileMeta.Original.Duration = util.PtrIf(float32(result.duration)) p.media.FileMeta.Original.Bitrate = util.PtrIf(result.bitrate) @@ -218,11 +219,11 @@ func (p *ProcessingMedia) store(ctx context.Context) error { if width > 0 && height > 0 { // Determine thumbnail dimensions to use. - thumbWidth, thumbHeight := thumbSize(width, height) + thumbWidth, thumbHeight := thumbSize(width, height, aspect, result.rotation) p.media.FileMeta.Small.Width = thumbWidth p.media.FileMeta.Small.Height = thumbHeight p.media.FileMeta.Small.Size = (thumbWidth * thumbHeight) - p.media.FileMeta.Small.Aspect = float32(thumbWidth) / float32(thumbHeight) + p.media.FileMeta.Small.Aspect = aspect // Generate a thumbnail image from input image path. thumbpath, err = ffmpegGenerateThumb(ctx, temppath, |