[FFmpeg-trac] #8329(ffmpeg:new): Rotation metadata not overridden when the input video has rotation metadata set to 180
FFmpeg
trac at avcodec.org
Tue May 12 16:29:14 EEST 2020
#8329: Rotation metadata not overridden when the input video has rotation metadata
set to 180
-----------------------------------+----------------------------------
Reporter: hungryTux | Owner:
Type: defect | Status: new
Priority: important | Component: ffmpeg
Version: 4.2 | Resolution:
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-----------------------------------+----------------------------------
Changes (by d3im):
* priority: normal => important
* version: unspecified => 4.2
Comment:
The problem code is here: (in ffmpeg.c)
It only solves rotation when autorotate is set (its easy - autorotate
rotates to correct rotation and sets rotate metadata to 0 deg.).
{{{
/*
* Add global input side data. For now this is naive, and copies
it
* from the input stream's global side data. All side data should
* really be funneled over AVFrame and libavfilter, then added
back to
* packet side data, and then potentially using the first packet
for
* global side data.
*/
if (ist) {
int i;
for (i = 0; i < ist->st->nb_side_data; i++) {
AVPacketSideData *sd = &ist->st->side_data[i];
uint8_t *dst = av_stream_new_side_data(ost->st, sd->type,
sd->size);
if (!dst)
return AVERROR(ENOMEM);
memcpy(dst, sd->data, sd->size);
if (ist->autorotate && sd->type ==
AV_PKT_DATA_DISPLAYMATRIX)
av_display_rotation_set((uint32_t *)dst, 0);
}
}
}}}
This helps a little:
Set rotation to 0 autorotate and manual also.
{{{
if (ist) {
int i;
for (i = 0; i < ist->st->nb_side_data; i++) {
AVPacketSideData *sd = &ist->st->side_data[i];
uint8_t *dst = av_stream_new_side_data(ost->st, sd->type,
sd->size);
if (!dst)
return AVERROR(ENOMEM);
if (sd->type == AV_PKT_DATA_DISPLAYMATRIX) {
av_display_rotation_set((uint32_t *)dst, 0);
} else {
memcpy(dst, sd->data, sd->size);
}
}
}
}}}
Anyway the original code should be corrected not to copy all side data.
This is just a quick fix not for all situations.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8329#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list