[FFmpeg-devel] PATCH: Rotation override for encoding case in metadata

Илья Щербак tthread at gmail.com
Thu Sep 6 19:33:21 EEST 2018


From 193d415c5b6f29be8f75839d5be4a5ca03bbac10 Mon Sep 17 00:00:00 2001
From: Ilya Shcherbak <i.shcherbak at corp.vk.com>
Date: Thu, 6 Sep 2018 18:30:20 +0300
Subject: [PATCH] Added rotation override for encoding case

---
 fftools/ffmpeg.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 934dc71a74..ac1972eb94 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3573,6 +3573,11 @@ static int init_output_stream(OutputStream *ost, char *error, int error_len)
                 memcpy(dst, sd->data, sd->size);
                 if (ist->autorotate && sd->type == AV_PKT_DATA_DISPLAYMATRIX)
                     av_display_rotation_set((uint32_t *)dst, 0);
+
+                if (ost->rotate_overridden) {
+                    if (sd->type == AV_PKT_DATA_DISPLAYMATRIX)
+                        av_display_rotation_set((uint32_t *)dst, -ost->rotate_override_value);
+                }
             }
         }
 
-- 

> 6 сент. 2018 г., в 18:42, Ilya Shcherbak <tthread at gmail.com> написал(а):
> 
> Currently there is ignoring "rotate" flag in metadata for the case when encoding is needing. The patch is propagating this flag to destination video.
> i.g.:
> ffmpeg -noautorotate -i input.mp4 -metadata:s:v:0 rotate=0 -vcodec libx264 output.mp4
> 
> this patch is allow us to do things like this: skip rotation flag and encode video as is and mark it as a normal video without rotation.
> 
> Best,
> Ilya.
> <0001-Added-rotation-override-for-encoding-case.patch>



More information about the ffmpeg-devel mailing list