From: ZhangXu via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> To: <ffmpeg-devel@ffmpeg.org> Cc: zhangxu <zhangxu@sobey.com> Subject: [FFmpeg-devel] [PATCH] libavformat/asfdec_f: add asf video average framerate support Date: Thu, 9 Oct 2025 19:21:09 +0800 Message-ID: <20251009112109.11309-1-zhangxu@sobey.com> (raw) From: zhangxu <zhangxu@sobey.com> Refer to Advanced Systems Format (ASF) Specification Parse AverageTimePerFrame from ExtendedStreamPropertiesObject Signed-off-by: ZhangXu <zhangxu@sobey.com> --- libavformat/asfdec_f.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index 3b46fe01f6..aaff5278d9 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -63,6 +63,8 @@ typedef struct ASFStream { int64_t packet_pos; + int64_t avg_time_dur; ///< the average time duration + uint16_t stream_language_index; int palette_changed; @@ -481,6 +483,7 @@ static int asf_read_ext_stream_properties(AVFormatContext *s) int ext_len, payload_ext_ct, stream_ct, i; uint32_t leak_rate, stream_num; unsigned int stream_languageid_index; + uint64_t stream_avg_time_dur; avio_rl64(pb); // starttime avio_rl64(pb); // endtime @@ -498,7 +501,10 @@ static int asf_read_ext_stream_properties(AVFormatContext *s) if (stream_num < 128) asf->streams[stream_num].stream_language_index = stream_languageid_index; - avio_rl64(pb); // avg frametime in 100ns units + stream_avg_time_dur = avio_rl64(pb); // avg frametime in 100ns units + if (stream_num < 128) + asf->streams[stream_num].avg_time_dur = stream_avg_time_dur; + stream_ct = avio_rl16(pb); // stream-name-count payload_ext_ct = avio_rl16(pb); // payload-extension-system-count @@ -838,6 +844,10 @@ static int asf_read_header(AVFormatContext *s) i, st->codecpar->codec_type, asf->dar[i].num, asf->dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); + //this field set for video + if (asf->streams[i].avg_time_dur && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) + av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, 10000000, asf->streams[i].avg_time_dur, INT_MAX); + // copy and convert language codes to the frontend if (asf->streams[i].stream_language_index < 128) { const char *rfc1766 = asf->stream_languages[asf->streams[i].stream_language_index]; -- 2.25.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
reply other threads:[~2025-10-09 11:24 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251009112109.11309-1-zhangxu@sobey.com \ --to=ffmpeg-devel@ffmpeg.org \ --cc=zhangxu@sobey.com \ /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 http://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/ http://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