On Sat, 15 Apr 2017, Carl Eugen Hoyos wrote:
2017-04-14 23:44 GMT+02:00 Mark Burton <mwjbur...@gmail.com>:
I find it hard having to accept an encode will always play out of
sync on certain players.
Could you elaborate a little?
So far, for every ticket, it either turned out that out-of-sync was
not reproducible with MPlayer / vlc (and FFmpeg) or it was off-
by-one-frame which I consider hard to reproduce...
Last time I checked (a year ago or so), ffmpeg created a correct .mov edit
list to signal the audio priming.
https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
Here is patch which writes Sample Group Description Atom and the
Sample-To-Group Atom as well, in addition to the already existing edit
list.
You can check if it makes a difference or not.
Regards,
Marton
From 64d9db76038b7b248bffe459b58b138c6b8fcc03 Mon Sep 17 00:00:00 2001
From: Marton Balint <c...@passwd.hu>
Date: Sat, 20 Feb 2016 19:32:18 +0100
Subject: [PATCH] avformat/movenc: add support for writing AAC Audio Priming
metadata
https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html
Signed-off-by: Marton Balint <c...@passwd.hu>
---
libavformat/movenc.c | 21 ++++++++++++++-------
tests/ref/fate/adtstoasc_ticket3715 | 4 ++--
tests/ref/fate/copy-psp | 4 ++--
tests/ref/fate/movenc | 12 ++++++------
4 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e6a70bf..5779e3c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2250,14 +2250,14 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, MOVTrack *track)
(AVRational){1, 1000},
(AVRational){1, 48000});
- if (track->entry) {
- sgpd_entries = av_malloc_array(track->entry, sizeof(*sgpd_entries));
- if (!sgpd_entries)
- return AVERROR(ENOMEM);
- }
+ if (!track->entry)
+ return 0;
- av_assert0(track->par->codec_id == AV_CODEC_ID_OPUS);
+ sgpd_entries = av_malloc_array(track->entry, sizeof(*sgpd_entries));
+ if (!sgpd_entries)
+ return AVERROR(ENOMEM);
+ if (track->par->codec_id == AV_CODEC_ID_OPUS) {
for (i = 0; i < track->entry; i++) {
int roll_samples_remaining = roll_samples;
int distance = 0;
@@ -2284,6 +2284,13 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, MOVTrack *track)
sgpd_entries[entries].group_description_index = distance ? ++group : 0;
}
}
+ } else {
+ entries++;
+ sgpd_entries[entries].count = track->sample_count;
+ sgpd_entries[entries].roll_distance = 1;
+ sgpd_entries[entries].group_description_index = ++group;
+ }
+
entries++;
if (!group)
@@ -2344,7 +2351,7 @@ static int mov_write_stbl_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContext
if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {
ff_mov_cenc_write_stbl_atoms(&track->cenc, pb);
}
- if (track->par->codec_id == AV_CODEC_ID_OPUS) {
+ if (track->par->codec_id == AV_CODEC_ID_OPUS || track->par->codec_id == AV_CODEC_ID_AAC) {
mov_preroll_write_stbl_atoms(pb, track);
}
return update_size(pb, pos);
diff --git a/tests/ref/fate/adtstoasc_ticket3715 b/tests/ref/fate/adtstoasc_ticket3715
index 949b565..96795a2 100644
--- a/tests/ref/fate/adtstoasc_ticket3715
+++ b/tests/ref/fate/adtstoasc_ticket3715
@@ -1,5 +1,5 @@
-ef8ce3cbd1d86113e7c991a816086068 *tests/data/fate/adtstoasc_ticket3715.mov
-33270 tests/data/fate/adtstoasc_ticket3715.mov
+0221e04333e6ac432fa42960502f0d5a *tests/data/fate/adtstoasc_ticket3715.mov
+33324 tests/data/fate/adtstoasc_ticket3715.mov
#extradata 0: 2, 0x00340022
#tb 0: 1/44100
#media_type 0: audio
diff --git a/tests/ref/fate/copy-psp b/tests/ref/fate/copy-psp
index 6603d3f..81eb172 100644
--- a/tests/ref/fate/copy-psp
+++ b/tests/ref/fate/copy-psp
@@ -1,5 +1,5 @@
-6889223644fc560069c8591984175a62 *tests/data/fate/copy-psp.psp
-2041379 tests/data/fate/copy-psp.psp
+cada61453a2483ef8ba1fb82c8bbff25 *tests/data/fate/copy-psp.psp
+2041433 tests/data/fate/copy-psp.psp
#extradata 0: 51, 0xaf6d1012
#extradata 1: 2, 0x00b200a1
#tb 0: 1/90000
diff --git a/tests/ref/fate/movenc b/tests/ref/fate/movenc
index 09e603a..47bcf9d 100644
--- a/tests/ref/fate/movenc
+++ b/tests/ref/fate/movenc
@@ -1,18 +1,18 @@
write_data len 36, time nopts, type header atom ftyp
-write_data len 2335, time nopts, type header atom -
+write_data len 2389, time nopts, type header atom -
write_data len 788, time 1000000, type sync atom moof
write_data len 110, time nopts, type trailer atom -
-214242e9c7c93171d2f47f5b47776559 3269 non-empty-moov
+17a37691eba8b858cf15e60aa9a7dbf7 3323 non-empty-moov
write_data len 36, time nopts, type header atom ftyp
-write_data len 2667, time nopts, type header atom -
+write_data len 2721, time nopts, type header atom -
write_data len 908, time 966667, type sync atom moof
write_data len 110, time nopts, type trailer atom -
-44467d568a3cc38d414fd8ed4b2a968f 3721 non-empty-moov-elst
+0026ffe059c06c592021f972bf2c5e79 3775 non-empty-moov-elst
write_data len 36, time nopts, type header atom ftyp
-write_data len 2575, time nopts, type header atom -
+write_data len 2629, time nopts, type header atom -
write_data len 908, time 1000000, type sync atom moof
write_data len 110, time nopts, type trailer atom -
-de22b98a3885f9b4b83cdd48ff46aeb9 3629 non-empty-moov-no-elst
+c184e168ac1e5bb3d9c70e580ab6179c 3683 non-empty-moov-no-elst
write_data len 20, time nopts, type header atom ftyp
write_data len 1171, time nopts, type header atom -
write_data len 728, time 0, type sync atom moof
--
2.10.2
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".