From: sharpbai <[email protected]>
Bug example:
ffmpeg -i a.mp3 -c:a mp3 -ab 32k -ar 44100 -ac 1 b.mp3
The duration of the generated file b.mp3 is wrong on ios safari browser from
ios7 to ios10.
---
libavformat/mp3enc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 3cbf7bd..a55dbf4 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -395,8 +395,13 @@ static void mp3_update_xing(AVFormatContext *s)
int i, rg_size;
/* replace "Xing" identification string with "Info" for CBR files. */
- if (!mp3->has_variable_bitrate)
+ if (!mp3->has_variable_bitrate) {
AV_WL32(mp3->xing_frame + mp3->xing_offset, MKTAG('I', 'n', 'f', 'o'));
+ av_log(s, AV_LOG_WARNING,
+ "This is a CBR mp3 file. But its first frame header might be
wrong, "
+ "which result in file duration incorrect on ios browser. "
+ "Please add \"-write_xing false\" to avoid this problem.\n");
+ }
AV_WB32(mp3->xing_frame + mp3->xing_offset + 8, mp3->frames);
AV_WB32(mp3->xing_frame + mp3->xing_offset + 12, mp3->size);
--
2.2.1
_______________________________________________
ffmpeg-devel mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel