[FFmpeg-devel] [PATCH] ffmpeg: set user-set rotation for encoded streams too

Gyan Doshi ffmpeg at gyani.pro
Wed May 11 19:30:41 EEST 2022



On 2022-05-10 05:10 pm, Gyan Doshi wrote:
> So far, -metadata:s:v rotate would only be applied to streamcopied
> video streams.

Plan to push tomorrow.

Gyan

> ---
>   fftools/ffmpeg.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
> index a85ed18b08..7c1db2162a 100644
> --- a/fftools/ffmpeg.c
> +++ b/fftools/ffmpeg.c
> @@ -3048,6 +3048,13 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame)
>               av_reduce(&ost->frame_rate.num, &ost->frame_rate.den,
>                         ost->frame_rate.num, ost->frame_rate.den, 65535);
>           }
> +
> +        if (ost->rotate_overridden) {
> +            uint8_t *sd = av_stream_new_side_data(ost->st, AV_PKT_DATA_DISPLAYMATRIX,
> +                                                  sizeof(int32_t) * 9);
> +            if (sd)
> +                av_display_rotation_set((int32_t *)sd, -ost->rotate_override_value);
> +        }
>       }
>   
>       switch (enc_ctx->codec_type) {



More information about the ffmpeg-devel mailing list