* [FFmpeg-devel] [PATCH] libavformat/asfdec_f: add asf video average framerate support
@ 2025-10-09 11:21 ZhangXu via ffmpeg-devel
2025-10-13 23:15 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
0 siblings, 1 reply; 4+ messages in thread
From: ZhangXu via ffmpeg-devel @ 2025-10-09 11:21 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: zhangxu
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] Re: [PATCH] libavformat/asfdec_f: add asf video average framerate support
2025-10-09 11:21 [FFmpeg-devel] [PATCH] libavformat/asfdec_f: add asf video average framerate support ZhangXu via ffmpeg-devel
@ 2025-10-13 23:15 ` Michael Niedermayer via ffmpeg-devel
2025-10-14 4:26 ` via ffmpeg-devel
2025-10-23 11:21 ` via ffmpeg-devel
0 siblings, 2 replies; 4+ messages in thread
From: Michael Niedermayer via ffmpeg-devel @ 2025-10-13 23:15 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Michael Niedermayer
[-- Attachment #1.1: Type: text/plain, Size: 1755 bytes --]
Hi
On Thu, Oct 09, 2025 at 07:21:09PM +0800, ZhangXu via ffmpeg-devel wrote:
> 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(-)
This breaks fate
--- ./tests/ref/fate/wmv3-drm-nodec 2025-09-24 19:09:24.202291445 +0200
+++ tests/data/fate/wmv3-drm-nodec 2025-10-14 01:10:51.797737754 +0200
@@ -10,55 +10,55 @@
#codec_id 1: wmavoice
#sample_rate 1: 22050
#channel_layout_name 1: mono
-0, 0, 0, 0, 282, 0x000d949a
+0, 0, 0, 33, 282, 0x000d949a
1, 0, 0, 0, 1088, 0x5cd379bb
1, 435, 435, 0, 1088, 0x8dfa1368
1, 740, 740, 0, 1088, 0xc0d211be
1, 1023, 1023, 0, 1088, 0x8238113a
-0, 1208, 1208, 0, 137, 0x903c415e, F=0x0
-0, 1250, 1250, 0, 942, 0xd5b7d2aa, F=0x0
-0, 1291, 1291, 0, 841, 0xaffd8ce6, F=0x0
+0, 1208, 1208, 33, 137, 0x903c415e, F=0x0
+0, 1250, 1250, 33, 942, 0xd5b7d2aa, F=0x0
+0, 1291, 1291, 33, 841, 0xaffd8ce6, F=0x0
1, 1306, 1306, 0, 1088, 0x9f8924b7
Also the duration values seem not correct at all
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 163 bytes --]
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] Re: [PATCH] libavformat/asfdec_f: add asf video average framerate support
2025-10-13 23:15 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
@ 2025-10-14 4:26 ` via ffmpeg-devel
2025-10-23 11:21 ` via ffmpeg-devel
1 sibling, 0 replies; 4+ messages in thread
From: via ffmpeg-devel @ 2025-10-14 4:26 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: zhangxu
Thanks for your reply, I will continue to work on some details
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FFmpeg-devel] Re: [PATCH] libavformat/asfdec_f: add asf video average framerate support
2025-10-13 23:15 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
2025-10-14 4:26 ` via ffmpeg-devel
@ 2025-10-23 11:21 ` via ffmpeg-devel
1 sibling, 0 replies; 4+ messages in thread
From: via ffmpeg-devel @ 2025-10-23 11:21 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: zhangxu
Hi, Michael Niedermayer
My modification is to make ASF Demux give a reference frame rate information from the file information.
However, I debugged the fate process and found that if I added the avg_frame_rate information in the stream, the guess_pkt_duration function() in mux.c with the framecrc muxer process would automatically generate the duration based on the avg_frame_rate, which would cause fate's CRC to report an error. So this modification will definitely lead to inconsistent results in fate.
Do you have any good suggestions for solving this problem?
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-23 11:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-09 11:21 [FFmpeg-devel] [PATCH] libavformat/asfdec_f: add asf video average framerate support ZhangXu via ffmpeg-devel
2025-10-13 23:15 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
2025-10-14 4:26 ` via ffmpeg-devel
2025-10-23 11:21 ` via ffmpeg-devel
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