@@ -1525,12 +1525,21 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb32(pb); /* preview time */
avio_rb32(pb); /* preview duration */
- avio_rb32(pb); /* poster time */
+ int32_t poster_time = avio_rb32(pb); /* poster time */
avio_rb32(pb); /* selection time */
avio_rb32(pb); /* selection duration */
avio_rb32(pb); /* current time */
avio_rb32(pb); /* next track ID */
+ av_log(c->fc, AV_LOG_TRACE, "poster_time = %i, time_scale = %i\n", poster_time, c->time_scale);
+ if(poster_time && c->time_scale && c->time_scale > 0) {
+ char buffer[32];
+ float poster_time_location = (float)poster_time / c->time_scale;
+ snprintf(buffer, sizeof(buffer), "%.2f", poster_time_location);
+ /* This will appear as a TAG in the format section of FFProbe output using -show_format */
+ av_dict_set(&c->fc->metadata, "poster_time", buffer, 0);
+ }
+
return 0;
}
I need the ability to derive the poster time found in the mvhd, so I can use that value to create a thumbnail from ffmpeg. More details can be found here https://www.mail-archive.com/ffmpeg-user@ffmpeg.org/msg30003.html Signed-off-by: Bryce Chester Newman <bryce.newman@gettyimages.com> --- libavformat/mov.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)