From: Bryce Newman <bryce.newman@gettyimages.com> To: "ffmpeg-devel@ffmpeg.org" <ffmpeg-devel@ffmpeg.org> Subject: [FFmpeg-devel] [PATCH] libavformat/mov: Expose Quicktime poster_time value as metadata TAG. Date: Tue, 1 Feb 2022 16:28:40 +0000 Message-ID: <D412C54E-2E51-4522-A8FB-32C5C6CA613C@gettyimages.com> (raw) [-- Attachment #1.1: Type: text/plain, Size: 1611 bytes --] 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(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index a80fcc1606..4d4854c09e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -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; } -- 2.35.1 Bryce Chester Newman | Principal Developer p: +12069255045 | [-- Attachment #1.2: 0.png --] [-- Type: image/png, Size: 2684 bytes --] [-- Attachment #1.3: 1.png --] [-- Type: image/png, Size: 2260 bytes --] [-- Attachment #1.4: 2.png --] [-- Type: image/png, Size: 2256 bytes --] [-- Attachment #1.5: 3.png --] [-- Type: image/png, Size: 7110 bytes --] [-- Attachment #1.6: 4.jpg --] [-- Type: image/jpeg, Size: 6422 bytes --] [-- Attachment #2: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2022-02-01 16:28 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-01 16:28 Bryce Newman [this message] -- strict thread matches above, loose matches on Subject: below -- 2022-01-31 23:17 Bryce Newman 2022-01-31 23:17 Bryce Newman 2022-01-31 22:48 Bryce Newman 2022-01-31 22:24 Bryce Newman
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=D412C54E-2E51-4522-A8FB-32C5C6CA613C@gettyimages.com \ --to=bryce.newman@gettyimages.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git