This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit c47fe212725a1acd7007888bfe6e7927465e901f Author: Michael Niedermayer <[email protected]> AuthorDate: Sun Nov 29 12:33:44 2026 +0000 Commit: Baptiste Coudurier <[email protected]> CommitDate: Mon Nov 30 04:13:00 2026 +0000 avformat/movenc: keep packet duration when only the start is trimmed A skip-samples record may have no end discard. In that case do not replace a known duration with the nominal coded length. Keep the fallback for an unknown duration and for packets with trailing discard. Assisted-by: Fairy --- libavformat/movenc.c | 2 +- tests/fate/mov.mak | 7 +++++++ tests/ref/fate/mov-aac-head-skip-duration | 11 +++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 9af53ce43e..4b35a86c26 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -7811,7 +7811,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) /* a last packet of whole blocks may be shorter than its blocks */ discard = FFMAX(coded_samples - av_rescale_q(pkt->duration, trk->st->time_base, (AVRational){ 1, par->sample_rate }), 0); - } else if (sd) { + } else if (sd && (discard || !pkt->duration)) { coded_samples = av_get_audio_frame_duration2(par, pkt->size); if (coded_samples <= 0) coded_samples = par->frame_size; diff --git a/tests/fate/mov.mak b/tests/fate/mov.mak index 47bc1fc4ec..e5f039f45e 100644 --- a/tests/fate/mov.mak +++ b/tests/fate/mov.mak @@ -416,6 +416,13 @@ FATE_MOV_FFMPEG_SAMPLES-$(call REMUX, MP4 MOV, AAC_PARSER) \ += fate-mov-mp4-edst-remainder fate-mov-mp4-edst-remainder: CMD = stream_remux mov $(TARGET_SAMPLES)/audiomatch/tones_fdkaac_44100_stereo_aac_lc.m4a "" mp4 "" "" "-c:a copy" +# A leading skip alone must not replace the packet duration with 1024 samples. +FATE_MOV_FFMPEG_FFPROBE_SAMPLES-$(call REMUX, MP4 MOV, AAC_DECODER TRIM_BSF SETTS_BSF FFPROBE) \ + += fate-mov-aac-head-skip-duration +fate-mov-aac-head-skip-duration: CMD = transcode mov $(TARGET_SAMPLES)/audiomatch/tones_fdkaac_44100_stereo_aac_lc.m4a mp4 \ + "-map 0:a:0 -c copy -bsf:a trim=start=128,setts=ts=TS-128:duration=404 -frames:a 1 -movie_timescale 44100 -avoid_negative_ts disabled" \ + "-c copy" "-show_entries packet=pts,duration:stream=duration_ts -of compact" "" "" "-ignore_editlist 1" + # QDMC configuration must be written back in a wave atom FATE_MOV_FFMPEG_SAMPLES-$(call REMUX, MOV) += fate-mov-qdmc-remux fate-mov-qdmc-remux: CMD = transcode mov $(TARGET_SAMPLES)/qdmc/rumcoke.mov mov "-c copy -t 0.4" "-c copy" diff --git a/tests/ref/fate/mov-aac-head-skip-duration b/tests/ref/fate/mov-aac-head-skip-duration new file mode 100644 index 0000000000..abd4702039 --- /dev/null +++ b/tests/ref/fate/mov-aac-head-skip-duration @@ -0,0 +1,11 @@ +8b9d1146c7ab78f422e19e97fb293a3f *tests/data/fate/mov-aac-head-skip-duration.mp4 +1057 tests/data/fate/mov-aac-head-skip-duration.mp4 +#extradata 0: 2, 0x00340022 +#tb 0: 1/44100 +#media_type 0: audio +#codec_id 0: aac +#sample_rate 0: 44100 +#channel_layout_name 0: stereo +0, -128, -128, 404, 278, 0x70ec60fe, S=1, Skip Samples, 10, 0x079200ee +packet|pts=-128|duration=404 +stream|duration_ts=276 -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
