[FFmpeg-devel] [PATCH] Notify user when encode a CBR mp3 file without "-write_xing false". This may result in mp3 file duration incorect on ios safari browser and webview. I try to fix it but it can’t be done as mp3 muxer don’t know it is a CBR file until encode process finished. And it’s hard to remove the first frame at that time. Only the mp3 encoder(such as libmp3lame) know it is CBR or not before encoding start.

sharp bai sharpbai at gmail.com
Sun Apr 23 07:26:39 EEST 2017


ios safari browser support the xing header, and the duration of the
mp3 file with xing header is correct. But with "Info" replaced "Xing"
in xing header in CBR mode, ios safari browser does not skip the first
frame and using the first frame header(the bitrate in header has
changed to enlarge frame size as xing frame needs at least 177 bytes)
to calculate duration.

2017-04-23 0:29 GMT+08:00 Michael Niedermayer <michael at niedermayer.cc>:
> On Fri, Apr 21, 2017 at 10:59:41PM +0800, sharpbai at gmail.com wrote:
>> From: sharpbai <sharpbai at gmail.com>
>>
>> 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(-)
>
> ios safari browser doesnt support the xing header ?
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Regards,

Sharpbai
Focus on web programming.

Blog - http://blog.tbai.me/
Weibo - http://weibo.com/iambaitian
Renren - http://renren.com/sharpbai


More information about the ffmpeg-devel mailing list