diff options
author | Felicia Lim <flim@google.com> | 2025-02-20 12:50:28 -0800 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2025-04-14 17:25:39 -0300 |
commit | 2229b741273818dc722a2bfcb6410067902b514c (patch) | |
tree | 38e10b8be0886a83b9a7d394b2aeea65d6d05c53 /libavformat/movenc.c | |
parent | d36883f1196bb7c5e702c7f36aa4762068150dc2 (diff) | |
download | ffmpeg-2229b741273818dc722a2bfcb6410067902b514c.tar.gz |
avformat/movenc: fix setting elst/stss for IAMF with Opus
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 6ef5b73960..4bc8bd1b2a 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3092,6 +3092,10 @@ static int mov_write_stts_tag(AVIOContext *pb, MOVTrack *track) } for (i = 0; i < track->entry; i++) { int duration = get_cluster_duration(track, i); +#if CONFIG_IAMFENC + if (track->iamf && track->par->codec_id == AV_CODEC_ID_OPUS) + duration = av_rescale(duration, 48000, track->par->sample_rate); +#endif if (i && duration == stts_entries[entries].duration) { stts_entries[entries].count++; /* compress */ } else { @@ -4022,6 +4026,11 @@ static int mov_write_edts_tag(AVIOContext *pb, MOVMuxContext *mov, * rounded to 0 when represented in movie timescale units. */ av_assert0(av_rescale_rnd(start_dts, mov->movie_timescale, track->timescale, AV_ROUND_DOWN) <= 0); start_ct = -FFMIN(start_dts, 0); + +#if CONFIG_IAMFENC + if (track->iamf && track->par->codec_id == AV_CODEC_ID_OPUS) + start_ct = av_rescale(start_ct, 48000, track->par->sample_rate); +#endif /* Note, this delay is calculated from the pts of the first sample, * ensuring that we don't reduce the duration for cases with * dts<0 pts=0. */ |